- Joined
- Nov 26, 2021
- Messages
- 25
Is there a way in Jass or GUI to make a trigger that only triggers once on start of the map, that checks every item and location on the map, allowing each play to loot each item once only?
Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
What do you mean by "checks every location"? As I understand you want it so that if 3 Crown of Kings are present on the map, Player 1 can only pick up one of those at a time even when using different units. If the Player 1 unit that is holding the CoK drops it then any of Player 1's units could pick up any of the 3 Crowns?that checks every item and location on the map
-------- in an init trigger --------
Set RewardCount = 0
Set RewardCount = (RewardCount + 1)
Set RewardPlayers[RewardCount] = Player 2 (Blue)
Set RewardCount = (RewardCount + 1)
Set RewardPlayers[RewardCount] = Player 5 (Yellow)
Set RewardCount = (RewardCount + 1)
Set RewardPlayers[RewardCount] = Player 1 (Red)
-------- to spawn items --------
For each (Integer A) from 1 to RewardCount do (Actions)

Loop - Actions


Item - Remove Rewards[(Integer A)]


Item - Create a ... at ...


Set Rewards[(Integer A)] = (Last created item)
Events

Unit - A unit is issued an order targeting an item
Conditions
Actions

Set U = (Triggering Unit)

Set P = (Triggering Player)

Set Itm = (Target item of issued order) //I think there's a response something like this

For each (Integer A) from 1 to RewardCount do (Actions)


Loop - Actions



If (All conditions are true) then do (Then actions) else do (Else actions)




If - Conditions





Itm equal to Rewards[(Integer A)]





P equal to RewardPlayers[(Integer A)]




Then - Actions





Trigger - Skip remaining actions




Else - Actions

Unit - Pause U //I think you still have to do this to countermand an order properly

Unit - Order U to stop

Unit - Unpause U
Events

Time - Elapsed game time is 0.01 seconds
Conditions
Actions

Set Variable Player_Count = (Number of players in Users_Playing)

Item - Pick every item in (Playable map area) and do (Actions)


Loop - Actions



Set Variable Item_CV = (Custom value of (Picked item))



Set Variable Item_Stacks[Item_CV] = Player_Count



Set Variable Item_Owner[Item_CV] = 0



Set Variable Item_Point[Item_CV] = (Position of (Picked item))
Events

Unit - A unit Acquires an Item
Conditions

Item_Stacks(Custom value of (Item being manipulated)) Greater than 0

Item_Owner(Custom value of (Item being manipulated)) Equal to 0
Actions

Set Variable Item_CV = (Custom value of (Item being manipulated))

Set Variable Item_Owner[Item_CV] = (Player number of (Owner of (Triggering unit)))

Set Variable Item_Stacks[Item_CV] = (Item_Stacks[Item_CV] - 1)

If all conditions are true then do (Actions)


If - Conditions



Item_Stacks[Item_CV] Greater than 0


Then - Actions



Item - Create 1 (Item-type of (Item being manipulated)) at Item_Point[Item_CV]



Custom script: call IndexItem( GetLastCreatedItem() )



Set Variable Item_CV_2 = (Custom value of (Last created item))



Set Variable Item_Owner[Item_CV_2] = 0



Set Variable Item_Stacks[Item_CV_2] = Item_Stacks[Item_CV]



Set Variable Item_Point[Item_CV_2] = Item_Point[Item_CV]


Else - Actions



Custom script: call RemoveLocation( udg_Item_Point[Item_CV] )
Events

Unit - A unit Acquires an Item
Conditions

Item_Owner(Custom value of (Item being manipulated)) Not Equal to 0

Item_Owner(Custom value of (Item being manipulated)) Not Equal to (Player number of (Owner of (Triggering unit)))
Actions

Item - Drop (Item being manipulated) from (Triggering unit)
PLSetUp

Events


Map initialization

Conditions

Actions


-------- Set Items --------


Set VariableSet PLSet[1] = Item <gen>


Set VariableSet PLSet[2] = Item <gen>


Set VariableSet PLSet[3] = Item <gen>


Set VariableSet PLSet[4] = Item <gen>


Set VariableSet PLSet[5] = Item <gen>


Set VariableSet PLSet[6] = Item <gen>


Set VariableSet PLSet[7] = Item <gen>


Set VariableSet PLSet[8] = Item <gen>


Set VariableSet PLSet[9] = Item <gen>


Set VariableSet PLSet[10] = Item <gen>


Set VariableSet PLSet[11] = Item <gen>


Set VariableSet PLSet[12] = Item <gen>


Set VariableSet PLSet[13] = Item <gen>


Set VariableSet PLSet[14] = Item <gen>


Set VariableSet PLSet[15] = Item <gen>


Set VariableSet PLSet[16] = Item <gen>


Set VariableSet PLSet[17] = Item <gen>


Set VariableSet PLSet[18] = Item <gen>


Set VariableSet PLSet[19] = Item <gen>


