I was thinking about replacing the default script nw_c2_default1 and adding in code that lets the HB script call another script that is stored as a local string on the object running the default script. It seems safe. Any warnings or hints?
Is it safe to hook into the default OnHeatbeat script.
Débuté par
M. Rieder
, mai 31 2011 12:04
#1
Posté 31 mai 2011 - 12:04
#2
Posté 31 mai 2011 - 12:16
I've done it before. It seems to be fine. I'm not sure why so many event handler scripts have hooks for custom scripts (OnSpawn, etc.) and some don't (OnHB). If you use the same format those other event handlers use, I don't really see any problems.
Of course, since a lot of AI behavior is called out of OnHB, it's possible that you might not get the behavior you expect. And if it's combat AI you're going for, it might be simpler to use the variable already provided for this (CUSTOM_AI_SCRIPT or something like that).
Of course, since a lot of AI behavior is called out of OnHB, it's possible that you might not get the behavior you expect. And if it's combat AI you're going for, it might be simpler to use the variable already provided for this (CUSTOM_AI_SCRIPT or something like that).
#3
Posté 31 mai 2011 - 12:19
Hmmm... I didn't know about the other hooks. Is there a list somewhere for the other hooks?
#4
Posté 31 mai 2011 - 01:29
M. Rieder wrote...
Hmmm... I didn't know about the other hooks. Is there a list somewhere for the other hooks?
Not to my knowledge. The ones I've used are OnSpawn (default9) and OnDeath (default7). They take a simple form as you'd expect, like so:
string sSpawnScript=GetLocalString(OBJECT_SELF,"SpawnScript");
if (sSpawnScript!="")
ExecuteScript(sSpawnScript,OBJECT_SELF);
It's usually at the very end of the script, but sometimes it's at the beginning. I'd say that if you want it to override default behavior having it at the end is probably best.
#5
Posté 31 mai 2011 - 04:38
What I tend to do is call the default script from a custom script, and use that. This way, you know that the default script is always being called, so you can modify it with things you want to effect everyone. On a bigger scale, so can anyone else (for example if someone installs Kaedrin-like override mods such as those ones which make monsters tougher like KevL's PIA).
Previously, they used to favour User Defined events a lot, which now they don't seem to care about. You could switch on the OnHeartbeat user defined event in the OnSpawn script and then just use a custom UD event.
Previously, they used to favour User Defined events a lot, which now they don't seem to care about. You could switch on the OnHeartbeat user defined event in the OnSpawn script and then just use a custom UD event.
#6
Posté 31 mai 2011 - 12:03
i put a small snip of code in the default HeartBeat, that calls the core script, but did the checks right there in the onHeartBeat script (rather than the core script) to make sure the game *really needed* to access another script ..
It doesn't fire often but when it does it's not a problem
It doesn't fire often but when it does it's not a problem





Retour en haut






