|
2 registered members (ApprenticeInMuc, 1 invisible),
3,647
guests, and 4
spiders. |
|
Key:
Admin,
Global Mod,
Mod
|
|
|
Changing Function/Action at runtime?
#276030
07/03/09 09:19
07/03/09 09:19
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
OP
Serious User
|
OP
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
I know this might sound strange but is it possible to redefine an entity's function or action at runtime?
I currently have a basic workaround that creates a new entity using ent_create, with the new function name, and then i get the properties of the existing entity (x,y,z,pan,roll etc), and set them to the new entity.
This sort of works, but it takes time and i don't know if i can set all properties, like flags etc.
|
|
|
Re: Changing Function/Action at runtime?
[Re: pegamode]
#276051
07/03/09 10:11
07/03/09 10:11
|
Joined: May 2002
Posts: 7,441
ventilator
Senior Expert
|
Senior Expert
Joined: May 2002
Posts: 7,441
|
Call a new function and inside this function set the my-pointer to the entity's pointer. you don't have to do it inside. you can do it from outside like that: my = entity; new_function(); my simply is a global variable that always gets stored/restored by wait(). I'm trying to do it programatically at the start of my script. i do something very similar in my python wrapper. only with lite-c the WED actions get started automatically. in my python wrapper i have to do it manually. so i have my own level_load() function which reads the action names from the wmb file and then simply sets the my pointer before calling the right function. it works exactly like in lite-c. and you could modify a wmb file of course. the file format specifications are in the manual. you could look into my a7_scheduler.py and the function get_actions() to see how i read the actions. writing the actions would only require some small changes.
|
|
|
Re: Changing Function/Action at runtime?
[Re: ventilator]
#276062
07/03/09 10:25
07/03/09 10:25
|
Joined: Nov 2007
Posts: 1,143 United Kingdom
DJBMASTER
OP
Serious User
|
OP
Serious User
Joined: Nov 2007
Posts: 1,143
United Kingdom
|
i have my own level_load() function which reads the action names from the wmb file and then sets the my pointer before calling the function. Oh, would you mind telling me how you can read the action names? and you could changes wmb files of course. I can actually edit the .wmb files, and update the names of the actions inside? I thought this couldn't be done. If so could you explain how i can do this? Thanks.
|
|
|
|