Ambrosia Garden Archive
    • NPC control with variable coords


      <legalese>
      Warning! The following is a technical way to circumvent the impossibility of summoning NPC's on coordinates which are not hard-wired in an event, but may change depending on the values of some variables. Since it involves the use of hex editors and other hi-tech instruments, read on at your risk.
      </legalese>

      It looks like there is a way around the fact the "NPC control" event does not allow (as of now) global variables to be used. This may be problem because sometimes it would be nice to "summon" an NPC right in front of the player, independently on the position of the player on the map (in this way you may have an NPC which "follows" the player, for example).

      Examining the structure of the .cet file with a single "NPC control" action, it
      is possible to manually change the values of X and Y, substituting them with the names of the variables (for example, &&gb;_Player_X, &&gb;_Player_Y, which have values calculated basing on PlayerX and PlayerY). The only problem is that one needs an hex editor (I've used BBEditLite, which allows for Hex dumping), since the data are stored as follows

      two bytes containing the number of events (eg, in hex, 00 01)
      two bytes containing the number of linked events (00 00)
      a byte containing the length of the name of the event (0A)
      the name of the event: "Add an NPC" (you see, ten = 0A chars)
      a byte containing the length of the type of the event (0B)
      the type of the event: "NPC Control" (eleven = 0B chars)
      two bytes containing the length of the data to follow (00 2B = 43)
      the data: 0,Dark caster,&&gb;_Player_X,&&gb;_Player_Y,0
      where
      Dark caster is the name of the NPC (as defined by the user, i.e., me)
      0 means "Add"
      &&gb;_Player_X,&&gb;_Player_Y is the location
      0 means "Custom coordinates"

      As you can see, the data is 43 characters long (including the commas).

      Then 18 bytes set to 00 hex (purpose: unknown)
      End of event terminator: hex 00 01.

      Thus, one only has to change the data in the part with the location, count how many characters are in the data, and change accordingly the two bytes preceding the data.

      I've tested it, and it works. Of course, it cannot be edited inside Coldstone, but it displays correctly in the event when one opens it 🙂

      BTW I've also tried to change the name of the NPC to be summoned using a variable, but this method does not work, as it does not work with "Change map cell" :frown:

      On the other hand, the same trick works (more or less in the same way) for the "Stamp control" event (but I leave to you to discover how to do that).

      Hope this helps (and hope this does not reveal secrets not to be revelaed :)),

      Alois

      ------------------

    • Can i put that online in a faq?

      ------------------

    • Quote

      Originally posted by alois:
      **< legalese>

      **

      Very cool, thanks. This supports my hypothesis that the block on using &&Tag; values within the Coldstone editor itself was a simple programmer's flub; a "out of range" trap that is implemented too early. Which gives great hope it will be fixed in the first patch. 🙂

      ------------------
      everywhere else, it's --
      "Nomuse"

    • Quote

      Originally posted by -LethaLGraphiX-:
      **Can i put that online in a faq?
      **

      Yes, of course! Maybe it would be nice to write down a small program which does the trick (ie, takes in input the name of the NPC, and the name of the variables to be used for the position, and makes a correct .cet file). Maybe I'll write one 🙂

      Alois

      ------------------

    • (quote)Originally posted by alois:
      **< snip> Maybe it would be nice to write down a small program which does the trick (ie, takes in input the name of the NPC, and the name of the variables to be used for the position, and makes a correct .cet file). Maybe I'll write one 🙂

      ------------------
      CRH
      **

    • (quote)Originally posted by ChristopherH:
      **I vote yes, you should.:)

      I've written a small program in METAl (a freeware basic interpreter/compiler) which takes as input the name of the NPC to add, the names of two global variables (indicating the X and Y position where one wants to add the NPC), the name of the event (i.e., "Add Big monster"), and the name of the .cet file to be saved. Voila'!

      You can find it at (url="http://"http://homepage.mac.com/lorsina")http://homepage.mac.com/lorsina(/url) in the Coldstone folder.

      Hope it helps (the "Stamp control" program is well on the way :)),

      Alois

      P.S.: the Stamp control program is actually there 🙂
      ------------------

      (This message has been edited by alois (edited 02-07-2002).)
      **

    • With the speed you work I'm probably outdating the faq befor i put it online - but rest assured, i'ts going in anyway to satisf real buffs - rating its difficulty is going to be hell however, so i'm skipping the rating till i got the cgi working
      if anyone else wants to post something in the faq, just say os

      not that this stuff is frequently asked for.. 🙂

      if I top 100 tech answers i'll call it a bible..

      ------------------

    • (quote)Originally posted by alois:
      **Your wish has been granted:)

      I intend to keep my eye open for other topics started by you. Thanks again.

      ------------------
      CRH
      **

    • (quote)Originally posted by ChristopherH:
      **BTW, are you working on a game project of your own? Hopefully you aren't spending all of your time making things to solve problems for us newbie/non programers with visions of game making dancing in our heads.:) You know, trying to see whether you can make a "darkness spell" which blinds the player (yes), or a monster which dies and summons another monster (yes, and here's where I needed the NPC control at custom coordinates), or a "barrier" spell which blocks the NPC's from getting to you for a certain amount of time (no, unless you are in a precise place, because itis impossible to change access to a cell "depending" on where the player is).

      Sincerely,

      Alois

      ------------------
      **

    • Quote

      Originally posted by alois:
      Well, um, er... I'm not supposed to spend my time on making a game either. Let's say I'll spend my spare time for it.

      Heh. Actually, I had assumed that you were using 'spare time'; not time allocated to things that bring in money to live on, etc.

      Quote

      Originally posted by alois:
      or a "barrier" spell which blocks the NPC's from getting to you for a certain amount of time (no, unless you are in a precise place, because itis impossible to change access to a cell "depending" on where the player is).

      I suppose one might be able to make a spell to freeze hostile NPC's in place for a short period of time which might be an acceptable substitute for the barrier idea. (At least I think I remember reading someplace about being able to freeze characters.)

      As far as studying CS goes, yeah, I'm still at that point myself. I've only attempted so far to make a couple of fairly simple cheat plugs for PoG to practice things that can be done with CS. The nice thing is that both work exactly as I intended. 🙂

      Bye for now.

      ------------------
      CRH