• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece!🔗 Click here to enter!

Give Item to hero that shares player with the crafter

Status
Not open for further replies.
Level 24
Joined
Feb 28, 2007
Messages
3,480
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,597
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