Aller au contenu

Photo

Modifying a Spawning Script


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
MokahTGS

MokahTGS
  • Members
  • 946 messages
 I currently have Jabberwocky working with Gizmo's spawning script which is simple and works well with very little overhead, which is what is needed to work in concert with the OM.  It works, and that is what matters.  I would like to modify the script however in the following way:

The script works with an iPoint object and the spawn script attached to its HB event.  The script functions with lots of variables attacked to the object.  One of the varibles allows the spawn system to spawn objects and creatures facing any of the 4 directions (North, South, East, West) or a Random direction.  This is fine, but I was wondering if the script could be altered to just get the facing direction of the spawning iPoint object as a choice as well.  This would help for spawning placeables in specific locations.

Here is the script: 
http://pastebin.myrror.net/3097 

At lines 226 or so I see refer to the spawned objects direction.  How would I go about adding a new varible to declare in the varibles section that gets the facing direction of the iPoint object?

Please help and use very small words, as I script about as well as a wet towel.

#2
Kaldor Silverwand

Kaldor Silverwand
  • Members
  • 1 598 messages
Mokah,

Modify the ReturnFacing function so that when the Direction variable is set to "i" the spawned object will be facing the same direction as the spawning iPoint by adding after line 110:

else if (facing == "i")
{
return GetFacingFromLocation(GetLocation(OBJECT_SELF));
}

That should do it. Alternatively you could change the default for that function to be this behavior rather than the default being east by just changing line 113 to:

return GetFacingFromLocation(GetLocation(OBJECT_SELF));

Don't forget to recompile your script.

Regards

#3
MokahTGS

MokahTGS
  • Members
  • 946 messages
 Thanks!  Works great!