• 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.

[Trigger] iv got some problems with buildable gates

Status
Not open for further replies.
Level 15
Joined
Jul 9, 2008
Messages
1,552
iv made my gates 5 gates horizontal open/horizontal closed/vertical open/vertical closed/vertical closed dummy(for building)

iv got this trigger witch turns the vertical gates vertical but when i build the gates side by side (||)

the first gate is fine but when i build the second gate the second gate ends up some where els but still vertical
e.g

  • vertical gate turn
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Constructed structure)) Equal to Gate Closed (V) (dummy)
        • Then - Actions
          • Unit - Remove (Triggering unit) from the game
          • Unit - Create 1 Gate Closed (V) for (Owner of (Triggering unit)) at (Position of (Triggering unit)) facing 0.00 degrees
        • Else - Actions

then also what trigger can i add to make the gate play the open animation?
i tryed but didnt work
  • Events
    • Unit - A unit Starts the effect of an ability
  • Conditions
    • ((Ability being cast) Equal to open Gate(H) or ((Ability being cast) Equal to open Gate(V))
  • Actions
    • Animation - Play (Triggering unit)'s death alternate animation
 
Last edited:
Level 13
Joined
Jun 22, 2004
Messages
783
In your first potion of code you specify the triggering unit to be the one that finnished building the construction, you remove this unit, and you try to place something at the position of that removed unit, basically what happens is that the game tries to place something of which you removed the coordinates of, what you'd want to do is, to save the coordinates(position of the triggering unit) and save it in a point variable.

for your second part of code, if your gate is the actual caster of the ability, it should work, if another unit casts the spell, you should specify to the gate that you built.

Keep in mind the triggering unit, is basically the unit you called in your event.
 
  • Like
Reactions: Rui
Level 15
Joined
Jul 9, 2008
Messages
1,552
In your first potion of code you specify the triggering unit to be the one that finnished building the construction, you remove this unit, and you try to place something at the position of that removed unit, basically what happens is that the game tries to place something of which you removed the coordinates of, what you'd want to do is, to save the coordinates(position of the triggering unit) and save it in a point variable.

for your second part of code, if your gate is the actual caster of the ability, it should work, if another unit casts the spell, you should specify to the gate that you built.

Keep in mind the triggering unit, is basically the unit you called in your event.


so set the point like this?
  • vertical gate turn
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of (Constructed structure)) Equal to Gate Closed (V) (dummy) (human)
        • Then - Actions
          • Set Gate_Pos = (Position of (Triggering unit))
          • Unit - Remove (Triggering unit) from the game
          • Unit - Create 1 Gate Closed (V) (human) for (Owner of (Triggering unit)) at Gate_Pos facing 0.00 degrees
          • Custom script: call RemoveLocation (udg_Gate_Pos)
        • Else - Actions
EDIT: i tryed it and it didnt work =(

It looks like what it's doing is sticking the gate where the peasant is.

there peasent moves when it start to build the gate
 
Level 8
Joined
Apr 30, 2009
Messages
338
Maybe he based the gate on a normal building and its collision map is a square so it is too close to the other gate? Check the collision size of the gate and the pathing map in object editor.
 
Level 8
Joined
Apr 30, 2009
Messages
338
you can't open or close buildings even if they use the gate model, so you must completely trigger the construction process. Personally I would give the builders a spellbook "build gates" with all the gates as spells inside based on channel. Then you use a trigger "unit finishes casting" and place the DESTRUCTABLE gate.
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
you can't open or close buildings even if they use the gate model, so you must completely trigger the construction process. Personally I would give the builders a spellbook "build gates" with all the gates as spells inside based on channel. Then you use a trigger "unit finishes casting" and place the DESTRUCTABLE gate.

you cant controll Destructable to open and close it

to open and close buildings you have 2 of the same gate and one with no pathing so you can walk though them and use the bear form morph ability to switch between them the thing is my vertical gates dont work when i build them side by side they end up some where els from where u first built them

aslo my trigger to make the open gate play the open animation wont work
 
Level 8
Joined
Apr 30, 2009
Messages
338
can you pre-place them side by side in the editor?

if no, then it's probably the collision/pathing map

if yes, then it's gotta be the script
 
Level 15
Joined
Jul 9, 2008
Messages
1,552
can you pre-place them side by side in the editor?

if no, then it's probably the collision/pathing map

if yes, then it's gotta be the script

i cant put them in the editor because in the editor they will be horizontal the trigger turns them vertical...............


i used that tutorial it didnt work it gave me these problems ill add a post there see if any 1 can help me
 
Last edited:
Level 5
Joined
May 3, 2009
Messages
129
it moves it cos the peon is in the way when its finished building and replaces the gate.
you either need to move the peon out of the way first then replace the gate or do like he said and preplace the gates then trigger all the ones you want to change at the start of the game

i've just done a fast test but it works
  • test
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 256.00 of (Position of (Constructed structure))) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Not equal to (Unit-type of (Constructed structure))
                • Then - Actions
                  • Unit - Move (Picked unit) instantly to ((Position of (Constructed structure)) offset by 300.00 towards 0.00 degrees), facing (Position of (Triggering unit))
                • Else - Actions
          • Wait 0.10 game-time seconds
          • Unit - Remove (Constructed structure) from the game
          • Unit - Create 1 Barracks for (Owner of (Constructed structure)) at (Position of (Constructed structure)) facing 135.00 degrees
        • Else - Actions
  • test1
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Animation - Play (Target unit of ability being cast)'s Death alternate animation
 