Set VariableSet PLSet[20] = Item <gen>


Set VariableSet PLSet[21] = Item <gen>


Set VariableSet PLSet[22] = Item <gen>


Set VariableSet PLSet[23] = Item <gen>


Set VariableSet PLSet[24] = Item <gen>


Set VariableSet PLSet[25] = Item <gen>


Set VariableSet PLSet[26] = Item <gen>


Set VariableSet PLSet[27] = Item <gen>


Set VariableSet PLSet[28] = Item <gen>


Set VariableSet PLSet[29] = Item <gen>


Set VariableSet PLSet[30] = Item <gen>


Set VariableSet PLSet[31] = Item <gen>


Set VariableSet PLSet[32] = Item <gen>


Set VariableSet PLSet[33] = Item <gen>


Set VariableSet PLSet[34] = Item <gen>


Set VariableSet PLSet[35] = Item <gen>


Set VariableSet PLSet[36] = Item <gen>


Set VariableSet PLSet[37] = Item <gen>


Set VariableSet PLSet[38] = Item <gen>


Set VariableSet PLSet[39] = Item <gen>


Set VariableSet PLSet[40] = Item <gen>


Set VariableSet PLSet[41] = Item <gen>


Set VariableSet PLSet[42] = Item <gen>


Set VariableSet PLSet[43] = Item <gen>


Set VariableSet PLSet[44] = Item <gen>


Set VariableSet PLSet[45] = Item <gen>


Set VariableSet PLSet[46] = Item <gen>


Set VariableSet PLSet[47] = Item <gen>


Set VariableSet PLSet[48] = Item <gen>


Set VariableSet PLSet[49] = Item <gen>


Set VariableSet PLSet[50] = Item <gen>


Set VariableSet PLSet[51] = Item <gen>


Set VariableSet PLSet[52] = Item <gen>


Set VariableSet PLSet[53] = Item <gen>


Set VariableSet PLSet[54] = Item <gen>


Set VariableSet PLSet[55] = Item <gen>


-------- Set Item Type/Location --------


For each (Integer A) from 1 to 55, do (Actions)



Loop - Actions




Set VariableSet PLType[(Integer A)] = (Item-type of PLSet[(Integer A)])




Set VariableSet PLX[(Integer A)] = (X of (Position of PLSet[(Integer A)]))




Set VariableSet PLY[(Integer A)] = (Y of (Position of PLSet[(Integer A)]))
LootCheck

Events


Unit - A unit Is issued an order targeting an object

Conditions

Actions


-------- Player 1 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 1 (Red)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Target item of issued order) Equal to PLSet[(Integer A)]







Then - Actions








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










LootP1[(Integer A)] Equal to 1









Then - Actions










Unit - Pause (Triggering unit)










Unit - Order (Triggering unit) to Stop.










Unit - Unpause (Triggering unit)










Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: [|cffff0000U|rD|cff...










Skip remaining actions









Else - Actions







Else - Actions



Else - Actions


-------- Player 2 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 2 (Blue)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Target item of issued order) Equal to PLSet[(Integer A)]







Then - Actions








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










LootP2[(Integer A)] Equal to 1









Then - Actions










Unit - Pause (Triggering unit)










Unit - Order (Triggering unit) to Stop.










Unit - Unpause (Triggering unit)










Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: [|cffff0000U|rD|cff...










Skip remaining actions









Else - Actions







Else - Actions



Else - Actions


-------- Player 3 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 3 (Teal)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Target item of issued order) Equal to PLSet[(Integer A)]







Then - Actions








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










LootP3[(Integer A)] Equal to 1









Then - Actions










Unit - Pause (Triggering unit)










Unit - Order (Triggering unit) to Stop.










Unit - Unpause (Triggering unit)










Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: [|cffff0000U|rD|cff...










Skip remaining actions









Else - Actions







Else - Actions



Else - Actions


-------- Player 4 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 4 (Purple)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Target item of issued order) Equal to PLSet[(Integer A)]







Then - Actions








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










LootP4[(Integer A)] Equal to 1









Then - Actions










Unit - Pause (Triggering unit)










Unit - Order (Triggering unit) to Stop.










Unit - Unpause (Triggering unit)










Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: [|cffff0000U|rD|cff...










Skip remaining actions









Else - Actions







Else - Actions



Else - Actions


-------- Player 5 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 5 (Yellow)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Target item of issued order) Equal to PLSet[(Integer A)]







Then - Actions








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










LootP5[(Integer A)] Equal to 1









Then - Actions










Unit - Pause (Triggering unit)










Unit - Order (Triggering unit) to Stop.










Unit - Unpause (Triggering unit)










Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: [|cffff0000U|rD|cff...










Skip remaining actions









Else - Actions







Else - Actions



Else - Actions


-------- Player 6 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 6 (Orange)



Then - Actions




For each (Integer A) from 1 to 43, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Target item of issued order) Equal to PLSet[(Integer A)]







