Hi all,
I have a question cuz something in my script doesn't work, but it don't give an error.
The script is for a laserbullet. The laserbullet is a invisible box obj that has a local_number var so that all the effects are attached to a different box. The basic script goes like this:
function hit_event(local_laserball_number)
{
if (event_type == EVENT_BLOCK)
{
effect(laserball_explo_effect,15,my.x,normal);
laserball_effect_destroy(local_laserball_number);
wait(1);
ent_remove(me);
}
if (event_type == EVENT_ENTITY)
{
effect(laserball_explo_effect,15,my.x,normal);
laserball_effect_destroy(local_laserball_number);
wait(1);
ent_remove(me);
}
}
action laserball
{
var local_laserball_number = 1; // for instance
my.INVISIBLE = ON;
my.ENABLE_BLOCK = ON;
my.ENABLE_ENTITY = ON;
my.EVENT = hit_event(local_laserball_number);
while (my != NULL)
{
c_move(me, laserball_move, NULLVECTOR, ACTIVATE_TRIGGER|GLIDE);
wait(1);
}
}
Somehow it does not work if the my.EVENT = hit_event
(local_laserball_number); but it works with my.EVENT = hit_event; whithout any () or (local_laserball_number)
I do not know why it should make a difference. Is there a solucion for this? Because if there is not I have no idea how to store local variables in functions!
If somebody could help me explain this problem I would apreciate that very much =]
(Sorry for my bad Englisch, its not my first language)