| 01-05-2009, 11:12 AM | #1 |
hi guys, I decided to see some of Anitafs Abuff system code and I made a very simple spell. This spell should be an unbalanced version of inner fire that would give +12 attack and 2 armor bonus. I am trying to do this by adding abilities to the units as follows: JASS:// This is a simple copy of the RegularBuffSpellTemplate, just by changing the // GUI "trigger" name and scope name you can make a new, non-conflicting version // of the same code in the spirit of the JESP standard, then all that is left to // do is change the calibration functions and the code is adapted to work for a // new spell, in this case the Priest's Inner Fire. // This spell also demonstrates the use of ADamage shields, whenever a unit // deals damage to a unit with this buff, that damage is reduced by 5. scope ElvenFire initializer Init // CALIBRATION SECTION globals private constant integer SPELL = 'A003' //the spell that applies the buff private constant integer AURA_ID = 'A009' //the aura that will give the allied unit the buff private constant integer DAMAGE_ID = 'Altc' private constant integer ARMOR_ID = 'Ald2' endglobals private constant function Duration takes integer level returns real return 60.0 //the duration of the buff endfunction private constant function HeroDuration takes integer level returns real return 60.0 //the duration of the buff for heroes endfunction // SPELL CODE globals public aBuffType id = 0 endglobals //=========================================================================== private function Create takes aBuff eventBuff returns nothing call UnitAddAbility(eventBuff.target.u, AURA_ID) call UnitAddAbility(eventBuff.target.u, DAMAGE_ID) call UnitAddAbility(eventBuff.target.u, ARMOR_ID) endfunction //=========================================================================== private function Refresh takes aBuff eventBuff returns nothing endfunction //=========================================================================== private function Cleanup takes aBuff eventBuff returns nothing call UnitRemoveAbility(eventBuff.target.u, AURA_ID) call UnitRemoveAbility(eventBuff.target.u, DAMAGE_ID) call UnitRemoveAbility(eventBuff.target.u, ARMOR_ID) endfunction //=========================================================================== private function SpellCastCondition takes nothing returns boolean return GetSpellAbilityId()==SPELL endfunction //=========================================================================== private function SpellCast takes nothing returns nothing local integer level =GetUnitAbilityLevel(GetTriggerUnit(), SPELL) local real duration = Duration(level) if IsUnitSpellResistant(GetSpellTargetUnit()) then set duration = HeroDuration(level) endif call ABuffApply(id, GetSpellTargetUnit(), GetTriggerUnit(), duration, level, 0) endfunction //=========================================================================== private function Init takes nothing returns nothing local trigger ElvenFireTrg = CreateTrigger( ) call TriggerRegisterAnyUnitEventBJ(ElvenFireTrg, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition(ElvenFireTrg, Condition( function SpellCastCondition ) ) call TriggerAddAction(ElvenFireTrg, function SpellCast ) set id = aBuffType.create() set id.eventCreate = ABuffEvent_Create.Create set id.eventRefresh = ABuffEvent_Refresh.Refresh set id.eventCleanup = ABuffEvent_Cleanup.Cleanup endfunction endscope Now problem is that although the target unit gets the Aura, it doesn't get any bonus armor not attack (and it should).. it ocurred me that I must be doing something wrong, after all it is the first time I use the system... If some one could help I would appreciate, for more information, here is the map. |
| 01-05-2009, 12:18 PM | #2 |
Here's a fun question: what buff is it supposed to detect? Don't you think private constant integer BUFF = 'B004' might be useful? Also, I don't see why you use Holy Light as the base ability. Using Inner Fire as the base (and removing the original from the Priests) makes more sense. EDIT: Sorry if I seem cranky. Just got off work. |
| 01-05-2009, 03:58 PM | #3 |
Try using custom abilities. |
| 01-05-2009, 07:31 PM | #4 | |||
Ok, having in mind I am under attack here I go: Quote:
Quote:
Werrrmm, actually no, I see no use for it ... Quote:
EDIT Ahh, I finally got the "real" message from Anitarf. Now I undestand, thx! But I still don't understand the reason "why". Why didn't it work? PS: rep++ to you all. |
| 01-06-2009, 09:05 AM | #5 |
Just always use custom abilities. Modifying the default ones may or may not work in some cases. |
