Author Topic: help with onmodual load style spawn  (Read 823 times)

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
help with onmodual load style spawn
« Reply #15 on: October 21, 2010, 01:35:29 am »


               

Ne0nx3r0 wrote...
Is there some trick to posting code and keeping the formatting here?


I just use the standard form to reply rather than the quick one and just copy/paste. Works fine for me so far. I am using firefox. Not sure if that makes a difference.
               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
help with onmodual load style spawn
« Reply #16 on: October 21, 2010, 02:01:34 am »


               i do have a question. where you have string sPrefix = "~Respawn";//can be whatever.... not familiar with this type of thing, so would that go something like

TAG of NPC = greg

sPrefix = dude

all together = gregdude or dudegreg

or am i missing something?



thanks
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
help with onmodual load style spawn
« Reply #17 on: October 21, 2010, 03:02:01 am »


               As far as spawning the creature at a random location when the module loads...why not just place the monster in the toolset(it's going to be there on load anyway) maybe in an inaccessible part of your mod, and then when it (the monster) loads/spawns you just jump him to one of your locations. You would give the monster an OnSpawn script with something like so:

//OnSpawn
void main()
{
int iInt = Random(7) + 1;
object oWP = GetWaypointByTag("wp_boss" + IntToString(iInt);
ActionJumpToObject(oWP);
}

This assumes that your waypoints are numbered 1to 7 (no 0) and no space between "boss" and the number.

And then when you create/spawn him from the delay in the death script, you don't need to jump him to a location, as it will do it again with it's OnSpawn script.

Good luck.

P.S. Could use something like so for the OnDeath:

//OnDeath
void RespawnMe(string sResRef, location lLocation, string sNewTag)
{
    CreateObject(OBJECT_TYPE_CREATURE, sResRef, lLocation, FALSE, sNewTag);
}
void main()
{
    float fSeconds = 10.0;//Set respawn time in seconds
    string sMyResRef = GetResRef(OBJECT_SELF);
    location lMyLocation = GetLocation(OBJECT_SELF);
    string sMyTag = GetTag(OBJECT_SELF);
    AssignCommand(GetArea(OBJECT_SELF), DelayCommand(fSeconds , RespawnMe(sMyResRef, lMyLocation, sMyTag)));
}
               
               

               


                     Modifié par GhostOfGod, 21 octobre 2010 - 04:42 .
                     
                  


            

Legacy_Ne0nx3r0

  • Newbie
  • *
  • Posts: 46
  • Karma: +0/-0
help with onmodual load style spawn
« Reply #18 on: October 21, 2010, 03:11:19 am »


               Should be prefix, then the tag - this is mainly because it uses GetStringLeft to identify which monsters are a respawn.
               
               

               
            

Legacy_zero-feeling

  • Sr. Member
  • ****
  • Posts: 287
  • Karma: +0/-0
help with onmodual load style spawn
« Reply #19 on: October 22, 2010, 06:07:53 am »


               sorry for the late reply, first i'd like to tell GoG that i tried his method works just fine, but since i don't want all of Ne0nx3r0's efforts to be for naught, i will use his scipt for this "need", and use yours for another "need" i have.



thanks to you all for your help.