• 🏆 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!

Item steal

Status
Not open for further replies.
Level 8
Joined
Mar 12, 2008
Messages
437
Hi, I want either of two versions of a spell, I have tried but coulnd't find the solution.

One version is passive and gives every attack a chance to steal an item carried by the attacked unit. The other one is active and steals an item from the target when used.

Can you help me, please? Thank you. By the way, I did search, but I didn't find anything
 
Level 8
Joined
Mar 23, 2007
Messages
302
i will do thoes for y, it shouldnt be that hard.
But as always,
PLS give me more information, how many levels?
Whats the Chances?
Does it steal Randomly or always Slot X?
or whatever, like Rang of the Active Spell?????

Greets Equal
 
Level 8
Joined
Mar 12, 2008
Messages
437
It's one level, and the chance is 1 out of 6 for all slots (~17 %), so that if a hero has 4 health potions and two blanks, and the spell is applied, there will be a 100 % chance and not a 67 % chance to get an item. I want to adjust it later as I balance it though. and not an orb effect; I still want abilities like poison to work. I do not really understand what you mean with rang..

By the way, I'd prefer the passive version.
 
Level 8
Joined
Mar 23, 2007
Messages
302
hm so do you want it to be ACTIVE or PASSIVE?
or both version....?

with range i mean the maximal distanz between the target and its prey, witch , if it is to high, prevent that the spell works, forcing the unit to come closer for a successful cast. :wink:
 
Level 8
Joined
Mar 12, 2008
Messages
437
Oh, range, I didn't understand you when you missed the e.
I want it to be passive.

The only thing I can think of is something like:
event - a unit is attacked
condition - attacking unit equal to Boss
action - if/then/else
- random integer between 1 and 7 equal to 1

And then I can't think of anymore.
 
Level 16
Joined
Mar 26, 2004
Messages
569
What do you want to happen if the STEALING unit's inventory is full?

EDIT:
If STEALING unit's inventory is full, nothing will happen. If the random picked slot is EMPTY nothing will happen.
I added a floating text to notice when an item was stolen.

  • Item Steal Passive
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Level of Sleight of Hand for (Attacking unit)) Equal to 1
      • (Number of items carried by (Attacking unit)) Less than 6
    • Actions
      • Set Temp_Integer = (Random integer number between 1 and 6)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item carried by (Attacked unit) in slot Temp_Integer) Not equal to No item
        • Then - Actions
          • Hero - Create (Item-type of (Item carried by (Attacked unit) in slot Temp_Integer)) and give it to (Attacking unit)
          • Item - Remove (Item carried by (Attacked unit) in slot Temp_Integer)
          • Floating Text - Create floating text that reads (|cffffcc00 + ((Name of (Last created item)) + |r stolen!)) above (Attacking unit) with Z offset 0.00, using font size 8.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Set the velocity of (Last created floating text) to 64.00 towards 90.00 degrees
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the fading age of (Last created floating text) to 2.00 seconds
          • Floating Text - Change the lifespan of (Last created floating text) to 3.00 seconds
        • Else - Actions
          • Do nothing
 
Level 5
Joined
Mar 13, 2008
Messages
126
Hehe

u can. like this:
  • Tr 1
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set attacked = (Attacked unit)
      • Set attacking = (Attacking unit)
      • Trigger - Add to Tr 3 <gen> the event (Unit - attacked Takes damage)
      • Trigger - Turn on Tr 3 <gen>
  • Tr 2
    • Events
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Game - Display to (All players) the text: Attacked
ofcourse change the display action into whatever u need :thumbs_up:
also,add that chance trigger and all that stuff cause i am too lazy to do it,i just copy pasted this from my triggers collection :razz::razz::razz:
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
u can. like this:
  • Tr 1
    • Events
      • Unit - A unit Is attacked
    • Conditions
    • Actions
      • Set attacked = (Attacked unit)
      • Set attacking = (Attacking unit)
      • Trigger - Add to Tr 3 <gen> the event (Unit - attacked Takes damage)
      • Trigger - Turn on Tr 3 <gen>
  • Tr 2
    • Events
    • Conditions
    • Actions
      • Trigger - Turn off (This trigger)
      • Game - Display to (All players) the text: Attacked
ofcourse change the display action into whatever u need :thumbs_up:
also,add that chance trigger and all that stuff cause i am too lazy to do it,i just copy pasted this from my triggers collection :razz::razz::razz:

This is crap.
And what, the next time the unit that triggers the first trigger attacks, trigger 2 will be turned on again, with more events. And if the first attacked unit is than damaged, the trigger will fire and you basically come upon a bug.
Also it leaks as you will constantly add more events to it, causing lag.

Smiddle you have no problem using SkriK trigger.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
...
No it is not abusable in this situation as the computer does not know how to abuse anything ...
Once you get to know triggering a little better you will be able to see what is wrong with your triggers.
But for now I guess I will have to repeat myself in some more detail.
Lets say Unit A has some ability that will enable the first trigger for it(like the passive item steal).
It attacks unit B. Some event is added to trigger 2.
It attacks unit C. Some event is added to trigger 2.
It attacks unit D. Some event is added to trigger 2.
.
.
.
It attacks unit ZZZY. Some event is added to trigger 2.
It attacks unit ZZZZ. Some event is added to trigger 2.
It attacks unit ZZZZ. Some event is added to trigger 2.
It attacks unit ZZZZ. Some event is added to trigger 2.
.
.
.
It attacks unit ZZZZ. Some event is added to trigger 2.
.
.
.
It attacks unit ZZZZ. Some event is added to trigger 2.
It attacks unit ZZZZ. Some event is added to trigger 2.(yes all of the last ones are ZZZZ)

