• 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.

Give Item to hero that shares player with the crafter

Status
Not open for further replies.
Level 24
Joined
Feb 28, 2007
Messages
3,479
Hello guys,

I am currently working on a map like Blizzards warchaser, anyways. I have a blacksmith which can craft items for your hero to aid you in your cause. Let's say that you have the required materials and craft an Iron Sword, I want the sword to directly be given to the hero that is owned by the same player as the blacksmith. So I use the trigger:
  • Hero - Create Claws of Attack +15 and give it to "What to put here?"
I wonder, what to put in "What to put here?" so that the hero acquires the item, thank you.
 
Level 17
Joined
Apr 13, 2008
Messages
1,608
Hmm okay. A simple example:
Imagine memory like an empty house. And the data they store is the person who lives in the house.
So when you want to refer to the person you have business with you refer to him by his address.
In reality variables are just pointers, so in this example's case just the addresses of the houses.

But when you are working with a lot of variables with the same type which are logically connected to each other somehow you use arrays.

Imagine arrays like streets. Instead of giving unique names to all houses make things simpler: let's organize them into one street, so they have only one name. How do you refer to these houses individually then? Give them street numbers.


What you need here is a Unit Type array with a size of the maximum players of your map.
You can create variables in the variable editor which is inside of the Trigger Editor.

You set variables with the action: Set Variable.

When you create the player's hero insert this line into that event:
  • Set TheNameOfYourUnitArray[(Player number of (Triggering player))] = (Last created unit)
I'm not sure if it helps. I think that tutorial has a pretty understandable language so if it's still not clear read the tutorial again and try to experiment a little on your own.
 
Last edited:
Status
Not open for further replies.
Top