Need help with jass!

Status
Not open for further replies.
Level 15
Joined
Aug 11, 2009
Messages
1,605
I have spend many hours looking all the topics here in HWS but i haven't found anything to help me with my problem.:cry:
My map The Eternal Battle is still in its alpha versions,but i need a trigger i don't care if it is in GUI or Jass to make something like arena,or pvp.I want something something just like angel arena's fighting arena,which takes 2 players in random from both teams and teleports them to an arena,and teleports back of course...
If someone who has the skills to make it,could give it a try i would give him HUGE CREDITS!:thumbs_up:
Thanks in advance!
 
I made a very unadvanced trigger, you will probably want to further improve it. I also didn't test it so it might bug.
  • Arena
    • Events
      • Time - Every 360.00 seconds of game time
    • Conditions
    • Actions
      • Unit - Pause all units
      • Set ArenaUnit1 = (Random unit from Team1)
      • Set ArenaUnit2 = (Random unit from Team2)
      • Set ArenaLoc1 = (Position of ArenaUnit1)
      • Set ArenaLoc2 = (Position of ArenaUnit2)
      • Set tempPoint = (Center of ArenaRegion)
      • Unit - Move ArenaUnit1 instantly to tempPoint
      • Unit - Move ArenaUnit2 instantly to tempPoint
      • Custom script: call RemoveLocation( udg_tempPoint )
      • Unit - Unpause ArenaUnit1
      • Unit - Unpause ArenaUnit2
      • Countdown Timer - Start ArenaTime as a One-shot timer that will expire in 100.00 seconds
  • Arena2
    • Events
      • Unit - A unit Dies
      • Time - ArenaTimer expires
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ((Triggering unit) is A Hero) Equal to True
          • (Remaining time for DialogTimer) Less than or equal to 0.00
    • Actions
      • Countdown Timer - Pause ArenaTimer
      • Unit - Unpause all units
      • Unit - Move ArenaUnit1 instantly to ArenaLoc1
      • Unit - Move ArenaUnit2 instantly to ArenaLoc2
      • Custom script: call RemoveLocation( udg_ArenaLoc1 )
      • Custom script: call RemoveLocation( udg_ArenaLoc2 )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ArenaUnit1 is alive) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ArenaUnit2 is alive) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: No winner of arena ...
              • -------- Punishment, put in jail, lose gold, etc --------
            • Else - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of ArenaUnit1)) + has won the arena battle)
              • Player - Set (Owner of ArenaUnit1) Current gold to (((Owner of ArenaUnit1) Current gold) + 200)
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ArenaUnit2 is alive) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of ArenaUnit2)) + has won the arena battle)
              • Player - Set (Owner of ArenaUnit2) Current gold to (((Owner of ArenaUnit2) Current gold) + 200)
            • Else - Actions
              • -------- Both units died, no winner (ITS POSSIBLE THAT NOTHING HAPPENS IF BOTH UNITS DIE SIMULTANIOUS) --------
+rep plz, it took some time to write down :wink:
EDIT: I spelled the fat word as right :p, sometimes i forget English is not a phonetically language.
 
Last edited:
Variables are :
ArenaUnit1: unit (Initial value null)
ArenaUnit2 : unit (Initial value null)
ArenaLoc1 : point (Initial value null)
ArenaLoc2 : point (Initial value null)
tempPoint; point (Initial value null)
Team1: Unit Group with all heroes from team 1 in it.
Team2: Unit Group with all heroes from team 2 in it.
ArenaRegion: region on place where arena is.

Change condition of Arena2 to:
  • Or - Any (Conditions) are true
    • Conditions
      • ((Triggering unit) is A Hero) Equal to True
      • (Remaining time for DialogTimer) Less than or equal to 0.00
You can also add this to Arena1 trigger:
  • For each (Integer A) from 1 to 12, do (Actions)
    • Loop - Actions
      • Camera - Pan camera for (Player((Integer A))) to (Center of ArenaRegion) over 0.00 seconds
you can also adds a wait before unpausing the units and show message "Arena begins in bla seconds."

You can also look here , it someone with same problem and the team1 and team2 group trigger is also in it.
 
