I have my torch and flame ready to go but I cannot get the sample code to work from the questiona nd answer section of aum 31. I put the code in the main script file of my game but I get a 'empty pointer' error message. Can anyone help?
-code listing-
Q: Trying to set up a simple fire effect for torches is beyond my comprehension. Can you help?
A: Sure. Use the code below:
bmap fire_map = <flame.tga>;
function fire_init();
function fade_away();
action fire_generator
{
my.invisible = on;
my.passable = on;
while (1)
{
effect(fire_init, 1, my.pos, normal);
wait (1);
}
}
function fire_init()
{
my.bmap = fire_map;
my.alpha = 12; // play with this value
my.size = 5;
my.flare = on;
my.bright = on;
my.move = on;
my.x += 2 - random (4);
my.y += 2 - random (4);
my.z += 1 + random (1);
my.function = fade_away;
}
function fade_away()
{
my.alpha -= 0.5 * time;
if (my.alpha <= 0)
{
my.lifespan = 0;
}
}