Hi all,
Goal: I'm making a Tome tax system. Every few tomes the player purchases, the cost of that tome rises for that player only until a cap is reached (currently 5). I wanted to ditch having triggers do the gold requirement check and deduction after purchase and have the current price listed on the actual item tooltip.
Implementation: When a player clicks on the tome shop, their selection is changed to a dummy shop at the same location owned by the player (each player has 2 shops - one for each neutral shop on the map). Each dummy shop starts with "Tax 1" tomes (the default non taxed version I guess). When they buy 6 of a particular tome, it rises to Tax 2 and so on for each type of tome. When this happens, the tome, in only the triggering player's shop, is replaced with it's upper level.
The Problem: For some reason, some tomes go missing after certain tomes are leveled up to a certain point. Many of the first purchased seem to work flawlessly and at some point the tomes start vanishing after tome purchases.
Which tomes go missing depend on which tomes I purchase prior. I can't see a pattern to this.
Triggers
Can anyone identify where I've gone wrong?
Goal: I'm making a Tome tax system. Every few tomes the player purchases, the cost of that tome rises for that player only until a cap is reached (currently 5). I wanted to ditch having triggers do the gold requirement check and deduction after purchase and have the current price listed on the actual item tooltip.
Implementation: When a player clicks on the tome shop, their selection is changed to a dummy shop at the same location owned by the player (each player has 2 shops - one for each neutral shop on the map). Each dummy shop starts with "Tax 1" tomes (the default non taxed version I guess). When they buy 6 of a particular tome, it rises to Tax 2 and so on for each type of tome. When this happens, the tome, in only the triggering player's shop, is replaced with it's upper level.
The Problem: For some reason, some tomes go missing after certain tomes are leveled up to a certain point. Many of the first purchased seem to work flawlessly and at some point the tomes start vanishing after tome purchases.
Which tomes go missing depend on which tomes I purchase prior. I can't see a pattern to this.
Triggers
FYI - This is called by another trigger at Map Initialization.
-
Tome Tax Setup
-
Events
-
Conditions
-
Actions
-
-------- -------- --------
-
-------- Setup Tomes --------
-
-------- -------- --------
-
Set VariableSet TomeTax_Cap = 0
-
Set VariableSet TomeTax_ArtOfFighting_Item[TomeTax_Cap] = Art of Fighting
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_ArtOfFighting_Item[TomeTax_Cap] = Art of Fighting - Tax 2
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_ArtOfFighting_Item[TomeTax_Cap] = Art of Fighting - Tax 3
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_ArtOfFighting_Item[TomeTax_Cap] = Art of Fighting - Tax 4
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_ArtOfFighting_Item[TomeTax_Cap] = Art of Fighting - Tax 5
-
-------- ----------------------------------------------- --------
-
Set VariableSet TomeTax_Cap = 0
-
Set VariableSet TomeTax_Vitality_Item[TomeTax_Cap] = Manual of Vitality
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Vitality_Item[TomeTax_Cap] = Manual of Vitality - Tax 2
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Vitality_Item[TomeTax_Cap] = Manual of Vitality - Tax 3
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Vitality_Item[TomeTax_Cap] = Manual of Vitality - Tax 4
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Vitality_Item[TomeTax_Cap] = Manual of Vitality - Tax 5
-
-------- ----------------------------------------------- --------
-
Set VariableSet TomeTax_Cap = 0
-
Set VariableSet TomeTax_Agility_Item[TomeTax_Cap] = Tome of Agility
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Agility_Item[TomeTax_Cap] = Tome of Agility - Tax 2
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Agility_Item[TomeTax_Cap] = Tome of Agility - Tax 3
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Agility_Item[TomeTax_Cap] = Tome of Agility - Tax 4
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Agility_Item[TomeTax_Cap] = Tome of Agility - Tax 5
-
-------- ----------------------------------------------- --------
-
Set VariableSet TomeTax_Cap = 0
-
Set VariableSet TomeTax_Intelligence_Item[TomeTax_Cap] = Tome of Intelligence
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Intelligence_Item[TomeTax_Cap] = Tome of Intelligence - Tax 2
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Intelligence_Item[TomeTax_Cap] = Tome of Intelligence - Tax 3
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Intelligence_Item[TomeTax_Cap] = Tome of Intelligence - Tax 4
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Intelligence_Item[TomeTax_Cap] = Tome of Intelligence - Tax 5
-
-------- ----------------------------------------------- --------
-
Set VariableSet TomeTax_Cap = 0
-
Set VariableSet TomeTax_Strength_Item[TomeTax_Cap] = Tome of Strength
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Strength_Item[TomeTax_Cap] = Tome of Strength - Tax 2
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Strength_Item[TomeTax_Cap] = Tome of Strength - Tax 3
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Strength_Item[TomeTax_Cap] = Tome of Strength - Tax 4
-
Set VariableSet TomeTax_Cap = (TomeTax_Cap + 1)
-
Set VariableSet TomeTax_Strength_Item[TomeTax_Cap] = Tome of Strength - Tax 5
-
-------- -------- --------
-
-------- Setup Shops --------
-
-------- -------- --------
-
Set VariableSet TempPoint1 = (Position of Tent Of Training 2 0028 <gen>)
-
Set VariableSet TempPoint2 = (Position of Tent Of Training 2 0035 <gen>)
-
Player Group - Pick every player in PlayerGroupAllies and do (Actions)
-
Loop - Actions
-
Unit - Create 1 Tent Of Training (Players Hidden One) for (Picked player) at TempPoint1 facing Default building facing degrees
-
Set VariableSet TomeTax_Shop_Cliff[(Player number of (Picked player))] = (Last created unit)
-
Neutral Building - Add TomeTax_ArtOfFighting_Item[0] to TomeTax_Shop_Cliff[(Player number of (Picked player))] with 1 in stock and a max stock of 1
-
Neutral Building - Add TomeTax_Vitality_Item[0] to TomeTax_Shop_Cliff[(Player number of (Picked player))] with 1 in stock and a max stock of 1
-
Neutral Building - Add TomeTax_Agility_Item[0] to TomeTax_Shop_Cliff[(Player number of (Picked player))] with 1 in stock and a max stock of 1
-
Neutral Building - Add TomeTax_Intelligence_Item[0] to TomeTax_Shop_Cliff[(Player number of (Picked player))] with 1 in stock and a max stock of 1
-
Neutral Building - Add TomeTax_Strength_Item[0] to TomeTax_Shop_Cliff[(Player number of (Picked player))] with 1 in stock and a max stock of 1
-
Unit - Create 1 Tent Of Training (Players Hidden One) for (Picked player) at TempPoint2 facing Default building facing degrees
-
Set VariableSet TomeTax_Shop_NearWizard[(Player number of (Picked player))] = (Last created unit)
-
Neutral Building - Add TomeTax_ArtOfFighting_Item[0] to TomeTax_Shop_NearWizard[(Player number of (Picked player))] with 1 in stock and a max stock of 1
-
Neutral Building - Add TomeTax_Vitality_Item[0] to TomeTax_Shop_NearWizard[(Player number of (Picked player))] with 1 in stock and a max stock of 1
-
Neutral Building - Add TomeTax_Agility_Item[0] to TomeTax_Shop_NearWizard[(Player number of (Picked player))] with 1 in stock and a max stock of 1
-
Neutral Building - Add TomeTax_Intelligence_Item[0] to TomeTax_Shop_NearWizard[(Player number of (Picked player))] with 1 in stock and a max stock of 1
-
Neutral Building - Add TomeTax_Strength_Item[0] to TomeTax_Shop_NearWizard[(Player number of (Picked player))] with 1 in stock and a max stock of 1
-
-
-
Custom script: call RemoveLocation (udg_TempPoint1)
-
Custom script: call RemoveLocation (udg_TempPoint2)
-
-
-
Tome Tax Select Shop
-
Events
-
Player - Player 1 (Red) Selects a unit
-
-
Conditions
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Triggering unit) Equal to Tent Of Training 2 0028 <gen>
-
-
Then - Actions
-
-------- Training Hut on the Cliff --------
-
Selection - Select TomeTax_Shop_Cliff[(Player number of (Triggering player))] for (Triggering player)
-
-
Else - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Triggering unit) Equal to Tent Of Training 2 0035 <gen>
-
-
Then - Actions
-
-------- Training Hut near the Wizards hut --------
-
Selection - Select TomeTax_Shop_NearWizard[(Player number of (Triggering player))] for (Triggering player)
-
-
Else - Actions
-
-
-
-
-
-
Tome Tax Purchase
-
Events
-
Unit - A unit Sells an item (from shop)
-
-
Conditions
-
Actions
-
Set VariableSet TempInteger1 = (Player number of (Owner of (Buying unit)))
-
-------- The interval before a new price is required. --------
-
Set VariableSet TempInteger2 = 6
-
-------- ------------------ --------
-
-------- Art of Fighting --------
-
-------- ------------------ --------
-
For each (Integer A) from 0 to TomeTax_Cap, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Sold Item)) Equal to TomeTax_ArtOfFighting_Item[(Integer A)]
-
-
Then - Actions
-
Set VariableSet TomeTax_ArtOfFighting[TempInteger1] = (TomeTax_ArtOfFighting[TempInteger1] + 1)
-
-------- TempInteger3 should truncate the decimal of the result and give us the whole value we want. --------
-
Set VariableSet TempInteger3 = (TomeTax_ArtOfFighting[TempInteger1] / TempInteger2)
-
Game - Display to (All players) for 5.00 seconds the text: (Fighting Integer3: + (String(TempInteger3)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Sold Item)) Not equal to TomeTax_ArtOfFighting_Item[TempInteger3]
-
TempInteger3 Less than or equal to TomeTax_Cap
-
-
Then - Actions
-
Game - Display to (All players) for 5.00 seconds the text: (Replacing + (Name of (Sold Item)))
-
Neutral Building - Remove (Item-type of (Sold Item)) from TomeTax_Shop_Cliff[TempInteger1]
-
Neutral Building - Add TomeTax_ArtOfFighting_Item[TempInteger3] to TomeTax_Shop_Cliff[TempInteger1] with 1 in stock and a max stock of 1
-
Neutral Building - Remove (Item-type of (Sold Item)) from TomeTax_Shop_NearWizard[TempInteger1]
-
Neutral Building - Add TomeTax_ArtOfFighting_Item[TempInteger3] to TomeTax_Shop_NearWizard[TempInteger1] with 1 in stock and a max stock of 1
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
-------- ------------------ --------
-
-------- Vitality --------
-
-------- ------------------ --------
-
For each (Integer A) from 0 to TomeTax_Cap, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Sold Item)) Equal to TomeTax_Vitality_Item[(Integer A)]
-
-
Then - Actions
-
Set VariableSet TomeTax_Vitality[TempInteger1] = (TomeTax_Vitality[TempInteger1] + 1)
-
Set VariableSet TempInteger3 = (TomeTax_Vitality[TempInteger1] / TempInteger2)
-
Game - Display to (All players) for 5.00 seconds the text: (Vitality Integer3: + (String(TempInteger3)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Sold Item)) Not equal to TomeTax_Vitality_Item[TempInteger3]
-
TempInteger3 Less than or equal to TomeTax_Cap
-
-
Then - Actions
-
Game - Display to (All players) for 5.00 seconds the text: (Replacing + (Name of (Sold Item)))
-
Neutral Building - Remove (Item-type of (Sold Item)) from TomeTax_Shop_Cliff[TempInteger1]
-
Neutral Building - Add TomeTax_Vitality_Item[TempInteger3] to TomeTax_Shop_Cliff[TempInteger1] with 1 in stock and a max stock of 1
-
Neutral Building - Remove (Item-type of (Sold Item)) from TomeTax_Shop_NearWizard[TempInteger1]
-
Neutral Building - Add TomeTax_Vitality_Item[TempInteger3] to TomeTax_Shop_NearWizard[TempInteger1] with 1 in stock and a max stock of 1
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
-------- ------------------ --------
-
-------- Agility --------
-
-------- ------------------ --------
-
For each (Integer A) from 0 to TomeTax_Cap, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Sold Item)) Equal to TomeTax_Agility_Item[(Integer A)]
-
-
Then - Actions
-
Set VariableSet TomeTax_Agility[TempInteger1] = (TomeTax_Agility[TempInteger1] + 1)
-
Set VariableSet TempInteger3 = (TomeTax_Agility[TempInteger1] / TempInteger2)
-
Game - Display to (All players) for 5.00 seconds the text: (Agility Integer3: + (String(TempInteger3)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Sold Item)) Not equal to TomeTax_Agility_Item[TempInteger3]
-
TempInteger3 Less than or equal to TomeTax_Cap
-
-
Then - Actions
-
Game - Display to (All players) for 5.00 seconds the text: (Replacing + (Name of (Sold Item)))
-
Neutral Building - Remove (Item-type of (Sold Item)) from TomeTax_Shop_Cliff[TempInteger1]
-
Neutral Building - Add TomeTax_Agility_Item[TempInteger3] to TomeTax_Shop_Cliff[TempInteger1] with 1 in stock and a max stock of 1
-
Neutral Building - Remove (Item-type of (Sold Item)) from TomeTax_Shop_NearWizard[TempInteger1]
-
Neutral Building - Add TomeTax_Agility_Item[TempInteger3] to TomeTax_Shop_NearWizard[TempInteger1] with 1 in stock and a max stock of 1
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
-------- ------------------ --------
-
-------- Intelligence --------
-
-------- ------------------ --------
-
For each (Integer A) from 0 to TomeTax_Cap, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Sold Item)) Equal to TomeTax_Intelligence_Item[(Integer A)]
-
-
Then - Actions
-
Set VariableSet TomeTax_Intelligence[TempInteger1] = (TomeTax_Intelligence[TempInteger1] + 1)
-
Set VariableSet TempInteger3 = (TomeTax_Intelligence[TempInteger1] / TempInteger2)
-
Game - Display to (All players) for 5.00 seconds the text: (Intelligence Integer3: + (String(TempInteger3)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Sold Item)) Not equal to TomeTax_Intelligence_Item[TempInteger3]
-
TempInteger3 Less than or equal to TomeTax_Cap
-
-
Then - Actions
-
Game - Display to (All players) for 5.00 seconds the text: (Replacing + (Name of (Sold Item)))
-
Neutral Building - Remove (Item-type of (Sold Item)) from TomeTax_Shop_Cliff[TempInteger1]
-
Neutral Building - Add TomeTax_Intelligence_Item[TempInteger3] to TomeTax_Shop_Cliff[TempInteger1] with 1 in stock and a max stock of 1
-
Neutral Building - Remove (Item-type of (Sold Item)) from TomeTax_Shop_NearWizard[TempInteger1]
-
Neutral Building - Add TomeTax_Intelligence_Item[TempInteger3] to TomeTax_Shop_NearWizard[TempInteger1] with 1 in stock and a max stock of 1
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
-------- ------------------ --------
-
-------- Strength --------
-
-------- ------------------ --------
-
For each (Integer A) from 0 to TomeTax_Cap, do (Actions)
-
Loop - Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Sold Item)) Equal to TomeTax_Strength_Item[(Integer A)]
-
-
Then - Actions
-
Set VariableSet TomeTax_Strength[TempInteger1] = (TomeTax_Strength[TempInteger1] + 1)
-
Set VariableSet TempInteger3 = (TomeTax_Strength[TempInteger1] / TempInteger2)
-
Game - Display to (All players) for 5.00 seconds the text: (Strength Integer3: + (String(TempInteger3)))
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Item-type of (Sold Item)) Not equal to TomeTax_Strength_Item[TempInteger3]
-
TempInteger3 Less than or equal to TomeTax_Cap
-
-
Then - Actions
-
Game - Display to (All players) for 5.00 seconds the text: (Replacing + (Name of (Sold Item)))
-
Neutral Building - Remove (Item-type of (Sold Item)) from TomeTax_Shop_Cliff[TempInteger1]
-
Neutral Building - Add TomeTax_Strength_Item[TempInteger3] to TomeTax_Shop_Cliff[TempInteger1] with 1 in stock and a max stock of 1
-
Neutral Building - Remove (Item-type of (Sold Item)) from TomeTax_Shop_NearWizard[TempInteger1]
-
Neutral Building - Add TomeTax_Strength_Item[TempInteger3] to TomeTax_Shop_NearWizard[TempInteger1] with 1 in stock and a max stock of 1
-
-
Else - Actions
-
-
-
Else - Actions
-
-
-
-
Game - Display to (All players) for 5.00 seconds the text: Finished Trigger Ex...
-
-
Attachments
Last edited: