Skip to content

OnSpawn weird bug

Hey guys!
I'm using a custom spawn system via nw_c2_default9.nss and can't understand something. When I start a module normally from a game menu, my system doesn't work, but if I restart module via StartNewModule() - it works all the time. I'm not sure how to debug this situation. Maybe someone has a clue? thanks

Comments

  • MelkiorMelkior Member Posts: 233
    What calls the script? What you're talking about sounds like a script which is only called when a creature is created (spawns) in the game. A custom spawn system would more likely be called by triggers, or by OnClientEnter for the module, or by OnEnter for areas. In any case, it sounds like the script is being triggered by the wrong action.
  • DestherSurvivedDestherSurvived Member Posts: 5
    Melkior wrote: »
    What calls the script? What you're talking about sounds like a script which is only called when a creature is created (spawns) in the game. A custom spawn system would more likely be called by triggers, or by OnClientEnter for the module, or by OnEnter for areas. In any case, it sounds like the script is being triggered by the wrong action.

    Well, yeah, it is exactly called from nw_c2_default9. I just thought there was some kind of bug or something. Because after calling StartNewModule() its works perferctly in every area. Was hoping someone's had the same issue.
  • MelkiorMelkior Member Posts: 233
    edited August 17
    There's a germ of memory in my mind that this is a known issue. I can't remember the details offhand. The short version is that if you want the OnSpawn scripts for a creature to "fire off" correctly, then it has to be spawned by a script or encounter or the module must be started in a particular way.
    So, this is a known issue and unlikely to be changed. But you can get around it by ensuring that enemy are always either spawned from an "encounter" or by the CreateObject scripting command... I think.
  • DestherSurvivedDestherSurvived Member Posts: 5
    Got it. Thanks!
Sign In or Register to comment.