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

somthing wrong with my trigger :/

Status
Not open for further replies.
Level 11
Joined
Nov 12, 2006
Messages
765
this trigger here is for an ability called Capture planet. a unit targets the planet, uses the ability and this trigger then runs to change control of the planet. however it doesnt seem to work all the time. peticulary when multiple planets are being captured at the same time, however there shouldnt be any problems because the ability takes 12 seconds to cast, and then like .5 seconds to execute. any help?
in addition, can anyone tell me what the code is so i can make trigger text look like world editor trigger text, because i have not found a BB code for that



  • Events
    • Unit - A unit Finishes casting an ability
  • Conditions
    • (Ability being cast) Equal to Capture Planet
  • Actions
    • Unit Group - Pick every unit in (Units within 512.00 of (Position of (Casting unit))) 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)) Equal to Planet
          • Then - Actions
            • Unit - Change ownership of (Picked unit) to (Triggering player) and Change color
          • Else - Actions
            • Do nothing
 
Last edited:
Level 17
Joined
Aug 20, 2007
Messages
1,122
  • Events
    • Unit - A unit Finishes casting an ability
  • Conditions
    • (Ability being cast) Equal to Capture Planet
  • Actions
    • Unit Group - Pick every unit in (Units within 512.00 of (Position of (Casting unit))) 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)) Equal to Planet
          • Then - Actions
            • Unit - Change ownership of (Picked unit) to (Owner of (Casting Unit)) and Change color
          • Else - Actions
            • Do nothing
I changed Triggering Player to Owner of Casting Unit.

BTW, you should remove leaks... No matter how small or rare this trigger is.
 
Level 15
Joined
Dec 18, 2007
Messages
1,098
  • Events
    • Unit - A unit Finishes casting an ability
  • Conditions
    • (Ability being cast) Equal to Capture Planet
  • Actions
    • Unit Group - Pick every unit in (Units within 512.00 of (Position of (Casting unit))) 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)) Equal to Planet
          • Then - Actions
            • Unit - Change ownership of (Picked unit) to (Owner of (Casting Unit)) and Change color
          • Else - Actions
            • Do nothing
I changed Triggering Player to Owner of Casting Unit.

BTW, you should remove leaks... No matter how small or rare this trigger is.

Yeah, that and:
]
  • Events
    • Unit - A unit Finishes casting an ability
  • Conditions
    • (Ability being cast) Equal to Capture Planet
  • Actions
    • Unit Group - Pick every unit in (Units within 512.00 of (Position of (Casting unit))) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Matching unit)) Equal to Planet
          • Then - Actions
            • Unit - Change ownership of (Picked unit) to (Owner of (Casting Unit)) and Change color
          • Else - Actions
            • Do nothing
You have to change picked unit when checking the condition to matching unit.
 
Level 17
Joined
Aug 20, 2007
Messages
1,122
  • Events
    • Unit - A unit Finishes casting an ability
  • Conditions
    • (Ability being cast) Equal to Capture Planet
  • Actions
    • Unit Group - Pick every unit in (Units within 512.00 of (Position of (Casting unit))) and do (Actions)
      • Loop - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • (Unit-type of (Matching unit)) Equal to Planet
          • Then - Actions
            • Unit - Change ownership of (Picked unit) to (Owner of (Casting Unit)) and Change color
          • Else - Actions
            • Do nothing
Read carefully, this is both mine and his thought...

Just use it... Picked unit and matching unit etc... owner of casting unit
 
Status
Not open for further replies.
Top