Author Topic: Help with calling the right variable  (Read 311 times)

Legacy_Dennislp3

  • Newbie
  • *
  • Posts: 2
  • Karma: +0/-0
Help with calling the right variable
« on: May 24, 2013, 04:51:19 am »


               Ok so I am working on a messenger system for a PW...great and dandy...

My major issue though seems to be how to generate a unique name and then call the proper one later.

The best I can describe it is here with pseudo code since it spans multiple scripts

Script 1
On Activate Messenger Whistle
Generate Messenger ID+1 (number is a simple database value that goes up +1 each time its called)
Set Messenger Entrance (location of nearest map entrance...set as a local value)
Spawn Messenger
Set Messenger ID
Initiate Conversation at PC location (run to from spawn location)

Script 2a, 2b, 2c (give items, leave happy, leave upset)

2a: OnOpen
Put items in bag (3 or less and less than 15 pounds)

2a: OnClose
Tell Messenger to grab bag contents (ExecuteScript(....))

2b: Leave happy (end all scripts)
Get Messenger spawn location from script 1 (run to)
Destroy after 10 seconds

2c:
Get Messenger Spawn location from script 1 (walk to)
Destroy after 10 seconds

Script 3
Store Messenger and inventory in case of crash

Script 4
Call messenger at delivery target PCs location and give them package



now the issue is that every time a PC calls a messenger the messenger ID goes up by one...how in the world do I allow for multiple NPCs to be spawned and refer back to their proper ID without getting mixed up with other messengers that get spawned after them and change the database variables?

Any help would be appreciated!
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Help with calling the right variable
« Reply #1 on: May 24, 2013, 08:06:28 pm »


               You could set the name of the PC that called the messenger on that messenger as a variable.  In this way each messenger would be unique to the particular PC that they were intended for.  I am for Kirk...I am for Spock...etc...