| 08-04-2007, 07:53 PM | #1 |
Ok, so I want a self-buff shield (blocks X amount of damage) that regains some of its hit points every time a nearby unit dies. I came upon Shadow 1500's shield system here. http://www.wc3campaigns.net/showthre...ghlight=Shield In the forum, Vexorian and Anitarf mentioned that it would be easier for the person to code it themselves. The system seems to just be one trigger and three commands JASS:function InitTrig_Load_Game_Cache takes nothing returns nothing call FlushGameCache(InitGameCache("localvars.w3v")) set udg_hash = InitGameCache("localvars.w3v") endfunction Trigger: Actions
![]() Custom script: call CreateShield(GetTriggerUnit(),100,0,'B000',3,0)
![]() -------- CreateShield takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor --------
![]() -------- Target = Triggering Unit --------
![]() -------- Shield Hitpoints = 100 --------
![]() -------- Duration = 0 (Until depleted/dispelled) --------
![]() -------- Buff = B000 (Shield) --------
![]() -------- Regeneration = 3 HP per second. --------
![]() -------- Armor = 0 (reduce 0% dmg taken) --------Trigger: Actions
![]() Custom script: call CreateShield(GetTriggerUnit(),100,0,'B000',0,.50)
![]() -------- CreateShield takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor --------
![]() -------- Target = Triggering Unit --------
![]() -------- Shield Hitpoints = 100 --------
![]() -------- Duration = 0 (Until depleted/dispelled) --------
![]() -------- Buff = B000 (Shield) --------
![]() -------- Regeneration = 0 --------
![]() -------- Armor = 0.50 (reduce 50% dmg taken) --------Trigger: Actions
![]() Set guy = Protector of Men 0000 <gen>
![]() Custom script: call CreateShieldEx(udg_guy,300,-1,0,3,0,"|cFF3232FF",true)
![]() -------- CreateShieldEx takes unit target, real shieldhp, real duration, integer buffId, real regenerate, real armor, string color, boolean dmgspill --------
![]() -------- Target = Guy --------
![]() -------- Shield Hitpoints = 300 --------
![]() -------- Duration = -1 (Indestructable) --------
![]() -------- Buff = None (not using buff cuz shield is indestructable) --------
![]() -------- Regeneration = 3 HP per second --------
![]() -------- Armor = 0 (reduce 0% dmg taken) --------
![]() -------- Color = |cFF3232FF (Blue) --------
![]() -------- Damage Spill = Yes --------Thanks ahead of time. |
| 08-04-2007, 08:19 PM | #2 |
Or you could do it "The Easy Way" The Easy Way: 1) Make a ability based of mana shield 2) change mana cost and other stuff to w/e you want just have the mana drained per damage = 0 3) MAke a trigger like so Trigger: ![]() Event - ![]() Unit Dies![]() Condition![]() Event![]() If Unit in range of dying unit has buff = to Shield![]() Then![]() set tempgroup = unit group units in range of dying unit with buff Shield![]() pick every unit in tempgroup and do actions![]() set tempreal = hp of picked unit![]() set picked units hp to tempreal + VALUEAs for damage make another trigger such as Trigger: ![]() Event![]() a unit is attacked![]() conditions![]() events![]() if attacked unit has buff Shield then do actions![]() If ShieldDamageAbsorbed >= Damage to absorb![]() then![]() Do Nothing![]() Else ![]() Remove Buff Shielddepending on you application it might need ot be tweaked but that is the basic stuff To have it change the shield hp jsut have it subtract 10 grom ShieldDamageAbsorbed every attack instade of setting the units 10 to more |
| 08-04-2007, 08:28 PM | #3 |
There's a couple of flaws with what I want from that. 1. I don't want the shield to heal the caster, I want it to add hp to the shield. So if the shield is at 50 hp, and a unit dies, it gains 10 hp and the shield is now 60 hp. 2. The damage trigger will only remove the buff if one damage source is greater than the shield, rather than the shield wearing away with each hit. 3. How do I detect how much damage has been taken? I assume I just use a damage system. |
| 08-04-2007, 08:37 PM | #4 | |
1) Quote:
3) a damage system would work for this and for ^ |
| 08-05-2007, 06:50 PM | #5 |
Hmmm, I see. Thanks |
