• 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] Multiplayer Bouncing

Status
Not open for further replies.
Level 2
Joined
Jan 13, 2009
Messages
12
So I found a bounce trigger from somewhere on Hive, but it only worked for one unit at a time. I needed it for a multiplayer game, so I attempted to modify it.

  • Bounce Init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Bounce (C)
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Player((Integer A))) Equal to (==) (Player((Player number of (Triggering player))))
            • Then - Actions
              • Unit Group - Pick every unit in (Units owned by (Player((Integer A)))) and do (Actions)
                • Loop - Actions
                  • Unit - Remove Bounce (C) from (Picked unit)
                  • Set Facing_Var[(Integer A)] = (Facing of (Picked unit))
                  • Set BounceUnit[(Integer A)] = (Picked unit)
                  • Unit - Turn collision for BounceUnit[(Integer A)] Off
                  • Unit - Add Crow Form to BounceUnit[(Integer A)]
                  • Unit - Remove Crow Form from BounceUnit[(Integer A)]
                  • Animation - Change BounceUnit[(Integer A)] flying height to 500.00 at 200.00
                  • Trigger - Turn on Bounce Movement <gen>
                  • Wait 1.00 seconds
                  • Animation - Change BounceUnit[(Integer A)] flying height to 0.00 at 200.00
                  • Wait 1.00 seconds
                  • Unit - Turn collision for BounceUnit[(Integer A)] On
                  • Trigger - Turn off Bounce Movement <gen>
                  • Unit - Add Bounce (C) to BounceUnit[(Integer A)]
            • Else - Actions
  • Bounce Movement
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • Do Multiple ActionsFor each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
            • Then - Actions
              • Set Temp_Location[(Integer A)] = ((Position of BounceUnit[(Integer A)]) offset by 40.00 towards Facing_Var[(Integer A)] degrees)
                • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                  • If - Conditions
                    • ((Playable map area) contains Temp_Location[(Integer A)]) Equal to (==) True
                  • Then - Actions
                    • Unit - Move BounceUnit[(Integer A)] instantly to Temp_Location[(Integer A)]
                    • Custom script: call RemoveLocation(udg_Temp_Location[GetForLoopIndexA()])
                    • Camera - Pan camera for (Owner of BounceUnit[(Integer A)]) to (Position of BounceUnit[(Integer A)]) over 0.00 seconds
                  • Else - Actions
                    • Unit - Turn collision for BounceUnit[(Integer A)] On
            • Else - Actions
For some reason, the top script gets stuck at "Trigger - Turn on Bounce Movement <gen>" and won't execute the rest of the trigger.

Help please?
 
Level 8
Joined
Aug 4, 2006
Messages
357
you can't use waits inside loops in GUI. i don't think you need loops in the first trigger, as long as each player only has one unit that can bounce. you need to make a variable boolean array IsBouncing, so that we can know whether to bounce move each player. turning on/off the bounce movement trigger will turn it on/off for all players, not just 1 player. that would screw things up. try this:

  • Bounce Init
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to (==) Bounce (C)
    • Actions
      • Unit - Remove Bounce (C) from (Triggering unit)
      • Unit - Turn collision for (Triggering unit) Off
      • Unit - Add Crow Form to (Triggering unit)
      • Unit - Remove Crow Form from (Triggering unit)
      • Animation - Change (Triggering unit) flying height to 500.00 at 200.00
      • Set Facing_Var[Player Number of(Owner of (Triggering Unit))] = (Facing of (Triggering unit))
      • Set BounceUnit[Player Number of(Owner of (Triggering Unit))] = (Triggering unit)
      • Wait 1.00 seconds
      • Set IsBouncing[Player Number of(Owner of (Triggering Unit))] = true
      • Animation - Change (Triggering unit) flying height to 0.00 at 200.00
      • Wait 1.00 seconds
      • Set IsBouncing[Player Number of(Owner of (Triggering Unit))] = false
      • Unit - Turn collision for (Triggering unit) On
      • Unit - Add Bounce (C) to (Triggering unit)
  • Bounce Movement
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 1 to 10, do (Actions)
        • Loop - Actions
          • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (IsBouncing[(Integer A)]) Equal to True
            • Then - Actions
              • Set Temp_Location[(Integer A)] = ((Position of BounceUnit[(Integer A)]) offset by 40.00 towards Facing_Var[(Integer A)] degrees)
              • Multiple FunctionsIf (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ((Playable map area) contains Temp_Location[(Integer A)]) Equal to (==) True
                • Then - Actions
                  • Unit - Move BounceUnit[(Integer A)] instantly to Temp_Location[(Integer A)]
                  • Custom script: call RemoveLocation(udg_Temp_Location[GetForLoopIndexA()])
                  • Camera - Pan camera for (Player(Integer A)) to (Position of BounceUnit[(Integer A)]) over 0.00 seconds
                • Else - Actions
            • Else - Actions
 
Status
Not open for further replies.
Top