Page 1 of 1

Changing NPC event scripts on the fly...

Posted: Mon Oct 18, 2004 7:22 pm
by Cromwell
I heard somewhere it was possible, i'm asking because i have a system in which i spawn some Standard palette npc and i want to use henchmen AI, rather than putting this NPC in the custom palette and changing the scripts, i rather do it "on the fly" by adding variables on the npc to define ondeath, onspawn etc event types.

Posted: Mon Oct 18, 2004 9:43 pm
by Sarrena
Likely be a matter of writing a script to take the target in game clicked, have it duplicate it with the scripts you want pluged in and wipe the original. Just like the PC mirrior one from the OC but with script shifting.

Posted: Mon Oct 18, 2004 9:45 pm
by Arcsylver
Jeff from Ea has a spawn system that can do a lot of what you are wanting.

You may want to talk with him about how he sets the variables on his spawns on the fly using the DM Client a bit for some ideas.

I cant give details as I agreed to no divulge anything of his code for intellectual property reasons however and I will not violate his rights in that regard.

Posted: Tue Oct 19, 2004 2:50 am
by Mistcaller
The most sufficient way I can think of is to use the SignalEvent command

Example:
object oNPC;
event eSpecialEvent;

eSpecialEvent = EventUserDefined(1234);
SignalEvent(oNPC,eSpecialEvent);
In other words, you can have one script (In the User Defined event) with many different numbered events, that can be activated by any external source, but under normal conditions they are slumbering...

Posted: Tue Oct 19, 2004 10:56 am
by Guest
Looked at that, and unfortunetly it doesn't have onspawn ondeath and a few others i need... It does have heartbeat... But thats more work than nessacary, i guess i will just throw them over into the custom palette.