In my map it's possible to ally a player and also to give gold to him via a custom command. But i want to make a limitation, if a player recieves more than 150 gold from his ally, he can't make another ally afterwards (after his original ally died, left or he wared him). I've tried to make a variable that tracks the gold recieved and then put it's value limit into the allying trigger, but it doesnn't work for some reason. Could anyone tell me what's wrong, or how can i do such a limitation? I'm also not too good with trigger, so might not understand something. My triggers:
Ally trigger:
Ally trigger:
-
Actual Trigger
- Events
-
Conditions
- hasGiveBase[(Player number of (Triggering player))] Equal to False
- GoldRecieved Less than 150
-
Actions
- Set playergroups[0] = (All players matching (((Matching player) slot status) Equal to Is playing))
- Set playergroups[1] = (All players matching (((Triggering player) is an ally of (Matching player)) Equal to True))
- Set playergroups[2] = (All players matching ((((Matching player) is in playergroups[0]) Equal to True) and (((Matching player) is in playergroups[1]) Equal to True)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Number of players in playergroups[2]) Less than alliancesize
-
Then - Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Loop - Actions
- Set playergroups[1] = (All allies of (Player((Integer A))))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Substring((Entered chat string), 7, (Length of (Entered chat string)))) Equal to AllyStringColor[(Integer A)]
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
- Player - Make (Triggering player) treat (Player((Integer A))) as an Ally with shared vision
- Custom script: call MMD_UpdateValueInt("ally", ConvertedPlayer(GetForLoopIndexA()), MMD_OP_SET, 1)
- Else - Actions
-
If - Conditions
- Custom script: call DestroyForce( udg_playergroups[1] )
-
Loop - Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Else - Actions
- Set playergroups[3] = (Player group((Triggering player)))
- Game - Display to playergroups[3] the text: You already have al...
- Custom script: call DestroyForce( udg_playergroups[3] )
-
If - Conditions
- Custom script: call DestroyForce( udg_playergroups[0] )
- Custom script: call DestroyForce( udg_playergroups[1] )
- Custom script: call DestroyForce( udg_playergroups[2] )
-
give gold
- Events
- Conditions
-
Actions
-
For each (Integer A) from 1 to 12, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
Or - Any (Conditions) are true
-
Conditions
- (Substring((Entered chat string), 2, ((Length of AllyStringColor[(Integer A)]) + 1))) Equal to AllyStringColor[(Integer A)]
-
Conditions
-
Or - Any (Conditions) are true
-
Then - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
- (Integer((Substring((Entered chat string), ((Length of AllyStringColor[(Integer A)]) + 2), (Length of (Entered chat string)))))) Less than or equal to ((Triggering player) Current gold)
- (Integer((Substring((Entered chat string), ((Length of AllyStringColor[(Integer A)]) + 2), (Length of (Entered chat string)))))) Greater than 0
- alliancesize Not equal to 0
- ((Player((Integer A))) is an ally of (Triggering player)) Equal to True
- ((Triggering player) is an ally of (Player((Integer A)))) Equal to True
-
Then - Actions
- Player - Add (Integer((Substring((Entered chat string), (2 + (Length of AllyStringColor[(Integer A)])), (Length of (Entered chat string)))))) to (Player((Integer A))) Current gold
- Player - Add ((Integer((Substring((Entered chat string), ((Length of AllyStringColor[(Integer A)]) + 2), (Length of (Entered chat string)))))) x -1) to (Triggering player) Current gold
-
Player Group - Pick every player in (All allies of (Triggering player)) and do (Actions)
-
Loop - Actions
- Set GoldRecieved = (GoldRecieved + ((Integer((Substring((Entered chat string), ((Length of AllyStringColor[(Integer A)]) + 2), (Length of (Entered chat string)))))) x -1))
-
Loop - Actions
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
- Else - Actions
-
If - Conditions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
Loop - Actions
-
For each (Integer A) from 1 to 12, do (Actions)
Last edited by a moderator: