• 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] Dodgeball Trigger

Status
Not open for further replies.
Level 4
Joined
Feb 3, 2007
Messages
58
No one here is going to help but its worth a try.
I need a trigger so that when a unit uses the throw ball abilty and has a ball in its inventory, to throw a ball at a targeted point and kill any enemy units that it comes in contact with. Then I need the ball to turn into a ball item and 1 ball item from the triggering units inventory to disappear.
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,258
Simple

The ball it self is a charged item (1 charge) so is used up appon use.
It casts shockwave towards target location (no triggers needed) but spawns a item at the end of the shockwave's location (needs triggers but simple ones).

Its that simple

Ofcourse you can make a more complex version with phisics and stuff but the method above will work fine.
 
Level 8
Joined
Feb 4, 2007
Messages
389
Here, I'll copy the trigger in my map. I'm working on a Dodgeball map, also.

I need a trigger so that when a unit uses the throw ball abilty and has a ball in its inventory, to throw a ball at a targeted point
  • Throw
    • Events
      • Unit - A unit Finishes casting an ability
    • Conditions
      • PlayerHoldingBall[((Player number of (Triggering player)) - 1)] Equal to True
      • (Ability being cast) Equal to Throw Ball
    • Actions
      • Set BallsGrabbed[((Player number of (Triggering player)) - 1)] = False
      • Set Thrower[(Player number of (Owner of (Triggering unit)))] = (Owner of (Triggering unit))
      • Set PlayerGrabbing[((Player number of (Triggering player)) - 1)] = (Triggering unit)
      • Set PlayerHoldingBall[((Player number of (Triggering player)) - 1)] = False
      • Unit - Remove Throw Ball from (Triggering unit)
      • Unit - Add Grab Ball to (Triggering unit)
      • Unit - Replace Balls[((Player number of (Triggering player)) - 1)] with a Thrown Ball using The old unit's relative life and mana
      • Unit - Move (Last replaced unit) instantly to ((Position of (Triggering unit)) offset by 15.00 towards (Angle from (Position of (Triggering unit)) to ThrowTargets[((Player number of (Triggering player)) - 1)]) degrees), facing ThrowTargets[((Player number of (Triggering player)) - 1)]
      • Unit - Set the custom value of (Last replaced unit) to 1000
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Owner of (Triggering unit)) Equal to Player 1 (Red)
              • (Owner of (Triggering unit)) Equal to Player 2 (Blue)
              • (Owner of (Triggering unit)) Equal to Player 3 (Teal)
              • (Owner of (Triggering unit)) Equal to Player 4 (Purple)
              • (Owner of (Triggering unit)) Equal to Player 5 (Yellow)
              • (Owner of (Triggering unit)) Equal to Player 6 (Orange)
        • Then - Actions
          • Unit - Set the custom value of (Last replaced unit) to ((Custom value of (Last replaced unit)) + 1)
        • Else - Actions
      • Set ThrownBalls[nThrownBalls] = (Last replaced unit)
      • Set ThrownBallAngles[nThrownBalls] = (Angle from (Position of (Triggering unit)) to ThrowTargets[((Player number of (Triggering player)) - 1)])
      • Set nThrownBalls = (nThrownBalls + 1)
I have it so that when the ball is thrown, the "Throw" ability is replaced by the "Grab" ability.

Just add in a condition to check if the item is in it's inventory.

kill any enemy units that it comes in contact with.
  • PlayerCollision
    • Events
      • Time - Every 0.05 seconds of game time
    • Conditions
    • Actions
      • For each (Integer A) from 0 to (nPlayers - 1), do (Actions)
        • Loop - Actions
          • For each (Integer B) from 0 to (nThrownBalls - 1), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • Or - Any (Conditions) are true
                        • Conditions
                          • And - All (Conditions) are true
                            • Conditions
                              • ((Custom value of ThrownBalls[(Integer B)]) mod 2) Equal to 1
                              • Or - Any (Conditions) are true
                                • Conditions
                                  • (Owner of Players[(Integer A)]) Equal to Player 7 (Green)
                                  • (Owner of Players[(Integer A)]) Equal to Player 9 (Gray)
                                  • (Owner of Players[(Integer A)]) Equal to Player 10 (Light Blue)
                                  • (Owner of Players[(Integer A)]) Equal to Player 8 (Pink)
                                  • (Owner of Players[(Integer A)]) Equal to Player 11 (Dark Green)
                                  • (Owner of Players[(Integer A)]) Equal to Player 12 (Brown)
                          • And - All (Conditions) are true
                            • Conditions
                              • ((Custom value of ThrownBalls[(Integer B)]) mod 2) Equal to 0
                              • Or - Any (Conditions) are true
                                • Conditions
                                  • (Owner of Players[(Integer A)]) Equal to Player 1 (Red)
                                  • (Owner of Players[(Integer A)]) Equal to Player 3 (Teal)
                                  • (Owner of Players[(Integer A)]) Equal to Player 4 (Purple)
                                  • (Owner of Players[(Integer A)]) Equal to Player 2 (Blue)
                                  • (Owner of Players[(Integer A)]) Equal to Player 5 (Yellow)
                                  • (Owner of Players[(Integer A)]) Equal to Player 6 (Orange)
                      • (Distance between (Position of ThrownBalls[(Integer B)]) and (Position of Players[(Integer A)])) Less than or equal to 80.00
                • Then - Actions
                  • If (SecondLife[(Integer A)] Equal to True) then do (Unit - Kill Players[(Integer A)]) else do (Unit - Move Players[(Integer A)] instantly to (Center of Waiting Room <gen>))
                  • If (SecondLife[(Integer A)] Equal to False) then do (Set SecondLife[(Integer A)] = True) else do (Set SecondLife[(Integer A)] = False).
                  • Set player_deaths[(Player number of Thrower[(Player number of (Owner of Players[(Integer A)]))])] = (player_deaths[(Player number of Thrower[(Player number of (Owner of Players[(Integer A)]))])] + 1)
                  • Multiboard - Set the text for (Last created multiboard) item in column 3, row ((Player number of (Owner of (Dying unit))) + 1) to (String(player_deaths[(Player number of (Owner of (Dying unit)))]))
                • Else - Actions
I know it won't fit exactly what you want, but you should get the idea.

The item trigger is so simple that I'm not even going to post it.
Just wondering, but did you actually attempt this trigger? It's fairly simple, just a bit of work.

PS: I know the coding isn't as neat as it could be, but I'm too lazy to fix that up, as it works fine.
 
Level 4
Joined
Feb 3, 2007
Messages
58
I think the one mentioned first is all I need.
*EDIT* What if I want the balls to bounce though?
 
Last edited:
Level 4
Joined
Sep 20, 2005
Messages
72
visually realistic and accurate? well... Elimination(fun shooting map!) managed to do that with the Vector System using JASS. uses a lot of math with vectors and probably not something you want to get into unless your a) devoted to making it happen b) some understanding in algebra and physics c)jass knowledge :)sad: i couldnt really exactly understand the workings of it to actually use it properly...what a bummer -_- the effects that it makes is really useful and really cool!)

although, if you wanna just do some simpler parabolic motion without much accuracy, search for GUI jump spell examples/templates n try to work that with a dummy ball. gets the job done :infl_thumbs_up:
*but then it wont work with the 1st simpler method*

my suggestion would be to keep the first method, unless your fluent in the more advanced triggers...but then we wouldnt be here, would we?
 
Level 8
Joined
Feb 4, 2007
Messages
389
Here's my rebound triggers. They work fairly well.

  • Rebound2
    • Events
      • Unit - A unit enters BotBound <gen>
      • Unit - A unit enters TopBound <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Thrown Ball
    • Actions
      • For each (Integer A) from 0 to (nThrownBalls - 1), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to ThrownBalls[(Integer A)]
            • Then - Actions
              • Sound - Play BOINK1 <gen>
              • Set ThrownBallAngles[(Integer A)] = (360.00 - ThrownBallAngles[(Integer A)])
            • Else - Actions
BotBound and TopBound are regions, on the top and bottom of my Dodgeball arena.

  • Rebound3
    • Events
      • Unit - A unit enters LeftBound <gen>
      • Unit - A unit enters RightBound <gen>
    • Conditions
      • (Unit-type of (Triggering unit)) Equal to Thrown Ball
    • Actions
      • For each (Integer A) from 0 to (nThrownBalls - 1), do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Triggering unit) Equal to ThrownBalls[(Integer A)]
            • Then - Actions
              • Sound - Play BOINK1 <gen>
              • Set ThrownBallAngles[(Integer A)] = (180.00 - ThrownBallAngles[(Integer A)])
            • Else - Actions
LeftBound and RightBound are regions, at the two ends of the arena.

This generates a realistic bounce.
 
Level 4
Joined
Feb 3, 2007
Messages
58
Again with the over complicated triggers tonks, anyway Ill just have ball items spawn on each side. I need a trigger that tells how many units are allied to player 1 or last picked group.
 
Last edited:
Level 8
Joined
Feb 4, 2007
Messages
389
Again with the over complicated triggers tonks, anyway Ill just have ball items spawn on each side. I need a trigger that tells how many units are allied to player 1 or last picked group.

They aren't overcomplicated, they're actually fairly simple..

  • For each (Integer A) from 0 to (nPlayers / 2), do (Actions)
    • Loop - Actions
      • Unit - Create 1 Ball for Neutral Passive at (Random point in Team2Region <gen>) facing Default building facing degrees
      • Cinematic - Ping minimap for (All players) at (Position of (Last created unit)) for 1.00 seconds
      • Unit - Create 1 Ball for Neutral Passive at (Random point in Team1Region <gen>) facing Default building facing degrees
      • Cinematic - Ping minimap for (All players) at (Position of (Last created unit)) for 1.00 seconds
nPlayers is my variable for deriving which players are playing. You can set that up in another trigger.
 
Level 4
Joined
Feb 3, 2007
Messages
58
Yeah yeah, theyre just to time consming.
The throw ball ability based off shock wave isnt throwing ball at the targeted point just that general area or sometimes in a totaly random direction, what gives?
 
Level 4
Joined
Feb 3, 2007
Messages
58
Does anyone know how to get the storm bolt ability to be able to target a certain part on the ground. And Im using abilities not triggers to throw balls.
 
Level 4
Joined
Sep 20, 2005
Messages
72
I would (and have before) use carrion swarm, or breath of fire for this purpose. These dont have the silly earth deformation that shockwave would make. I dont see what the problem with accuracy is, just set the dmg radius smaller.

However, it may look silly that balls r flying thru ppl. If you dont want that, then you'll have to use something like what Tonks made (xept im not exactly sure what Tonks' does cuz i wouldnt do it this way o_O) If you want death on contact, just add permanent immolation to the ball unit that you're periodically moving. Group all units within range of the ball, and remove the ball when it detects that the first of this group is a real unit. (<-- do you understand this part? not sure how much triggering you know.) both are methods ive used before, and they work relatively well (though obviously the vector system looks so much better >_<)
 
Level 2
Joined
Dec 16, 2006
Messages
12
Yeah yeah, theyre just to time consming.QUOTE]



remember the best maps take the longest to make, you don't want to rush a map, always keep it, nice, and clean, using bigger triggers can often result in a more decent look, and cleaer way of doing the event.


and i don't think his triggers are complicated, like he said, they are fairly easy, just look into it ;)
 
Status
Not open for further replies.
Top