Then - Actions








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










LootP6[(Integer A)] Equal to 1









Then - Actions










Unit - Pause (Triggering unit)










Unit - Order (Triggering unit) to Stop.










Unit - Unpause (Triggering unit)










Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: [|cffff0000U|rD|cff...










Skip remaining actions









Else - Actions







Else - Actions



Else - Actions


-------- Player 7 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 7 (Green)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Target item of issued order) Equal to PLSet[(Integer A)]







Then - Actions








If (All Conditions are True) then do (Then Actions) else do (Else Actions)









If - Conditions










LootP7[(Integer A)] Equal to 1









Then - Actions










Unit - Pause (Triggering unit)










Unit - Order (Triggering unit) to Stop.










Unit - Unpause (Triggering unit)










Game - Display to (Player group((Owner of (Triggering unit)))) for 2.00 seconds the text: [|cffff0000U|rD|cff...










Skip remaining actions









Else - Actions







Else - Actions



Else - Actions
LootAquire

Events


Unit - A unit Acquires an item

Conditions

Actions


-------- Player 1 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 1 (Red)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Item being manipulated) Equal to PLSet[(Integer A)]







Then - Actions








Set VariableSet LootP1[(Integer A)] = 1








Item - Create PLType[(Integer A)] at (Point(PLX[(Integer A)], PLY[(Integer A)]))








Set VariableSet PLSet[(Integer A)] = (Last created item)








Skip remaining actions







Else - Actions



Else - Actions


-------- Player 2 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 2 (Blue)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Item being manipulated) Equal to PLSet[(Integer A)]







Then - Actions








Set VariableSet LootP2[(Integer A)] = 1








Item - Create PLType[(Integer A)] at (Point(PLX[(Integer A)], PLY[(Integer A)]))








Set VariableSet PLSet[(Integer A)] = (Last created item)








Skip remaining actions







Else - Actions



Else - Actions


-------- Player 3 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 3 (Teal)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Item being manipulated) Equal to PLSet[(Integer A)]







Then - Actions








Set VariableSet LootP3[(Integer A)] = 1








Item - Create PLType[(Integer A)] at (Point(PLX[(Integer A)], PLY[(Integer A)]))








Set VariableSet PLSet[(Integer A)] = (Last created item)








Skip remaining actions







Else - Actions



Else - Actions


-------- Player 4 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 4 (Purple)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Item being manipulated) Equal to PLSet[(Integer A)]







Then - Actions








Set VariableSet LootP4[(Integer A)] = 1








Item - Create PLType[(Integer A)] at (Point(PLX[(Integer A)], PLY[(Integer A)]))








Set VariableSet PLSet[(Integer A)] = (Last created item)








Skip remaining actions







Else - Actions



Else - Actions


-------- Player 5 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 5 (Yellow)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Item being manipulated) Equal to PLSet[(Integer A)]







Then - Actions








Set VariableSet LootP5[(Integer A)] = 1








Item - Create PLType[(Integer A)] at (Point(PLX[(Integer A)], PLY[(Integer A)]))








Set VariableSet PLSet[(Integer A)] = (Last created item)








Skip remaining actions







Else - Actions



Else - Actions


-------- Player 6 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 6 (Orange)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Item being manipulated) Equal to PLSet[(Integer A)]







Then - Actions








Set VariableSet LootP6[(Integer A)] = 1








Item - Create PLType[(Integer A)] at (Point(PLX[(Integer A)], PLY[(Integer A)]))








Set VariableSet PLSet[(Integer A)] = (Last created item)








Skip remaining actions







Else - Actions



Else - Actions


-------- Player 7 --------


If (All Conditions are True) then do (Then Actions) else do (Else Actions)



If - Conditions




(Owner of (Triggering unit)) Equal to Player 7 (Green)



Then - Actions




For each (Integer A) from 1 to 55, do (Actions)





Loop - Actions






If (All Conditions are True) then do (Then Actions) else do (Else Actions)







If - Conditions








(Item being manipulated) Equal to PLSet[(Integer A)]







Then - Actions








Set VariableSet LootP7[(Integer A)] = 1








Item - Create PLType[(Integer A)] at (Point(PLX[(Integer A)], PLY[(Integer A)]))








Set VariableSet PLSet[(Integer A)] = (Last created item)








Skip remaining actions







Else - Actions



Else - Actions
Set LOC_NUM = 55
Set WhichPlayer = Player Number of (Player 3 (Teal))
Set Where = 24
TheValueToInteractWith = LootArray[((LOC_NUM) x (WhichPlayer - 1)) + Where]
ItemArray[(Integer A)] = (The item)
LocationArray[(Integer A)] = (Position of the item above)
PlayerGroupArray[(Intger A)] = (All players that have already interacted with this item) //this array will need to have the proper 'size' such that all the relevant indices are initialized to an empty unit group (adding players to a null group doesn't do anything)
