• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • 💡 We're thrilled to announce that our upcoming texturing contest is in the works, and we're eager to hear your suggestions! Please take this opportunity to share your ideas in this theme discussion thread for the Texturing Contest #34!
  • 🏆 Hive's 7th HD Modeling Contest: Icecrown Creature is now open! The frozen wastes of Icecrown are home to some of Azeroth’s most terrifying and resilient creatures. For this contest, your challenge is to design and model a HD 3D monster that embodies the cold, undead, and sinister essence of Icecrown! 📅 Submissions close on April 13, 2025. Don't miss this opportunity to let your creativity shine! Enter now and show us your frozen masterpiece! 🔗 Click here to enter!

[Trigger] Trigger not working properly need help!

Status
Not open for further replies.
Level 7
Joined
Jul 29, 2009
Messages
276
hi, i have some triggers that try to create that idea:

the Trebuchet unit is a nutural machine usebale by anyone (when it's built it transformers to nutural).
if a hero is near it he can buy a unit from it, the unit is a dummy for using the trebuchet and triggers the use.
when used the trebuchet becomes owend by the owner of the user and the user can't attack or move (cuz he's using the machine).
after you start using the machine you can buy the dummy unit agein to stop using it. this makes the machine turn nutural agein and SUPPOSED to allow you to move agien.

i created 2 arrays of units, one for the machine users and one for the mcahine used so i can keep track of them.

so the prob is that after you leave the machine the trigger fails to earse you and the machine from the arrays, so the unit can't move.

  • Use Trebuchet
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Trebuchet (Machine)
    • Actions
      • Unit - Remove (Sold unit) from the game
      • Set Temp_Bool_1 = False
      • For each (Integer A) from 1 to 20, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Selling unit) Equal to MachineUsed[(Integer A)]
            • Then - Actions
              • Set Temp_Bool_1 = True
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Temp_Bool_1 Equal to False
        • Then - Actions
          • Unit - Remove Select Hero (Machine) from (Triggering unit)
          • Unit - Remove Sell Units from (Triggering unit)
          • For each (Integer A) from 1 to 20, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (MachineUser[(Integer A)] Equal to No unit) and (Temp_Bool_1 Equal to False)
                • Then - Actions
                  • Set MachineUser[(Integer A)] = (Buying unit)
                  • Set MachineUsed[(Integer A)] = (Triggering unit)
                  • Set Temp_Bool_1 = True
                  • Game - Display to (All players) the text: Done 1
                • Else - Actions
          • Unit - Move (Buying unit) instantly to (Position of (Ownership-changed unit)), facing (Position of (Triggering unit))
          • Unit - Make (Buying unit) face (Triggering unit) over 0.00 seconds
          • Wait 0.20 seconds
          • Unit - Change ownership of (Triggering unit) to (Owner of (Buying unit)) and Change color
          • Game - Display to (All players matching ((Owner of (Buying unit)) Equal to (Matching player))) the text: Unit Cant Move Whil...
          • Set Temp_Bool_1 = False
          • Selection - Clear selection for (Owner of (Triggering unit))
          • Selection - Select (Last replaced unit) for (Owner of (Triggering unit))
        • Else - Actions
          • For each (Integer A) from 1 to 20, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Buying unit) Equal to MachineUser[(Integer A)]) and ((Owner of (Selling unit)) Not equal to Neutral Passive)
                • Then - Actions
                  • Unit - Change ownership of MachineUsed[(Integer A)] to Neutral Passive and Change color
                  • Unit - Add Select Hero (Machine) to (Ownership-changed unit)
                  • Unit - Add Sell Units to (Ownership-changed unit)
                  • Set MachineUser[(Integer A)] = No unit
                  • Set MachineUsed[(Integer A)] = No unit
                  • Game - Display to (All players) the text: left
                • Else - Actions
thx for helping me fix this problam! :D
 
Last edited:
Level 7
Joined
Jul 29, 2009
Messages
276
it says the the custom script is not written good and anyway it's just jassing the GUI.

The position thing dosnt affect anything (and it should'nt even be there).

i used all kind of text display so i'll know where the trigger has gotten and it's says "left" alot of times (mabye 20..)...
 
Level 7
Joined
Jul 29, 2009
Messages
276
the trigger that stops the moving is a diffrent trigger that affects only units in the User array.

the Unit - Move order here is irrelevent becouse its targeting nothing and it have no effect (i tested it), consider it earesed.

now im trying to rewrite this whole trigger and hopefuly it will work.
 
Level 9
Joined
May 30, 2008
Messages
430
So in order to fix your problem. Make variable Unit Array and set your hero to this (if even't response triggering player is intiger A then pause hero intiger A)
when he buy the other unit "leave" do the same thing but Unpause the hero intiger A.
If you still can't manage to fix your problem pm me:wink:
 
Level 7
Joined
Jul 29, 2009
Messages
276
what do you mean "pause" and "unpause"? are these commandes? what do they do?

EDIT:
well i tried it, it just pauses the original units..
there must be a way..
 
Last edited:
Question, why dont you just do:

  • Testing
    • Events:
      • Unit - A unit sells a unit
    • Conditions:
      • Unit type of selling unit equal to Trebuchet
    • Actions:
      • If (Unit type of sold unit) Equal to (Enter trebuchet)
        • Then - Actions
          • Unit - Pause Buying unit
          • Unit - Unpause Selling unit
          • Unit - Hide Buying unit
          • Unit - give (Selling unit) to (Owner of ( Buying unit))
          • Unit - Remove Sell units from (Selling unit)
          • Unit - Remove Select Hero (Machine) from (Selling unit)
          • Unit - Remove Select Hero (Hero) from (Selling unit)
          • Unit - Remove (Sold unit)
        • Else - Actions
          • Unit - Unpause Buying unit
          • Unit - Pause Selling unit
          • Unit - Unhide Buying unit
          • Unit - Give Selling unit to (Player 14, neutral passive)
          • Unit - Add Sell units from (Selling unit)
          • Unit - Add Select Hero (Machine) From selling unit
          • Unit - Add Select Hero (Hero) From selling unit
          • Unit - Remove (Sold unit)
Try that.
 
Level 7
Joined
Jul 29, 2009
Messages
276
I got the problam (and it gets to your solution too, ikillforeyou)!

in the else part i was using "Buying Unit" after actuoly removing the "select hero" abilty, so the "Buying Unit" was acutly null! that explains alot of stuff.
ill edit if i find how to get passed this.
 
Status
Not open for further replies.
Top