HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Hero Tavernish Help...

07-15-2008, 12:46 AM#1
Arik
Hello, I'm new to these forums, and I have a question regarding how to make a trigger that does the following:
  • Removes a hero from the hero tavern when bought by any player.
  • Makes a hero available again when a player controlling a hero repicks
If this sounds familiar to some of you, it is based off of the triggers from AoS maps like Dota. I liked the way the triggers worked, so I decided to make an altered version of it that better suits my needs.

I know that JASS is an advanced scripting language (or something of that sort) for Warcraft 3, but it's something I don't understand. Thus, I would prefer help via GUI commands.

I've gotten the removing the hero part down, but I still have the following problems:
  • The heroes will not become avalible at the hero tavern after the person owning the hero repicks.

Here's what I've got so far:
Trigger:
Remove Troll Stalker
Collapse Events
Unit - A unit enters Spawn <gen>
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Troll Stalker
Collapse Actions
Neutral Building - Remove Troll Stalker from all marketplaces
How would I fix my above problems? Examples along with explanations would be appreciated!
07-15-2008, 07:15 AM#2
Flame_Phoenix
You should really read my tutorial for begging, it will help.
Also, you need some events ..
07-15-2008, 08:57 AM#3
Arik
There, I added in lots of spaces and bullets...
07-15-2008, 09:14 AM#4
Flame_Phoenix
MMm, maybe this way of think can help:

Event
- Unit sells a unit (a Tavern per example)
Condition
- Selling Unit is Tavern bla bla abl
Action
- Remove Sold Unit from tavern
- Move Sold unit to some position in map

Then, when we do repick:

Event
- A player types a chat message containing "repick" as an exact match
Action
- Remove hero that player has
- Add the heroe the player had to all taverns so people can buy it
- Give gold to player
- Allow player to buy new hero
07-15-2008, 09:26 AM#5
Alexander244
A potentially easier way is by changing the availiability:
Make unavailiable:
Actions
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Player - Limit training of (Unit-type of (HERO)) to 0 for (Picked player)
Make availiable:
Actions
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Player - Limit training of (Unit-type of (HERO)) to 1 for (Picked player)
07-15-2008, 01:12 PM#6
Arik
Ok, Alex's actions came in help. The problem is, I do not know how to get those actions to work. This is the same problem as before, except I have a more efficient actions. I need help with the conditions and events still...
07-15-2008, 01:18 PM#7
Alexander244
You'll probably want to make a unit array. When a hero is selected, set the array slot of the triggering players number to the hero.
When a player types "-repick" the condition is that the array slot for that player does not equal no unit.
Then run the make availiable actions followed by removing the hero unit.
07-15-2008, 01:22 PM#8
Flame_Phoenix
The first trigger should can be something like this:
Trigger:
Buy Hero
Collapse Events
Unit - A unit Sells a unit
Collapse Conditions
(Unit-type of (Selling unit)) Equal to Tavern
Collapse Actions
Neutral Building - Remove (Unit-type of (Sold unit)) from all marketplaces
Unit - Move (Sold unit) instantly to (Center of (Playable map area))

The second, depends on your map's architecture.
I would advise you to use a global unit array, to keep track oh which hero the player has.
07-15-2008, 01:49 PM#9
Anitarf
Quote:
Originally Posted by Arik
Here's what I've got so far:
Trigger:
Remove Troll Stalker
Collapse Events
Unit - A unit enters Spawn <gen>
Collapse Conditions
(Unit-type of (Triggering unit)) Equal to Troll Stalker
Collapse Actions
Neutral Building - Remove Troll Stalker from all marketplaces
You'll be needing a new trigger for every unit this way, that's no way to go about coding a map. How about trying something more generic, like this?

Trigger:
Remove Hero
Collapse Events
Unit - A unit enters Spawn <gen>
Collapse Conditions
Boolean - unit classification check - (Triggering unit) is a (Hero) Equal to True
Collapse Actions
Neutral Building - Remove (Unit-type of (Triggering unit)) from all marketplaces

