[Trigger] [Help!!!]Point Variable lost after 1 time use

Status
Not open for further replies.
Level 3
Joined
Sep 14, 2008
Messages
26
[Solved]Point Variable lost after 1 time use

Hello I wanna ask that is it the "set point variable value" will lost automatically when it been take to another "point variable"?

I wanna make a fixed permanent point.

Example: I set the location

  • Set PlayerFarmLoc[(Player number of (Owner of (Triggering unit)))] = (Center of Reds Farmland <gen>)
then

  • Set TempPoint3 = PlayerFarmLoc[(Player number of (Triggering player))]
  • Unit - Order (Last created unit) to Attack-Move To TempPoint3
is it after the trigger run 1 times it will delete the
  • PlayerFarmLoc[(Player number of (Owner of (Triggering unit)))]
because this trigger work 1 times after that the
  • PlayerFarmLoc[(Player number of (Owner of (Triggering unit)))]
become empty, so the last created unit cant attack-move to TempPoint3 anymore...

GOt any solution to this ?
 
Last edited:
Level 3
Joined
Sep 14, 2008
Messages
26
I can pretty sure I didnt remove the location because I just created the new variable and only using this variable now

but here's the whole 2 trigger
  • Red Key Pick
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to (==) |cffff0000Red Key|r
    • Actions
      • Player - Change color of (Owner of (Triggering unit)) to Red, Changing color of existing units
      • Trigger - Turn off (This trigger)
      • Neutral Building - Remove |cffff0000Red Key|r from all marketplaces
      • Unit - Move (Triggering unit) instantly to (Center of Reds House Exit <gen>), facing (Position of Circle of Power 0034 <gen>)
      • Set KeyPickChk[(Player number of (Owner of (Triggering unit)))] = True
      • Game - Display to AllPlayer the text: ((Name of (Owner of (Triggering unit))) + ( pick + ((Name of (Item being manipulated)) + ( and rent the + Red Farm !))))
      • Cinematic - Ping minimap for (Player group((Owner of (Triggering unit)))) at (Position of Circle of Power 0034 <gen>) for 10.00 seconds, using a Flashy ping of color (100.00%, 100.00%, 100.00%)
      • Unit - Change ownership of Blacksmith 0322 <gen> to (Owner of (Triggering unit)) and Retain color
      • Unit - Change ownership of Hatchery 0193 <gen> to (Owner of (Triggering unit)) and Retain color
      • Unit - Change ownership of Metal Storage Crate 0199 <gen> to (Owner of (Triggering unit)) and Retain color
      • Unit - Change ownership of Tool Box 0240 <gen> to (Owner of (Triggering unit)) and Retain color
      • Set PlayerFarmLoc[(Player number of (Owner of (Triggering unit)))] = (Center of Reds Farmland <gen>)
      • Set PlayerBarnLoc[(Player number of (Owner of (Triggering unit)))] = (Center of Player 1 Reds Coral <gen>)
      • Set PlayerRegion[(Player number of (Owner of (Triggering unit)))] = (Center of Reds Item Start <gen>)
      • Set GateKey[(Player number of (Owner of (Triggering unit)))] = (Item being manipulated)
      • Set BlackSmithUnit[(Player number of (Owner of (Triggering unit)))] = Blacksmith 0322 <gen>
      • Set WoodSawingUnit[(Player number of (Owner of (Triggering unit)))] = Wood Sawing Room 0293 <gen>
      • Set StoveUnit[(Player number of (Owner of (Triggering unit)))] = Stove 0220 <gen>
      • Set ToolBoxUnit[(Player number of (Owner of (Triggering unit)))] = Tool Box 0240 <gen>
  • Merc Buying
    • Events
      • Dialog - A dialog button is clicked for MercRecruit
    • Conditions
    • Actions
      • Set TempPoint = (Center of Tavern Merc Spawn <gen>)
      • Set TempPoint2 = (Center of Swordman Rescue Team Spawn <gen>)
      • Set TempPoint3 = PlayerFarmLoc[(Player number of (Triggering player))]
        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Clicked dialog button) Equal to (==) MercLight
            • ((Triggering player) Current gold) Greater than or equal to (>=) 750
            • MercHiredChk[(Player number of (Triggering player))] Equal to (==) 0
          • Then - Actions
            • Unit - Create 1 Mercenary (Bandit) for (Triggering player) at TempPoint facing 180.00 degrees
            • Set MercHiredChk[(Player number of (Triggering player))] = 1
            • Set MercHired[(Player number of (Triggering player))] = (Last created unit)
            • Unit - Add Call Mercenary to Farmer[(Player number of (Triggering player))]
            • Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - 750)
            • Floating Text - Create floating text that reads Thanks dude. Your l... above Merchent 0125 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
            • Floating Text - Change (Last created floating text): Disable permanence
            • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
            • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
          • Else - Actions
            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
              • If - Conditions
                • (Clicked dialog button) Equal to (==) MercMedium
                • ((Triggering player) Current gold) Greater than or equal to (>=) 2000
                • MercHiredChk[(Player number of (Triggering player))] Equal to (==) 0
              • Then - Actions
                • Unit - Create 1 Mercenary (Swordman) for (Triggering player) at TempPoint facing 180.00 degrees
                • Set MercHiredChk[(Player number of (Triggering player))] = 1
                • Set MercHired[(Player number of (Triggering player))] = (Last created unit)
                • Unit - Add Call Mercenary to Farmer[(Player number of (Triggering player))]
                • Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - 2000)
                • Floating Text - Create floating text that reads Thanks dude. Your m... above Merchent 0125 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                • Floating Text - Change (Last created floating text): Disable permanence
                • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
              • Else - Actions
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • (Clicked dialog button) Equal to (==) MercHeavy
                    • ((Triggering player) Current gold) Greater than or equal to (>=) 4000
                    • MercHiredChk[(Player number of (Triggering player))] Equal to (==) 0
                  • Then - Actions
                    • Unit - Create 1 Mercenary (Captain) for (Triggering player) at TempPoint facing 180.00 degrees
                    • Set MercHiredChk[(Player number of (Triggering player))] = 1
                    • Set MercHired[(Player number of (Triggering player))] = (Last created unit)
                    • Unit - Add Call Mercenary to Farmer[(Player number of (Triggering player))]
                    • Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - 4000)
                    • Floating Text - Create floating text that reads Thanks dude. Your h... above Merchent 0125 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                    • Floating Text - Change (Last created floating text): Disable permanence
                    • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                    • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                  • Else - Actions
                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                      • If - Conditions
                        • (Clicked dialog button) Equal to (==) MercLight_Range
                        • ((Triggering player) Current gold) Greater than or equal to (>=) 850
                        • MercHiredChk[(Player number of (Triggering player))] Equal to (==) 0
                      • Then - Actions
                        • Unit - Create 1 Mercenary (Archer) for (Triggering player) at TempPoint facing 180.00 degrees
                        • Set MercHiredChk[(Player number of (Triggering player))] = 1
                        • Set MercHired[(Player number of (Triggering player))] = (Last created unit)
                        • Unit - Add Call Mercenary to Farmer[(Player number of (Triggering player))]
                        • Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - 850)
                        • Floating Text - Create floating text that reads Thanks dude. Your l... above Merchent 0125 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                        • Floating Text - Change (Last created floating text): Disable permanence
                        • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                        • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                      • Else - Actions
                        • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                          • If - Conditions
                            • (Clicked dialog button) Equal to (==) MercMedium_Range
                            • ((Triggering player) Current gold) Greater than or equal to (>=) 2300
                            • MercHiredChk[(Player number of (Triggering player))] Equal to (==) 0
                          • Then - Actions
                            • Unit - Create 1 Mercenary (Elf Archer) for (Triggering player) at TempPoint facing 180.00 degrees
                            • Set MercHiredChk[(Player number of (Triggering player))] = 1
                            • Set MercHired[(Player number of (Triggering player))] = (Last created unit)
                            • Unit - Add Call Mercenary to Farmer[(Player number of (Triggering player))]
                            • Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - 2300)
                            • Floating Text - Create floating text that reads Thanks dude. Your m... above Merchent 0125 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                            • Floating Text - Change (Last created floating text): Disable permanence
                            • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                            • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                          • Else - Actions
                            • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                              • If - Conditions
                                • (Clicked dialog button) Equal to (==) MercHeavy_Range
                                • ((Triggering player) Current gold) Greater than or equal to (>=) 4500
                                • MercHiredChk[(Player number of (Triggering player))] Equal to (==) 0
                              • Then - Actions
                                • Unit - Create 1 Mercenary (Sniper) for (Triggering player) at TempPoint facing 180.00 degrees
                                • Set MercHiredChk[(Player number of (Triggering player))] = 1
                                • Set MercHired[(Player number of (Triggering player))] = (Last created unit)
                                • Unit - Add Call Mercenary to Farmer[(Player number of (Triggering player))]
                                • Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - 4500)
                                • Floating Text - Create floating text that reads Why be so serious? ... above Merchent 0125 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                                • Floating Text - Change (Last created floating text): Disable permanence
                                • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                                • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                              • Else - Actions
                                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                  • If - Conditions
                                    • (Clicked dialog button) Equal to (==) MercWeedCleaner
                                    • ((Triggering player) Current gold) Greater than or equal to (>=) 500
                                  • Then - Actions
                                    • Unit - Create 1 Mercenary (Weed Cleaner) for Player 9 (Gray) at TempPoint2 facing Default building facing (270.0) degrees
                                    • Unit - Order (Last created unit) to Attack-Move To TempPoint3
                                    • Player - Set (Triggering player) Current gold to (((Triggering player) Current gold) - 500)
                                    • Floating Text - Create floating text that reads Need a Weed Cleaner... at (Position of Merchent 0125 <gen>) with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                                    • Floating Text - Change (Last created floating text): Disable permanence
                                    • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                                    • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                                  • Else - Actions
                                    • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                                      • If - Conditions
                                        • Multiple ConditionsAnd - All (Conditions) are true
                                          • Conditions
                                            • MercHiredChk[(Player number of (Triggering player))] Equal to (==) 1
                                              • Multiple ConditionsOr - Any (Conditions) are true
                                                • Conditions
                                                  • (Clicked dialog button) Equal to (==) MercLight
                                                  • (Clicked dialog button) Equal to (==) MercMedium
                                                  • (Clicked dialog button) Equal to (==) MercHeavy
                                                  • (Clicked dialog button) Equal to (==) MercLight_Range
                                                  • (Clicked dialog button) Equal to (==) MercMedium_Range
                                                  • (Clicked dialog button) Equal to (==) MercHeavy_Range
                                      • Then - Actions
                                        • Floating Text - Create floating text that reads You cant hire more ... above Merchent 0125 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                                        • Floating Text - Change (Last created floating text): Disable permanence
                                        • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                                        • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
                                      • Else - Actions
                                        • Floating Text - Create floating text that reads Go away if nothing ... above Merchent 0125 <gen> with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                                        • Floating Text - Change (Last created floating text): Disable permanence
                                        • Floating Text - Change the lifespan of (Last created floating text) to 2.00 seconds
                                        • Floating Text - Change the fading age of (Last created floating text) to 1.00 seconds
      • Custom script: call RemoveLocation(udg_TempPoint)
      • Custom script: call RemoveLocation(udg_TempPoint2)
      • Custom script: call RemoveLocation(udg_TempPoint3)
 
Level 3
Joined
Sep 14, 2008
Messages
26
wow~ thats work ! really thanks for help Maker !:thumbs_up:
now I finally understand more of the function ! ^^

Oh ya~ about the size of variable, if i set the variable size to 1, how large the number array can I actually use? I mean variablename[num limit]
 
Level 14
Joined
Aug 30, 2004
Messages
909
I've had this exact problem many times. I was making a custom AI system where units would store their default move point (i.e. where they go if they aren't in combat) to the center of a region. After a while that point would get erased somehow but I never found out exactly how.

I recommend just using 2 real variables, one X and one Y which store the x and y coordinates of the point you want (the center of that region). Real variables don't leak, and they never get erased.
 
Status
Not open for further replies.
Top