On Spawn



  • This isn't working, and I'm baffled. It should. What have I got wrong for this in an OnSpawn script?

      string sMyCorpse = GetLocalString(OBJECT_SELF, "sMyCorpse");
        object oMyCorpse = CreateObject(OBJECT_TYPE_CREATURE, "sMyCorpse", GetLocation(OBJECT_SELF), FALSE);
        //Debug
        SpeakString(sMyCorpse, TALKVOLUME_TALK);
            SetImmortal(oMyCorpse, TRUE);
    


  • So… it is supposed to spawn a corpse item into the inventory of the creature when they spawn, based on a variable you set on the creature spawning?

    wait.. can't be an item into inventory as its using location to spawn, and also its creature object type.

    So this spawns another creature?

    nevermind! I think its this

    object oMyCorpse = CreateObject(OBJECT_TYPE_CREATURE, "sMyCorpse", GetLocation(OBJECT_SELF), FALSE);

    Should not have " " around sMyCorpse, as you are trying to use the contents of the variable, not spawn something with the resref sMyCorpse.



  • Doi, always something simple. I'll try that. This is what you get for writing things when you're sleepy.



  • yup easy mistake, made it about a bajillion times myself.


Log in to reply