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

[Trigger] Hey there guys! I need help in a trigger.

Status
Not open for further replies.
Level 2
Joined
May 27, 2014
Messages
7
Hey, I was tring to creating a new "resourse" (such as food, knowledge, minerals etc) in warcraft, so... I was think to put this new "resourse" as a item but how I do (using triggers) to make this items disapear when are used? And how I do to make units unmakeble when I dosent have "resourses" enough?


Hey guys I sorry for my very bad english, as you can see I not a American (USA) native. I very thank your patience.


Have a very good life.
 
Level 28
Joined
Sep 26, 2009
Messages
2,520
You must keep track of the resources - the best way is to do it via variable (or an array if more player will use those resources).
Then it is a simple matter of checking if you have enough of your resources when building begins training some unit.

Making an item disappear - again, you should save the item into variable. Then you just remove the item from the game.
 
You have an integer[array] "newRes" which represents the amount of the new resource for each player.

So, at first you have to store an integer (newRes costs) for each unit into a hashtable. (use unitType of each unit as key)

Then whenever a building starts to train an unit you can load this "newRes costs" of hashtable, because you can access to unitType of trained unit. And if costs > newRes[playerIndex] you cancel the training.

Better would even be to abort the training immediatly the training whenever the building gets the order to train an unit which too high costs, but idk atm how you would cancel the training if the "train position" is not the 1st.

Why do you want use items for it? I would use something like a multiboard for it.
 
Level 2
Joined
May 27, 2014
Messages
7
Thank you soo much!! I beginning to understend! You know ware I can find a tutorial about this? I tried to search here and in youtube and didnt find... but I will try here to understend, thank you both soo much.
 
Level 2
Joined
May 27, 2014
Messages
7
Guys, I didt get how to use and iteger or what kind of variable I must aply to have this new resource? I are very noob in map creation, but its a very funny thing!! Thank you soo much!!
 
Yes, using an integer does make the most sense for a resource because it doesn't accept decimal points.

No I have not found a tutorial only about adding a new resource, but maybe reading a tutorial about variables with array might help you: http://world-editor-tutorials.thehelper.net/cat_usersubmit.php?view=20023

Basicly you first have to think of an event for adding a new resource. I make a simple example, that if a unit gets killed, the owner of KillingUnit gets +1 NewResource. (newRes)


Event:
Unit - A Unit Dies

Cond:

Action:
Set tmpInteger = PlayerNumberOf(OwnerOf(KillingUnit))

Set newRes[tmpInteger] = newRes[tmpInteger] + 1

tmpInteger: is only a help integer to simplifly the actual arithmetic operation
newRes[array]: is the integer[array] that represents the amount of the new resource for each player


You also could test this and also add a debug message to display the newRes[tmpInteger] to know if it worked.

If you get it to work the next step probably would be to visualize the new resource so you can observe it's amount at any time.

For this you could use different methods, but using a multiboard maybe makes the most sense for me. (http://www.hiveworkshop.com/forums/general-mapping-tutorials-278/all-about-multiboards-84942/, http://world-editor-tutorials.thehelper.net/multiboard.php)
 
Status
Not open for further replies.
Top