HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Advanced Trigger question (i think :P)

02-12-2003, 01:07 PM#1
Lofwyr
Does anyone know how to make a trigger that goes off when a unit uses a specific item or ability on a specifical type of unit?
I'd be really gratefull for some advice, it is the only thing i need to do in order to finish this map of mine.
02-12-2003, 01:47 PM#2
PitzerMike
Event: Unit Owned by Player X is issued an order targeting an object.

Condition: in custom text:

function Trig_Your_Trigger_Conditions takes nothing returns boolean
if GetUnitTypeId(GetEventTargetUnit()) == 'IdOfYourUnit' then
if GetIssuedOrderIdBJ() == String2OrderIdBJ("YourOrder") then
return true
endif
endif
return false
endfunction

For IdOfYourUnit fill in the 4 letter code of the unit type the targeted unit should be
for YourOrder use the order string of the ability(example: "attack")

Actions: whatever you want
02-12-2003, 01:49 PM#3
Electromancer
Theres a event, Specific Unit event, that you just gotta set to the unit and uses an item. Set a Specific unit event that has that same unit but with order targeting unit. For conditions put in Type of target unit equal to whatever. Now, for the actions, do a if/then/else statement, which is at the top. Do if item type of item being manipulated equal to whatever, do action, else do nothing. And do an if/then/else for the spell too, if issued order equal to order(spell*) then do action else do nothing.
*this means you gotta get the exact order for the spell.

If you need the exact order for a spell, tell me and ill get it, or if you wanna get it, look in Xfunc.txt, were x is the race of the spell. But if you dont know how that works, just post up the order.

Meh, he beat me by a few seconds. But my way is for the more common map maker, and is easier for a new person to understand.
02-12-2003, 03:09 PM#4
Lofwyr
thanks both of you :]
The second solution was nice and easy, i think i'll use that for now.
But i guess i should learn to do some scripting if i want to be able to make something advanced in the future.
02-12-2003, 03:15 PM#5
Electromancer
Well, if you get UMSWE you can make advanced without needing to know scripting. But you still gotta know whats what, so i guess it would be a bit advanced still.
02-12-2003, 04:41 PM#6
Lofwyr
the UMSWE download seems to be broken, either that or there is some kind of spyware funking up my explorer again.
Because i can't download it from the server in any way.
And i did i few quick searches on a few webcrawlers but none of them came up with anything that seemed to be related to the UMSWE that is suposed to be here.
02-12-2003, 06:03 PM#7
Electromancer
www.umsmaps.com normally carries a good supply of it. But you gotta get it before it runs out, which will probably happen around never.

Just to make sure i didnt confuse you, the thing will never run out.
02-12-2003, 06:05 PM#8
Lofwyr
something i've been looking for but cannot figure out is:

How can i make a condition that targets a unit whose life is down to a certain percentage of its max life? i only found random percentages and a modular (and my head hurts just by mentioning a modular.).

thats the last thing that i need in order to finish the trigger.

many thanks to you ppl for helping me out with my first uncertain steps towards wc3 map editing :]
02-12-2003, 06:41 PM#9
Electromancer
Well, theres a value option that i believe has a maximum of 100. I believe this is percentage. But if you cant figure anything out, just use random int from max life you want it to have to minimum. If it matches any of those it works.