I don't know how to phrase the title correctly, so im going to explain my problem here.
Basically i just wanna make a function that spreads flame in random coordinate in the spesific radius. I managed to do that, but the problem is that, if the flame spreads on air, the "fire" sprites are also floating on air, to fix this, i think im going to modify the sprite's origin so that it will show the sprites on the ground. (The x and y axis is fine, just need to modify the z axis)
So, my question is that how do i get from a normal origin to the new origin that is actually placed on the ground.
I think it's like "EngFunc_DropToFloor" but for an origin instead of an entity
This is the actual code
Code:
stock random_fire(iOrigin[3], max_radius, count) {
for(new i = 0; i < count; i++){
new Float:rand_coord[2]
new Float:theta
new Float:r
new Float:rand[2]
new randomSize = random_num(7,12)
rand[0] = random_float(0.0, 1.0);
rand[1] = random_float(0.0, 1.0);
r = max_radius * rand[0]
theta = rand[1] * 7
rand_coord[0] = r*floatcos(theta, radian)
rand_coord[1] = r*floatsin(theta, radian)
message_begin(MSG_BROADCAST, SVC_TEMPENTITY);
write_byte(TE_SPRITE);
write_coord(iOrigin[0] + floatround(rand_coord[0]));
write_coord(iOrigin[1] + floatround(rand_coord[1]));
write_coord(iOrigin[2]);
write_short(firespr);
write_byte(randomSize);
write_byte(255);
message_end();
}
}