Skip to content

Question about CopyObject and the bCopyLocalState [resolved]

DamonyaDamonya Member Posts: 4
edited April 2022 in Builders - Scripting
Hello,

thanks for adding the bCopyLocalState in the CopyObject function.

I have a question though because I feel like it doesn't work with NW_FLAGs when I try to copy a creature that uses the OnSpawn script using SetSpawnInCondition.

Post edited by Damonya on

Comments

  • ForSeriousForSerious Member Posts: 446
    You can test it by printing out all the variables you want know about on the copied object.
    Just from looking at the description, it sounds like it copies everything. So if a spawn in condition has already ran its course, it will have ran its course on the copied object as well.
    It could even be that copying an object like that, does not fire the on spawn script.
  • DamonyaDamonya Member Posts: 4
    In fact, I use the famous Sparky spawn script to spawn my NPCs with the "copy" variable. I modified sparky to take into account the bCopyLocalState with the CopyObject() function. It works well on variables that I add myself. On the other hand, when I use a SetSpawnInCondition on a copied NPC (which I run with a local variable GetCreatureFlag), for example to launch a script on onUserDefined, this one does not work.
  • DamonyaDamonya Member Posts: 4
    ForSerious wrote: »
    It could even be that copying an object like that, does not fire the on spawn script.

    Here :

    https://nwn.wiki/display/NWN1/1.69

    Patch 1.68

    Fix to CopyObject() so that copied creatures now run their OnSpawn script.
  • DamonyaDamonya Member Posts: 4
    edited April 2022
    Ok, sorry, I have found the problem.

    This is my fault, because i use a hak pak version of the script so my modification was no repercut in game.

    I just have to change the name of the script...

    I'm bad... Sorry
    Post edited by Damonya on
  • ForSeriousForSerious Member Posts: 446
    Glad you found what was wrong. I was out of ideas of how to help.
Sign In or Register to comment.