HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Detect var.

11-11-2004, 07:01 PM#1
oNdizZ
Now, first trigger, when i've detected the entering unit, i set it into a var. :

Set Shopping_Unit[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)

and then in another trigger, how shall i detect this?
im trying to make my dialog shopping for multiplayer, so ill need some array-vars. but i dont know how to detect them in the other triggers....
11-11-2004, 07:16 PM#2
Captain Griffen
First of all, you need to replace 'triggering unit' with 'event response - entering unit'.

Second of all, it is just '(INSTERT THING HERE) VARIABLE[#] (REST OF FUNCTION)'.

OR

If - (UNIT) is equal to (VARIABLE[#])
Then -
Else -
11-11-2004, 08:05 PM#3
oNdizZ
Its not entering couse i actually use, a unit comes within range of "a unit".

and, i cant detect the "triggering unit" in the other triggers couse there is no event in the other triggers, i use Trigger - Run bla bla bla checking conds.



:/


one way that i know work is to make 1 trigger for each player, but i'll prefer if you can help me to get it to 1 trigger... :D
11-11-2004, 09:16 PM#4
Oo.h3ih02.oO
You have to explain what you need a bit more, what are you using Shopping_unit[] for?
11-11-2004, 10:19 PM#5
Dalten
Quote:
Originally Posted by Oo.h3ih02.oO
You have to explain what you need a bit more, what are you using Shopping_unit[] for?

I'm not sure what you're asking either. You are setting up your Shopping variable fine as far as I can tell, so if you need to refer to the shopping unit with another trigger you would simply point to the Shopping variable. If this doesn't help, please explain what you're doing a little better.
11-11-2004, 10:32 PM#6
-={tWiStÄr}=-
it sounds like you would either have to set the owner of the unit to a variable or make a trigger for each player.
11-12-2004, 08:13 AM#7
oNdizZ
Trigger One:

go near to shop
Events
Unit - A unit comes within 200.00 of Greedy Shop Keeper 0000 <gen>
Conditions

Actions
Set Shopping_Unit[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
Wait 0.30 seconds
Dialog - Change the title of Shop_Dialog[(Player number of (Owner of (Triggering unit)))] to Select the thing yo...
-------- ---Wish to Buy button--- --------
Dialog - Create a dialog button for Shop_Dialog[(Player number of (Owner of (Triggering unit)))] labelled Do you wish to buy ...
If ((Triggering unit) Equal to Shopping_Unit[1]) then do (Set Shop_dialog_buttons[1] = (Last created dialog Button)) else do (Do nothing)
If ((Triggering unit) Equal to Shopping_Unit[2]) then do (Set Shop_dialog_buttons[4] = (Last created dialog Button)) else do (Do nothing)
If ((Triggering unit) Equal to Shopping_Unit[3]) then do (Set Shop_dialog_buttons[7] = (Last created dialog Button)) else do (Do nothing)...
bla bla bla, for each player

-------- ---Wish to Sell button--- --------
Dialog - Create a dialog button for Shop_Dialog[(Player number of (Owner of (Triggering unit)))] labelled Do you wish to sell...
If ((Triggering unit) Equal to Shopping_Unit[1]) then do (Set Shop_dialog_buttons[2] = (Last created dialog Button)) else do (Do nothing)
If ((Triggering unit) Equal to Shopping_Unit[2]) then do (Set Shop_dialog_buttons[5] = (Last created dialog Button)) else do (Do nothing)
If ((Triggering unit) Equal to Shopping_Unit[3]) then do (Set Shop_dialog_buttons[8] = (Last created dialog Button)) else do (Do nothing)...
bla bla bla, for each player

-------- Leave me alone button--- --------
Dialog - Create a dialog button for Shop_Dialog[(Player number of (Owner of (Triggering unit)))] labelled |cff9F9F00Leave me ...
If ((Triggering unit) Equal to Shopping_Unit[1]) then do (Set Shop_dialog_buttons[3] = (Last created dialog Button)) else do (Do nothing)
If ((Triggering unit) Equal to Shopping_Unit[2]) then do (Set Shop_dialog_buttons[6] = (Last created dialog Button)) else do (Do nothing)
If ((Triggering unit) Equal to Shopping_Unit[3]) then do (Set Shop_dialog_buttons[9] = (Last created dialog Button)) else do (Do nothing)...
bla bla bla, for each player
Dialog - Show Shop_Dialog[(Player number of (Owner of (Triggering unit)))] for (Owner of (Triggering unit))



and then :

click a button
Events
Dialog - A dialog button is clicked for Shop_Dialog[1]
Dialog - A dialog button is clicked for Shop_Dialog[2]
Dialog - A dialog button is clicked for Shop_Dialog[3]
Dialog - A dialog button is clicked for Shop_Dialog[4]
bla bla bla for each player.... (thats 1 to 4 :p)
Conditions
Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to Shop_dialog_buttons[1]
(Clicked dialog button) Equal to Shop_dialog_buttons[4]
(Clicked dialog button) Equal to Shop_dialog_buttons[7]
(Clicked dialog button) Equal to Shop_dialog_buttons[10]
Then - Actions
-------- YOUR ACTIONS HERE FOR "DO YOU WISH TO BUY" --------
Trigger - Run wish to buy <gen> (checking conditions)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to Shop_dialog_buttons[2]
(Clicked dialog button) Equal to Shop_dialog_buttons[5]
(Clicked dialog button) Equal to Shop_dialog_buttons[8]
(Clicked dialog button) Equal to Shop_dialog_buttons[11]
Then - Actions
-------- YOUR ACTIONS HERE FOR "DO YOU WISH TO SELL" --------
Trigger - Run Wish to sell <gen> (checking conditions)
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
(Clicked dialog button) Equal to Shop_dialog_buttons[3]
(Clicked dialog button) Equal to Shop_dialog_buttons[6]
(Clicked dialog button) Equal to Shop_dialog_buttons[9]
(Clicked dialog button) Equal to Shop_dialog_buttons[12]
Then - Actions
Dialog - Hide Dialog for Player 1 (Red)
Else - Actions
Wait 0.05 seconds
Dialog - Clear Dialog


and now that in red wont work couse i've not marked any Dialog. so now i need to know how i can detect which unit who is onwed by that player so i can do like this:
Dialog - Hide Shop_Dialog[(Player number of (Owner of (That unit who started the first trigger)))] for (Owner of (That unit who started the first trigger))



hope you understand alittle bit more now...
11-12-2004, 12:27 PM#8
a thing
I'm not sure if this will work but try using (Triggering player).
11-12-2004, 01:58 PM#9
Vexorian
First of all, Triggering Unit is better than specific event responses.

Second, Triggering Unit will work on triggers that were executed by a trigger that had an unit event
11-12-2004, 06:58 PM#10
oNdizZ
Thanks Lord Vexorian, you saved my day...


hmm, cant give you rep at the moment, need to speard them out alittle bit more :P
11-12-2004, 09:22 PM#11
Captain Griffen
"Wait 0.30 seconds
Dialog - Change the title of Shop_Dialog[(Player number of (Owner of (Triggering unit)))] to Select the thing"

I don't think using triggering unit after a wait works well...
11-12-2004, 11:38 PM#12
Dead-Inside
Becaaauuusse...?
11-13-2004, 12:15 AM#13
-={tWiStÄr}=-
because triggering unit is actually a blizzard made unit variable that is set to the unit that sets off a trigger. so if you have a wait another trigger may start and the variable may be set to a new unit meaning that the trigging unit's owner may be a totaly different player.. then this dialogue would just pop up on thier screen..
11-13-2004, 11:31 AM#14
Vexorian
Triggering Unit ALWAYS survives waits, the only Event responses that act somehow like variables are the ability event respenses
11-13-2004, 11:44 AM#15
Guest
I beleave that if you run another triggers from the main one it still retains all the info. Like in the second trigger you can use Event "Responce - Triggering unit" and it should still work. Hope this helps you. I didn't really read though all of this.