Last edited:
For the Team 1 and Team 2 , create 2 player groups in the variable editor.
Then run this trigger:
  • Start The Timer
  • Events
  • Map initialization
  • Conditions
  • Actions
  • Unit Group - Pick every unit in (Units in (Playable map area)) 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)) is A Hero) Equal to True
  • ((Picked unit) belongs to an ally of Some Player in Team 1) Equal to True
  • Then - Actions
  • Unit Group - Add (Picked unit) to HeroesTeam1
  • Else - Actions
  • Unit Group - Pick every unit in (Units in (Playable map area)) 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)) is A Hero) Equal to True
  • ((Picked unit) belongs to an ally of Some Player in Team 2) Equal to True
  • Then - Actions
  • Unit Group - Add (Picked unit) to HeroesTeam2
  • Else - Actions
Camera - Pan Camera at player field select:
-Conversion - convert player index to player
-Click on the "1" choose for loop Integer A
 
See?I mentioned it before...i can only select unit groups.Anyway i corrected them,and yes i don't have a hero like meepo in dota,kinda hard to make one :D
Gonna check the whole trigger and tell you my opinion.:grin:

Ok...the trigger is all made up except 2 things.The HeroesTeam1 and HeroesTeam2 in the other trigger you posted what type of variables are?
And also i can't this ((Picked unit) belongs to an ally of Some Player in Team 1) Equal to True
 
-HeroesTeam1 is just team1 but i got it from other thread , thats why names are different

-Just choose a player from team 1 at the place of "Some player in Team 1"
Example:
Team1: red, blue -> select ally of Player red or ally of player blue
Team2: purple, yellow -> select ally of Player purple or ally of player yellow

It just a condition to check that the hero is owned by a player of team1 / team 2
 
To make stronger creeps spawn when you win arena.

-Make 2 booleans in the variable editor, name them SpawnStrongT1 and SpawnStrongT2.
-Copy all your creepspawning triggers.

-In your just copied triggers change the creeps that spawn into stronger creeps.

-Now add this condition to the team 1 normal creepspawning triggers:
  • SpawnStrongT1 Equal to False
-Add this condition to the team 1 strong creepsspawning triggers:
  • SpawnStrongT1 Equal to True
-Add this condition to the team 2 normal creepspawning triggers:
  • SpawnStrongT2 Equal to False
-Add this condition to the team 2 strong creepsspawning triggers:
  • SpawnStrongT2 Equal to True
-the only thing left to do know is setting the booleans to true/false in the arena triggers:
  • Arena
    • Events
      • Time - Every 360.00 seconds of game time
    • Conditions
    • Actions
      • Set SpawnStrongT1 = false
      • Set SpawnStrongT2 = false
      • Unit - Pause all units
      • Set ArenaUnit1 = (Random unit from Team1)
      • Set ArenaUnit2 = (Random unit from Team2)
      • Set ArenaLoc1 = (Position of ArenaUnit1)
      • Set ArenaLoc2 = (Position of ArenaUnit2)
      • Set tempPoint = (Center of ArenaRegion)
      • Unit - Move ArenaUnit1 instantly to tempPoint
      • Unit - Move ArenaUnit2 instantly to tempPoint
      • Custom script: call RemoveLocation( udg_tempPoint )
      • Unit - Unpause ArenaUnit1
      • Unit - Unpause ArenaUnit2
      • Countdown Timer - Start ArenaTime as a One-shot timer that will expire in 100.00 seconds

  • Arena2
    • Events
      • Unit - A unit Dies
      • Time - ArenaTimer expires
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • ((Triggering unit) is A Hero) Equal to True
          • (Remaining time for DialogTimer) Less than or equal to 0.00
    • Actions
      • Countdown Timer - Pause ArenaTimer
      • Unit - Unpause all units
      • Unit - Move ArenaUnit1 instantly to ArenaLoc1
      • Unit - Move ArenaUnit2 instantly to ArenaLoc2
      • Custom script: call RemoveLocation( udg_ArenaLoc1 )
      • Custom script: call RemoveLocation( udg_ArenaLoc2 )
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (ArenaUnit1 is alive) Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ArenaUnit2 is alive) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: No winner of arena ...
              • -------- Punishment, put in jail, lose gold, etc --------
            • Else - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of ArenaUnit1)) + has won the arena battle)
              • Game - Display to (All players) the text: Team 1 creeps will be stronger until next arena battle
              • Set SpawnStrongT1 = true
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (ArenaUnit2 is alive) Equal to True
            • Then - Actions
              • Game - Display to (All players) the text: ((Name of (Owner of ArenaUnit2)) + has won the arena battle)
              • Game - Display to (All players) the text: Team 2 creeps will be stronger until next arena battle
              • Set SpawnStrongT2 = true
            • Else - Actions
 
