• 🏆 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!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Steal Ability

Status
Not open for further replies.
Level 5
Joined
Sep 14, 2004
Messages
66
Can someone help me creating an ability that steals a random item from a hero. I really need this one and I don't have that much JASS knowledge yet.

EDIT: Now I it's possible to make this ability, I want it to have four levels and cost 250 mana to cast. The only difference between the levels is the cooldown, which should be 300,240,180,120
 
Level 5
Joined
Jun 21, 2004
Messages
129
There is a trigger that you can use to make a unit drop an item in a fixed slot, just change the fixed number to a random number between 1 and 6. Then use another action that gives the item to the casting unit. Only thing with this is it can some times fail for targeting an empty slot.
 
Level 5
Joined
Sep 14, 2004
Messages
66
Well

That actually sounds good that it can miss sometimes, it would be way to good if it always succeded. Anyway, I know how to do that with triggers but how do I make it an ability out of that?

Please excuse my noobism :)
 
Level 11
Joined
Jul 20, 2004
Messages
2,760
Can't this actually be solved only with triggers? Umm... IMO you first need to check if the inventory isn't empty. If it is empty, the spell shouldn't work. You can make two triggers. One which checks, and one which actually DOES the spell. The one which checks should have "Unit begins casting an ability" and the other one should start with "Units starts the effect of an ability". If the inventory is empty, it should bring an error message (Use game and write it with yellow) and the caster should be forced to stop. You can also add "error" sound. The second trigger is longer to make. You should first take a random number between 1 and 100 and if it is <= than "rate of success" then you do nothing, else you should write a message like "Spell failed" or not even this but Skip the remaining actions.

Going to the success part, take a random number between 1 and 6. Now, if it is equal to 1 you take slot one and check. But... I'm starting ot get stuck here because if it is empty... You should check another slot.. But... Maybe there is a way to check which slots are not empty or oh well, leave it as it may because it would not make the spell THAT powerful. Hope it helps, at least what I knew as well. ;)
 
Level 5
Joined
Jun 21, 2004
Messages
129
Event:
A unit starts the effect of an ability
Condition:
Ability being cast equal to Steal (i would use a dummy frost nova)
Event:
Drop item from item slot (random number 1-6) from target of ability being cast
(then the rest)
 
Status
Not open for further replies.
Top