Lets count how much events trigger 2 has - simply put a lot. Each of these events takes some memory, and potentially it will not be usable by any way. This what is called a leak.
After time memory on the computer will start running low and will cause lag.
Not to say that each time you attack the same unit another event will be added to the trigger. That means 5 attacks on unit R and you have 5 more events in trigger 2.
This is for the leak part.
For the other part I will just give the example:
A attacks B. Event added in trigger 2.
A decides to stop attacking B and A starts attacking C. Some events are put in the trigger.
A continues to attack C and every time it does, trigger 2 is turned on. If while being on, another unit that is in the events of trigger 2(like B in this example) is damaged, it will cause the trigger to run, and will cause A to steal an Item from B while attacking C and not stealing any item from C.
 
Level 5
Joined
Mar 13, 2008
Messages
126
i must repeat myself too -.-
turn on/turn off trigger
that removes ZZZZ unit events^^
and i said for the 3rd time ADD F*CKING CONDITIONS
and what if someone needs it for something else and it wouldn't be used by computer?abusable
 
Level 5
Joined
Mar 13, 2008
Messages
126
Okay, Unit A attacks Unit B

Unit A has ability Steal Item

Trigger A(Unit is attacked) is fires first upon the attack of Unit A(since it checks for level of Passive Thunder Clap)

Trigger A adds a Buff to Unit or sets the custom value of Unit B

Trigger B(Unit is Damaged) is fires second(since Unit is Attacked comes first) upon the attack of Unit B(since it checks for the target to have the Buff or the specific value)

Trigger B does its things and removes the Buff or value

now the Unit is Attacked is not abusable since it only applies a Buff or gives value, and doesnt fire the Thunder Clap or deals any Damage

this was originaly wrote by ecco, i just edited some thingies...HAPPY NOW???(sorry for double-posting) :p
 
Level 11
Joined
Jun 21, 2007
Messages
505
  • Steal Item on an Attack
  • Events
    • Unit - A unit is attacked
  • Conditions
    • Level of (Sleight of Hand) of (Attacking unit) Equal to 1
    • Number of items carried by (Attacked unit) Not Equal to 0
  • Actions
    • If (random number between 1 and 3 equal to 1) then do Hero - give (item caried by (Attacked unit) in slot (random number between 1 and 6) to (Attacking unit)
    • Floating text - Create floating text ...at position of attacking unit and over it's height
    • If (NumberofFloatingTextsUsed equal to 8192) then do (Set NumberOfFloatingtextsused = 1) else do (Set NumberOfFloatingTextsUsed = (NumberOFloatingTextsUsed + 1))
    • Set Floating_Text_o_0[NumberOfFloatingTextsUsed] = (last cerated floating text)
    • Wait 3.00 seconds
    • Floating Text - Destroy (last created floating text)
  • Floating Texts Raise From the Ground
    • For each integer A from 1 to 8192 do (Floating Text - Change height <or whatever> of Floating_Text_o_0[NumberOfFloatingtextsUsed] = +1
 
Level 11
Joined
Jun 21, 2007
Messages
505
The creator of the thread said he'll use this way only for hostile units that act without mercy.
If we'd need a way for ability "Sleight of ... ass" for hero from some Hero Arena, it would be a JASS trigger converted to custom text from GUI and edited by some self-confident newb.

Well, creator of this thread, you can use an active ability by replacing event and event responses from my very simple trigger.
And we need much time to create a system that would prevent abusing for "Unit - A unit is attacked" event response. First of all, I say that I'd like to ask if there's a function that removes all trigger's events. If no, then:
  • Setting Up the Pairs and Their ID
  • Events
    • Unit - A unit is attacked
  • Conditions
    • Level of ability for (Attacking unit) greater than or equal to 1
    • Number of items carried by (Attacked unit) greater than 0
  • Actions
    • If (NumberOfFightingPairs equal to 8192) then do (Set NumberOfFightingPairs to 1) else do (Set NumberOfFightingPairs = (NumberOfFightingPair + 1))
    • Set AttackingUnit[NumberOfFightingPairs] = (Attacking unit)
    • Set AttackedUnit[NumberOfFightingPairs] = (Attacked unit)
Aww... ****
I guess it's something with unit's ID, anyway I need more time to think, because I'm one of those self-cofident newbs.
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
turn on/turn off trigger
that removes ZZZZ unit events^^

When did that start to remove events ...
And yes the one with custom values is better. There is a minor issue if you have another spell that uses custom values, so I suggest something like Local Handle Variables. But the best solution would be a local trigger that would get delated after use. But still if the attacking unit is ordered stop before it attacks than cast something damaging on the target and blablabla...

For the tread starter the simple a unit is attacked would work. For anyone else here is what they need.

P.s. Yes it is JASS
 
Level 5
Joined
Mar 13, 2008
Messages
126
turn off/on doesn't delete events it deletes events that are added threw other triggers
trigger-add event and if i turn off trigger it comes into his original state without event and when u turn it on it gets that event...
 
Last edited:
Level 11
Joined
Jun 21, 2007
Messages
505
I don't know JASS :( I need to study it somewhere on this forum in Triggers/Scripts section or on the wc3jass.com
But I guess, that a unit's point-value will be equal to its Attack Backswind Point X 1000 and will be "/" by 1000 and increased by a minor value in triggers to determine how long to wait before turning on the trigger that checks if a unit is damaged and turns off isantly (clearing the custom events)
 
Level 12
Joined
Apr 27, 2008
Messages
1,228
Distance/Projectile speed if it's ranged.
No way to get those values in game. You will have to make a table with the Backswind Points of all nit types that will have this ability.
 
Status
Not open for further replies.
Top