• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

[Trigger] Problems with ar mode

Status
Not open for further replies.
Level 2
Joined
Feb 12, 2009
Messages
13
  • Manual Hero Pick
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
      • Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
      • Game - Display to (All players) the text: (A player has chosen + (Name of (Sold unit)))
      • Selection - Select (Sold unit) for (Owner of (Sold unit))
and

  • All Random Command
    • Events
      • Player - Player 1 (Red) types a chat message containing -ar as An exact match
    • Conditions
    • Actions
      • Trigger - Turn off Random Command <gen>
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Set Random_Hero = (Random integer number between 1 and Random_Count)
              • Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for (Player((Integer A))) at ((Player((Integer A))) start location) facing Default building facing degrees
              • Selection - Select (Last created unit) for (Owner of (Last created unit))
              • Game - Display to (All players) the text: (A player has randomed + (Name of (Last created unit)))
              • Player - Add -425 to (Player((Integer A))) Current gold
              • Set Random_Data[Random_Hero] = Random_Count
              • Set Random_Count = (Random_Count - 1)
            • Else - Actions
              • Do nothing
  • Map Initialization
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Set Player 1 (Red) Current gold to 750
          • Player - Set Player 2 (Blue) Current gold to 750
          • Camera - Pan camera as necessary for Player 1 (Red) to (Center of Region 002 <gen>) over 0.00 seconds
          • Camera - Pan camera as necessary for Player 2 (Blue) to (Center of Region 002 <gen>) over 0.00 seconds
      • Set Total_Heroes = 8
      • Set Random_Count = 8
      • Set Hero_Array[1] = Blood Mage
      • Set Hero_Array[2] = Mountain King
      • Set Hero_Array[3] = Nazgul
      • Set Hero_Array[4] = Paladin
      • Set Hero_Array[5] = Ice Lord
      • Set Hero_Array[6] = Far Seer
      • Set Hero_Array[7] = Dreadlord
      • Set Hero_Array[8] = Priestess of the Moon
      • For each (Integer A) from 1 to 8, do (Actions)
        • Loop - Actions
          • Set Random_Data[(Integer A)] = (Integer A)
Maybe I didn't need to post 3 triggers but I want to make sure that someone will realize how to fix this problem.

Ok guys here is the problem:When I type -ar I always get same hero.My opponent also get same hero(not same as me).I always get Far Seer and opponent gets Blood Mage.1v1.Also,when we get that heroes they aren't removed from tavern,and we can pick any hero again.My questions are: Why we are getting same heroes always,why they aren't removed from tavern,how I can set 1 hero per player(so player can't have 2 heroes).And how to fix this?Thanks in advance.

:/
 
Level 17
Joined
Jun 17, 2010
Messages
2,275
For one, theres nothing under your player group in the first trigger, you make a group and then put nothing under loop actions, so that trigger is pretty much useless. Should be like this
  • Manual Hero Pick
    • Events
      • Unit - A unit Sells a unit
    • Conditions
      • ((Sold unit) is A Hero) Equal to True
    • Actions
      • Player Group - Pick every player in (All players) and do (Actions)
        • Loop - Actions
          • Player - Make (Unit-type of (Sold unit)) Unavailable for training/construction by (Picked player)
          • Game - Display to (All players) the text: (A player has chosen + (Name of (Sold unit)))
          • Selection - Select (Sold unit) for (Owner of (Sold unit))

The reason when u random, and it doesnt remove from tavern is because instead of buying from tavern, your creating a whole new unit, so the tavern is never used. So when you say "Create 1 hero...." your not starting up your first trigger, because its just creating not buying. Also to limit 1 per player in gameplay constants it says "Limit 1 per players tech type" something like that, it might be in gameplay interface, and in the heroes tech tree, on the second techtree item it usualy says the second tech teir of that race, make sure theres something there or people can buy 2 heroes.
 
Level 2
Joined
Feb 12, 2009
Messages
13
For one, theres nothing under your player group in the first trigger, you make a group and then put nothing under loop actions, so that trigger is pretty much useless. Should be like this


The reason when u random, and it doesnt remove from tavern is because instead of buying from tavern, your creating a whole new unit, so the tavern is never used. So when you say "Create 1 hero...." your not starting up your first trigger, because its just creating not buying. Also to limit 1 per player in gameplay constants it says "Limit 1 per players tech type" something like that, it might be in gameplay interface, and in the heroes tech tree, on the second techtree item it usualy says the second tech teir of that race, make sure theres something there or people can buy 2 heroes.



I limited 1 hero per player but I still have problem with tavern.Heroes aren't disappearing from tavern.I understood what you said but I don't know how to write that in trigger(I am newbie).Also,I still have problem with getting same hero every time,can't understand why is that happening.
 
Level 2
Joined
Feb 12, 2009
Messages
13
  • All Random Command
    • Events
      • Player - Player 1 (Red) types a chat message containing -ar as An exact match
    • Conditions
    • Actions
      • Trigger - Turn off Random Command <gen>
      • For each (Integer A) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Player((Integer A))) slot status) Equal to Is playing
            • Then - Actions
              • Set Random_Hero = (Random integer number between 1 and Random_Count)
              • Unit - Create 1 Hero_Array[Random_Data[Random_Hero]] for (Player((Integer A))) at ((Player((Integer A))) start location) facing Default building facing degrees
              • Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Player((Integer A)))
              • Selection - Select (Last created unit) for (Owner of (Last created unit))
              • Game - Display to (All players) the text: (A player has randomed + (Name of (Last created unit)))
              • Player - Add -150 to (Player((Integer A))) Current gold
              • Set Random_Data[Random_Hero] = Random_Count
              • Set Random_Count = (Random_Count - 1)
            • Else - Actions
              • Do nothing

