• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Trigger] Question about Variables & Arrays

Status
Not open for further replies.
Level 11
Joined
Aug 11, 2009
Messages
605
If I in a function for example do this (Triggerin Player in this example is Player 1):

Set PlayerNumber = (Number of Triggering Player)
Create Quest
Set Last Created Quest = Quest001[PlayerNumber]

If I call the variable in the future will it be known as "Quest001[PlayerNumber]" or "Quest001[1]"?

So that I can use the PlayerNumber variable to store several Player numbers and save seperate quests for seperate players and be able to call them again when needed. Ofcourse by setting the PlayerNumber variable to the right player before calling the Quest variable again.

Thanks for any help on this, might be bad explaining, just say if that is the case :)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
why u must know the index?

when u need it just
Set PlayerNumber = (Number of Triggering Player)

if Quest001[PlayerNumber] is x/y then do something

or

if Quest001[PlayerNumber] is x/y and Quest001_Progress[PlayerNumber] == 1 then do something

if u want u can check if PlayerNumber is =1 or 2 but i think useless if every player able take any quest (ofc u can check the requiment for quest, like Quest001_Progress[PlayerNumber]=1,2 etc example when u start quest u set =1, then u finish then set 2, when u done and got the reward sey 0 and u able to pick the quest if this variable is 0) :p
 
Level 11
Joined
Aug 11, 2009
Messages
605
I want to know if I can use the PlayerNumber variable to seperate different quests between players.

So Quest001 can be both for Player 1/2/3/4/5/6/7/8 with one variable which checks the players number :)
 
Level 17
Joined
Nov 13, 2006
Messages
1,814
I want to know if I can use the PlayerNumber variable to seperate different quests between players.

So Quest001 can be both for Player 1/2/3/4/5/6/7/8 with one variable which checks the players number :)

ofc u can, many people do that, also most of non hashtable spell use array for seperate the caster (there the index is the unit custom value, but exactly they use that same way than u the playernumber)
 
Status
Not open for further replies.
Top