Last edited:
Level 15
Joined
Jul 9, 2008
Messages
1,552
it moves it cos the peon is in the way when its finished building and replaces the gate.
you either need to move the peon out of the way first then replace the gate or do like he said and preplace the gates then trigger all the ones you want to change at the start of the game

i've just done a fast test but it works
  • test
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 256.00 of (Position of (Constructed structure))) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Not equal to (Unit-type of (Constructed structure))
                • Then - Actions
                  • Unit - Move (Picked unit) instantly to ((Position of (Constructed structure)) offset by 300.00 towards 0.00 degrees), facing (Position of (Triggering unit))
                • Else - Actions
          • Wait 0.10 game-time seconds
          • Unit - Remove (Constructed structure) from the game
          • Unit - Create 1 Barracks for (Owner of (Constructed structure)) at (Position of (Constructed structure)) facing 135.00 degrees
        • Else - Actions
  • test1
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
    • Actions
      • Animation - Play (Target unit of ability being cast)'s Death alternate animation

its not the peon its the other gate beside it and if i build this gate by its self not near any other buildings its fine but when i build it beside another building the gate the replaced gate is not in the same spot

i dont know why my animation trigger doesent work
  • open gate animations
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to open Gate(H) (Human)
    • Actions
      • Animation - Play (Casting unit)'s Death Alternate animation
It moves because they are originally horizontal.
what can i do about that
 
Last edited:
Level 9
Joined
Jun 7, 2008
Messages
440
it moves it cos the peon is in the way when its finished building and replaces the gate.
you either need to move the peon out of the way first then replace the gate or do like he said and preplace the gates then trigger all the ones you want to change at the start of the game

i've just done a fast test but it works
  • test
    • Events
      • Unit - A unit Finishes construction
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
        • Then - Actions
          • Unit Group - Pick every unit in (Units within 256.00 of (Position of (Constructed structure))) and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Unit-type of (Picked unit)) Not equal to (Unit-type of (Constructed structure))
                • Then - Actions
                  • Unit - Move (Picked unit) instantly to ((Position of (Constructed structure)) offset by 300.00 towards 0.00 degrees), facing (Position of (Triggering unit))
                • Else - Actions
          • Wait 0.10 game-time seconds
          • Unit - Remove (Constructed structure) from the game
          • Unit - Create 1 Barracks for (Owner of (Constructed structure)) at (Position of (Constructed structure)) facing 135.00 degrees
        • Else - Actions

Why is this If/then/else? As far as I can tell, it isnt needed. Only the second If/Then/Else is needed.

its not the peon its the other gate beside it and if i build this gate by its self not near any other buildings its fine but when i build it beside another building the gate the replaced gate is not in the same spot

i dont know why my animation trigger doesent work
  • open gate animations
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Ability being cast) Equal to open Gate(H) (Human)
    • Actions
      • Animation - Play (Casting unit)'s Death Alternate animation

Why do you have multiple Or's? Don't need them.

Why not try using a vertical model?
 
Status
Not open for further replies.
Top