Hey,
I've recently been added back to the development team of a map called Showdown Frenzy, and was looking at learning JASS sometime, but figured I'd start off learning basic triggering first.
I wanted to make an item that would increase the hero's model size when owned, so would anyone be able to tell me how to do that? And if it involves variables, would you be able to explain that, too? I've had very limited experience with the trigger editing in World Editor, so I don't know too much either way.
Thanks!
P.S. I'm using NewGen WE which includes Grimoire, if that matters any.
In your object editor take a campaign item, for the sake of this I will pick on the Moon Key. The moon key item does nothing in and of itself. It is more or less a place holder in the bag of the carrying unit.
Copy and paste it in the item editor. It may take a second but what will happen is that a copy of that moon key will end up near the bottom of your item menu (left hand side).
You may change the icon, the name to what ever you want. I will call it Moon Key.
I suppose you will need two triggers, one for the item picked up and one for the item being dropped or lost.
-
Moon Key 1
-
Events
-
Unit - A unit Acquires an item
-
Conditions
-
(Item-type of (Item being manipulated)) Equal to Moon Key
-
Actions
-
Animation - Change (Hero manipulating item)'s size to (150.00%, 150.00%, 150.00%) of its original size
When the hero or any hero picks up this item the units size will become 150% larger in all directions. Now one can stretch the unit - each percentage is in a directions as you look face on to the unit. The first is its length (front to back) the second is its Width (side to side) and the third is its height (how tall it will be)
This second trigger is when the unit drops an item and that item being the Moon Key:
-
Moon Key 2
-
Events
-
Unit - A unit Loses an item
-
Conditions
-
(Item-type of (Item being manipulated)) Equal to Moon Key
-
Actions
-
Animation - Change (Hero manipulating item)'s size to (100.00%, 100.00%, 100.00%) of its original size
If you want to set the key as a variable, what you need to do is either place it in the editor and then select it when using the Set Variable Function, or you need to create it.
Not to confuse but simply because I have a handy trigger that sets an item with a variable in my map I am using to create these triggers for you:
-
Murloc death
-
Events
-
Conditions
-
(Dying unit) Equal to Murlock
-
Actions
-
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
-
If - Conditions
-
(Killing unit) Equal to HERO
-
Then - Actions
-
Trigger - Turn off (This trigger)
-
Item - Create Heart of Aszune at (Position of (Dying unit))
-
Item - Set the custom value of (Last created item) to 600
-
Set Heart = (Last created item)
-
-------- * * * --------
-
Hero - Give Heart to HERO
-
Game - Display to (All players) the text: |c00FFFF00 This Mur...
-
Quest - Change the description of Furion_key to You have the heart,...
-
Trigger - Turn on Q02 C <gen>
-
Wait 7.00 seconds
-
Game - Display to (All players) the text: |c00FFFF00 Yes, its...
-
Else - Actions
-
Wait 45.00 seconds
-
Unit - Replace (Triggering unit) with a (Unit-type of (Triggering unit)) using The new unit's max life and mana
-
Set Murlock = (Last replaced unit)
Above the line -------- * * * -------- is what you might want to use, below that is specific actions that take place in my trigger. In this case I am using the Heart of Aszune - For you that would be your customized Moon key.
In the trigger editor I made 2 variables. One is an item variable the other is the hero variable.
There is a yellow X at the top, click on that and your variable editor opens up. Click on edit and create a new variable.
You have two basic fields, one is for name, one is for type - Then you have arrays and a true/false - for your item you should not have to worry about those other.
In the Field name I used Heart - you can use any name you want for yours. Only letters and numbers and no space is allowed, you can use the underscore (_) for word breaks EXAMPLE:
Heart_Of_Aszune
The second Field (type) is set as item.
From this trigger what will happen is that when a specific unit dies (Murlock is a variable name I assigned to a unit already on my map) the item I want to be made is created. I set the item variable to Heart - simply because I want that heart to trigger other actions later down the road.
I do have a second variable in my trigger HERO. Since I have a computer player that could be in the area with my player hero and could pick up the item, I give the heart directly to my HERO.
The name is HERO the variable type is 'unit' I assigned my variable to my hero way back at the post cinematic where my hero unit was created. That made it far, far easier to trigger a lot of events, (quests, enter/leave regions) and check the conditions making certain that only when the hero is as in the trigger above the killing unit, things take place.
I used an if/then/else multiple functions, one being if the killing unit is not the hero then the Murlock (which is a variable) will be respawned in a minute.
And the last variable is named Murlock its type is 'unit' and is the triggering unit. Note if the murloc is killed and it was not the hero who kills it then 45 seconds later a 'new' murloc will be spawned awaiting for the HERO to kill it to collect the item.
Using the variables makes it far easier to keep track of who is dying, who is getting what, and what is being used/created/killed, blah blah blah.
In this case I did not use the leak clean ups since I only have three dying units who can, at most, only die 3 times each. If I had a whole bunch of dying units who are creating points I would add in the lines:
-
Set MPoint = (Position of (Triggering unit))
-
(Replace unit & set unit goes here)
-
Custom script: call RemoveLocation( udg_MPoint )
In this case MPoint is the name of another variable which is of the type 'point'.