• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

[vJASS] Efficient way to put abilities into items?

Status
Not open for further replies.
Level 6
Joined
Oct 23, 2011
Messages
182
I've been trying to put special abilties into items (mainly passives)
What would be efficient way to do it?

Checking if a unit has the item every time it gets damaged/healed/etc. looks pretty bad

I was going to try to use Nestharus' Event.. but I realized it has no unregister(the special ability should be gone once the item is dropped)

Maybe I have to create a linked list of events ?
Tips would be greatly appreciated =)
 
It depends on what you are trying to do, but in general you can always use damage events/heal events because it will make everything a lot simpler. (as long as you are using a system for it) You may be thinking that it is a process-intensive method of doing it, but it isn't very noticeable.

Basically: on damage -> check if unit has item -> do actions

Or on whatever event that you want the passive to activate/have a chance of activating. If the unit does not have the item, it won't do the actions so there is no need for an unregister or anything like that.

You are probably thinking of only registering for the units who pickup the item, but it is pretty efficient to use the other method, and it is a lot less work. =)
 
Level 20
Joined
Jul 14, 2011
Messages
3,213
Well... the trigger would work only if someone has the items... Shouldn't be that "heavy" for the system to handle units that way.
 
Level 2
Joined
Feb 18, 2007
Messages
14
I use a damage detection system which allows me to create passive abilities that are instanciated (is that an english word?) per unit. So you can easily set up a trigger for item acquisition and one for dropping them and add/remove those abilities respectively.
(ADamage, IDS, grim001's DDstructs, etc have this functionality)
 
Level 6
Joined
Oct 23, 2011
Messages
182
I use a damage detection system which allows me to create passive abilities that are instanciated (is that an english word?) per unit. So you can easily set up a trigger for item acquisition and one for dropping them and add/remove those abilities respectively.
(ADamage, IDS, grim001's DDstructs, etc have this functionality)

Do you have 1 trigger per each item?
 
Status
Not open for further replies.
Top