I'm not sure if you can re-add the unit to marketplaces after you remove it this way, so I'd try the code Alexander244 suggested instead. Then, the repick code is easy, it would look something like this (I'm writing this from my head, so actual code may be worded differently):

Trigger:
ReAdd Hero
Collapse Events
Player - chat message - "-repick"
Conditions
Collapse Actions
Collapse Unit Group - Pick every unit in (Units owned by (Triggering player) matching ((Matching unit) is a (Hero) Equal to True)) and do (Actions)
Collapse Loop - Actions
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Player - Limit training of (Unit-type of (Picked unit)) to 1 for (Picked player)
Unit - Remove (Picked unit)
07-16-2008, 12:05 AM#10
Arik
Quote:
Originally Posted by Alexander244
You'll probably want to make a unit array. When a hero is selected, set the array slot of the triggering players number to the hero.
When a player types "-repick" the condition is that the array slot for that player does not equal no unit.
Then run the make available actions followed by removing the hero unit.
I tried to do this, but I do not understand variables that well...(the tutorial didn't really help either) Could you set it up step by step or some other way that makes it easier for retards like me to understand.
07-16-2008, 04:06 AM#11
Gorman
Variables and Arrays

ok, Variables are just stored values, like in algebra. And integer variable could be called "NumberOfLives" in a Tower Defense, and may have a value of "15". If i wanted to use it in a trigger to decrease the number of lives the action would be something like this:
Trigger:
Set NumberOfLives = (NumberOfLives - 1)
So thats how a variable is set, you can then use it in other actions that involve integers, or using the "convert" action you can use it in reals (reals are integers but they can have decimal points)

An array is a set of Variables that are easier to navigate. so insted of having "NumberOfLivesPlayer1" and "NumberOfLivesPlayer2", all the way up to Player 12, you could just have "NumberOfLives" in an Array of size 12. This means there is 12 different NumberOfLives variables, and they are only different by the number at the end in square brackets [].
If i wanted to decrease the lives of a triggering player then i could use:
Trigger:
Set NumberOfLives[(Player number of (Triggering player))] = (NumberOfLives[(Player number of (Triggering player))] - 1)
This really helps to compress code, insted of having to use "If, Then, Else" to find out which variable needs to be changed.



So, in your case you would need something like this:

SpawnHero

Spawn Hero:
SelectHero
Collapse Events
Unit - A unit enters Spawn <gen>
Collapse Conditions
((Triggering unit) is A Hero) Equal to True
Collapse Actions
Set CurrentHeroType[(Player number of (Owner of (Triggering unit)))] = (Unit-type of (Triggering unit))
Set CurrentHero[(Player number of (Owner of (Triggering unit)))] = (Triggering unit)
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Player - Limit training of CurrentHeroType[(Player number of (Owner of (Triggering unit)))] to 0 for (Picked player)
Player - Limit training of Heroes to 0 for (Triggering player)



And then for the repick trigger
Repick


Repick:
RepickEnable
Collapse Events
Player - Player 1 (Red) types a chat message containing -Repick as An exact match
Player - Player 2 (Blue) types a chat message containing -Repick as An exact match
Player - Player 3 (Teal) types a chat message containing -Repick as An exact match
Player - Player 4 (Purple) types a chat message containing -Repick as An exact match
Player - Player 5 (Yellow) types a chat message containing -Repick as An exact match
Player - Player 6 (Orange) types a chat message containing -Repick as An exact match
Player - Player 7 (Green) types a chat message containing -Repick as An exact match
Player - Player 8 (Pink) types a chat message containing -Repick as An exact match
Player - Player 9 (Gray) types a chat message containing -Repick as An exact match
Player - Player 10 (Light Blue) types a chat message containing -Repick as An exact match
Collapse Conditions
CurrentHeroType[(Player number of (Triggering player))] Not equal to No unit-type
Collapse Actions
Unit - Remove CurrentHero[(Player number of (Triggering player))] from the game
Collapse Player Group - Pick every player in (All players) and do (Actions)
Collapse Loop - Actions
Player - Limit training of CurrentHeroType[(Player number of (Owner of (Triggering unit)))] to 1 for (Picked player)
Player - Limit training of Heroes to 1 for (Triggering player)



And so there you go, if you have any questions plz ask.
07-20-2008, 06:36 AM#12
Arik
Ok, I got the spawn trigger to work right. But the repick one, no so much...When I repick It removes the unit from the map, and removes all heroes from the hero tavern. I'm assuming the problem is the variables? If there are 16 heroes, so i set variable size to = 1? or 16? Or is the problem something else entirely?
07-20-2008, 10:48 AM#13
Gorman
Well, the 'Variable size' (hence known as 'Array size') should be for each player, so if you haver 12 players, it should be size twelve.

Sorry, but i failed to mention the variables i used:
Variables:
NameTypeSizeDescription
CurrentHeroUnitThe same as the number of playersThis is the current hero the player has, ie the hero that was picked from the tavern, and is removed when the repick trigger fires
CurrentHeroTypeUnit TypeNumber of playersThis is the hero type of the current hero the player has

The problem you had was either that you mixed up the variables, or you didnt realise what exactly they were (my fault )
07-20-2008, 11:05 AM#14
Alexander244
On repick, you'll need to set the availiability of the hero to n+1, where n is the number of times the player has had a copy of that hero.

So just set it to some massive number, and you're sorted.
07-20-2008, 01:36 PM#15
Gorman
What?

The avallibility is never changed, it just has the training limited, then un-limited.

Why would you use that? The hero is already removed from the game, ie destroyed for ever, so they have 0 of that unit, making them able to build another one.