apply an action to an entity after it has been created

Posted By: Toryno

apply an action to an entity after it has been created - 04/16/09 15:57

How can I apply an action to an entity after ent_create?
I mean it like here:
Code:
ent_create("bullet.mdl",my.x, NULL);
wait(1);
set(my, PASSABLE);
my.pan = temp_pan;
my.tilt = temp_tilt;
my.action = fly; // this doesn't work, but how must it be written!?

Posted By: Quad

Re: apply an action to an entity after it has been created - 04/16/09 16:03

ent_create("bullet.mdl",my.x, NULL);

instead of NULL, you write your actions name.
Posted By: Toryno

Re: apply an action to an entity after it has been created - 04/16/09 16:13

my problem is that every bullet can have another speed. i don't know how to make this, i don't want to make a new action for every speed wink
Posted By: Toryno

Re: apply an action to an entity after it has been created - 04/16/09 16:23

Ah i found an other way ;D
Posted By: DiegoFloor

Re: apply an action to an entity after it has been created - 04/19/09 21:01

Quote:
Ah i found an other way ;D


Wich is..? smile

I would really like to be able to pass some parameters with the action, like a function, when creating entities.
Posted By: Pappenheimer

Re: apply an action to an entity after it has been created - 04/19/09 21:42

Probably such a way:

Define _bullet_speed, skill99;

action bullet()
{
ent_move(...my._bullet_speed....)
}

function shooting()
{
you = ent_create(..., bullet)//This is the important part where you get the pointer to the created entity
you._bullet_speed = 20;
....

© 2024 lite-C Forums