Vulcano, you shouldn't ask for +Rep...
It's against the rules, ya know?

And why did you write it? Just right click on the trigger and "Copy As Text"...
 
-HeroesTeam1 is just team1 but i got it from other thread , thats why names are different

-Just choose a player from team 1 at the place of "Some player in Team 1"
Example:
Team1: red, blue -> select ally of Player red or ally of player blue
Team2: purple, yellow -> select ally of Player purple or ally of player yellow

It just a condition to check that the hero is owned by a player of team1 / team 2

if he chose ally of player red for example he cant get player 1 owned hero for arena i wud recommend to use enemy of player from team 2 for team 1 and enemy of player from team 1 for team 2
so if u set ally of player 1 then player 1 is left out (i think thats bug you were talking about)
I Suposed each team have 5 players in this example
  • Set Arena_Unit_1 = (Random unit from (Units owned by (Random player from (All enemies of Player 6 (Orange))) matching (((Triggering unit) is A Hero) Equal to True)))
  • Set Arena_Unit_2 = (Random unit from (Units owned by (Random player from (All enemies of Player 1 (Red))) matching (((Triggering unit) is A Hero) Equal to True)))
 
Last edited:
For the Team 1 and Team 2 , create 2 player groups in the variable editor.
Then run this trigger:
  • Start The Timer
  • Events
  • Map initialization
  • Conditions
  • Actions
  • Unit Group - Pick every unit in (Units in (Playable map area)) 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)) is A Hero) Equal to True
  • ((Picked unit) belongs to an ally of Some Player in Team 1) Equal to True
  • Then - Actions
  • Unit Group - Add (Picked unit) to HeroesTeam1
  • Else - Actions
  • Unit Group - Pick every unit in (Units in (Playable map area)) 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)) is A Hero) Equal to True
  • ((Picked unit) belongs to an ally of Some Player in Team 2) Equal to True
  • Then - Actions
  • Unit Group - Add (Picked unit) to HeroesTeam2
  • Else - Actions
Camera - Pan Camera at player field select:
-Conversion - convert player index to player
-Click on the "1" choose for loop Integer A

It's an arena, you can't pickup units at initiliazation and put it in a group, before they are selected.
 
I mean, if it is an arena, you should pick a Hero somehow (via tavern or via circles or whatevar) so this trigger runs at map-initiliazation (the trigger at my previous post .. which is exactly seconds after all players load the map), so at this point, none of the players will have a unit (eg. Hero) and trigger will not work.

My suggestion is, when a player picks a hero (no matter tavern or circle), add hes Hero into the specified team, then turn on the Duel triggers.

The trigger submitted in the previous posts, uses a lot of If/Then/Else which is not recommended.
Learn to use it properly before putting it anywhere.
 
Well, no, it still better to add it when it is selected/picked/buyed
Use trigger that runs at initiliazation to create the teams for the players (eg. Team 1/Team 2), then turn on the trigger for selection, and then turn on the trigger for duels.

  • Melee Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players matching ((((Matching player) controller) Equal to User) and (((Matching player) slot status) Equal to Is playing))) and do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked player) is an ally of Player 1 (Red)) Equal to True
            • Then - Actions
              • Player Group - Add (Picked player) to team_1
            • Else - Actions
              • Player Group - Add (Picked player) to team_2
-Picking all players in-game that are Users (not Computers) and are playing.
-All players which are ally of Player 1(Red) are put in Team_1
-Else, players that are enemy of Player 1(Red) are put in Team_2


Then you can turn on the triggers for selection:
-If selection is like in DotA (eg. via taverns) you should use constant regions, and make a trigger:
  • Selection
    • Events
      • Unit - A unit enters (Region <gen>)
    • Conditions
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ((Owner of (Entering unit)) is an ally of Player 1 (Red)) Equal to True
        • Then - Actions
          • Unit Group - Add (Entering unit) to Team_1_Heroes
        • Else - Actions
          • Unit Group - Add (Entering unit) to Team_2_Heroes
Same as in the first trigger, here we pick units that enter a specified region
-Units that are ally of Player 1(Red) goes in Team_1_Heroes (this is a unit-group)
-Units that are enemy of Player 1(Red) goes in Team_2_Heroes (this a unit group too)

If selection is via Circle of Powers, you could use the same system for every region
with a little bit more actions and conditions.

So, if still can't understand it, check tutorials for the basics of triggering.
 
Status
Not open for further replies.
Back
Top