Copy the Action-name

Posted By: sebbi91

Copy the Action-name - 09/25/12 15:42

Hi Community,

I want to to duplicate (copy) an Entity.

I want something like that:
Quote:

....
act_name_ent=you.action_name;
ent_create("tmp.mdl",create_pos,act_name_ent);
....


I know, that this is not possible, I tried something like reading the name from an infofile and fill a String with it.
Like that:

Quote:

....
STRING* act_name_ent= "";
....
//open the file and replace "" with "your_action" (ACTION your_action())

ent_create("tmp.mdl",create_pos,act_name_ent);
....


But all I've got is Error E1513.

There is no other way!
I need to get the Action-Name from the scanned Entity.

Is there anyone who can solve this?
Thanks in advance!

Best regards
Sebbi
Posted By: MasterQ32

Re: Copy the Action-name - 09/25/12 16:13

you can either store some function pointer in a skill or you can use engine_getscript to get the action/function by name

the first one works like this:

ent = ent_create([...], myaction);
ent.actionptr = myaction;
[...]
you = ent_create(ent.type, ent.x, ent.actionptr);

the second one:

ent = ent_create([...], myaction);
ent.string1 = "myaction";
[...]
you = ent_create(ent.type, ent.x, engine_getscript(_chr(ent.string1))); // EDIT: Too dumb to write correct cody, sorry!
Posted By: Espér

Re: Copy the Action-name - 09/25/12 17:25

you evencan use engine_getscript, and let the action parameter of ent_create NULL.
Now just give the action name to the entity with:
pointer.event = the engine_getscript_function.
© 2024 lite-C Forums