Use a sprite as target(place the sprite where you would like the flame to ignite)
set the sprite invisible and use this code.
Code:
BMAP fire_map,<fire.tga>;//this is the fire
var parray [1801]; // will be used as a 300*6 multi dimensional array
// each of the 300 entries will consist of: 0 = flag, 1 = x_pos, 2-5 = data slots
var ppoint = 0; // points to the next free entry-slot, is set through searcharray()
function sarray() {
ppoint = 0;
while (parray [ppoint*6] != 0) { ppoint += 1; }
}
action my_fire {
sarray(); // look for free array slot
if (ppoint >= 300) { END; } // stop action if too many emitters already present
my.skill14 = ppoint; // set skill14 accordingly
parray[my.skill14 * 6] = 1; // set flag of the slot to occupied
if (my.skill8 == 0) { my.skill8 = 4; } // rate 0 defaults to 4
if (my.skill7 == 0) { my.skill7 = 1; } // size 0 defaults to 1
if (my.skill7 < 0.2 && my.skill7 != -1) { my.skill7 = 0.2; } // check size values and correct them
if (my.skill7 > 3) { my.skill7 = 3; }
while(1) { // fire burns forever
if (my.skill7 > 0) { // check if fire is turned ON
my.skill13 -= 1; // decrease emit counter
if (my.skill13 <= 0) {
my.skill13 = my.skill8 / TIME; // set counter according to skill8
parray[my.skill14 * 6 +2] = my.skill7; // set size value in array
parray[my.skill14 * 6 +1] = my.x + (random(4) - 2) * my.skill7; // set pos.x value in array
my.skill10 = my.skill14; // array pointer stored in x_pos
my.skill11 = my.y + (random(4) - 2) * my.skill7; // set pos.y for emit
my.skill12 = my.z; // set pos.z for emit
emit(1,my.skill10,feuer_particle); // emit particle
parray[my.skill14 * 6 +1] = my.x + (random(4) - 2) * my.skill7; // set new pos.x
my.skill11 = my.y + (random(4) - 2) * my.skill7; // set new pos.y
emit(1,my.skill10,feuer_particle); // emit second particle
}
}
wait(1);
}
}
function feuer_particle(){
if(my_age == 0) {
my_alpha = 0; // set to invisible at start
my_color.blue = parray[my_pos.x * 6 + 2]; // get size from array
my_pos.x = parray[my_pos.x * 6 + 1]; // restore real pos.x
my_speed.z = (1.7+random(0.4)) * my_color.blue; // set speed.z
my_color.red = random (100); // set some random values
my_color.green = random (100);
my_size = (2000+random(300)) * my_color.blue; // set size
my_map = fire_map; // set map
my_flare = on; // set to transparent (my_transparent seems to be buggy on some graphics cards
my_bright= on; // set my_bright to achieve the gloving effect
END;
}
if (my_age > 30) { // kill particle if too old
MY_ACTION = NULL;
}
if (my_age > 7) { // set alpha according to age
my_alpha = 100-MY_AGE*3.3;
} else { my_alpha = my_age * 10; }
my_speed.x = (sin(my_age*7+my_color.red) / 7) * my_color.blue; // play with speed values
my_speed.y = (cos(my_age*8+my_color.green) / 7) * my_color.blue;
}
This should get the fire going!
o yea a decent effect is to have a flickering light!
so try this..
place a light underneth your torch and use this code
ACTION fire_light
{
my.invisible = on;
my.red = 50;
my.green = 5;
my.blue = 2;
while(1)
{
waitt(1);
MY.LIGHTRANGE = 0;
MY.LIGHTRANGE = int(Random(175)) + 12;
wait(1);
}
}