After I imported that,it works but it only removes hero that I get(Player 1). :/
And I still have problem with getting same hero every time :/

Looks like I am doing something wrong :/ +rep for all your help anyway
 
Level 13
Joined
May 11, 2008
Messages
1,198
it's simple. i thought i had answered already. sorry.
you need to use the math option and get a random integer. you're making the "random" integer be the integer of the player id. that's not what you want to do. that's for a mode where everyone has a preset hero. that's not all random. that's why your mode isn't working. you implemented the wrong integers.
 
Level 2
Joined
Feb 12, 2009
Messages
13
it's simple. i thought i had answered already. sorry.
you need to use the math option and get a random integer. you're making the "random" integer be the integer of the player id. that's not what you want to do. that's for a mode where everyone has a preset hero. that's not all random. that's why your mode isn't working. you implemented the wrong integers.

You are hell right. :/ I will just forget about those modes for now because it is just hard for me.Thanks anyway bro :/
 
Level 13
Joined
May 11, 2008
Messages
1,198
You are hell right. :/ I will just forget about those modes for now because it is just hard for me.Thanks anyway bro :/
  • //
  • Unit - Create (Random integer number between 1 and 10) Footman for Player 1 (Red) at (Center of (Playable map area)) facing Default building facing (270.0) degrees
  • //
  • //
it's right there in the gui. but you might be right to ignore ar and other modes until you have more of the map done.
i would post the full trigger but i can't be bothered to make a gui unit array and all that
 
Level 2
Joined
Feb 12, 2009
Messages
13
try...

Unit - Create 1 Hero_Array[random number between 1 and 8]

Holy....That worked bro :D Now we aren't getting same hero,yay :D +rep

So,one more problem is left: Only my hero gets removed from tavern when I type ar,hero that other players get stays in tavern :/ If nobody can help it is ok because I should really start adding modes when I make some better map,but this is my test map to learn some things before big projects..
 
Level 13
Joined
May 11, 2008
Messages
1,198
won't you read over your own code? or did someone else type this up?

whatever. do change this one:
  • //
  • Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Player((Integer A)))
  • //change to this:
  • Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Player Group((All players)))
but, actually...we should redo the entire thing.
what we really need to do for -ar is make a unitpool
because if we want to run -ar for all players get random...Player - Make (Unit-type of (Last created unit)) Unavailable for training/construction by (Player Group((All players))) line is meaningless.
hero is selected through trigger, not through training/construction from tavern. thus it doesn't mean anything.

instead we need the function remove unit from unitpool. there might be another odd way to do this very thing but i don't know about that. this way is most simple. but i think you need to use custom text/jass to do unitpools

there is already a site tutorial on itempools unitpools are exactly the same thing. everything is the same except it handles units instead of items.
http://www.hiveworkshop.com/forums/jass-ai-scripts-tutorials-280/itempools-guide-35180/
 
Status
Not open for further replies.
Top