| 02-01-2010, 02:45 PM | #1 |
After using the skill, my unit just flash "invulnerable" in the armor description, barely noticeable. JASS:scope SodeNoShirayuki initializer In_Sode_no_Shirayuki globals private constant integer SS = 'A04L' private constant integer RANGE = 512 private constant string MESSAGE_BEGIN = "Mae, Sode no Shirayuki!" private constant string MESSAGE_FINISH = "Some no mai, Tsukishiro!" private real TreeX private real TreeY endglobals private struct SNS unit caster real damage real x real y integer level weathereffect we rect r endstruct private function Sode_no_Shirayuki_Conditions takes nothing returns boolean return (GetSpellAbilityId() == SS) endfunction private function Sode_no_Shirayuki_Trees takes nothing returns nothing local destructable tree = GetEnumDestructable() local real x local real y local real dist if IsDestructableTree(tree) then set x = GetDestructableX(tree) set y = GetDestructableY(tree) set x = x - TreeX set y = y - TreeY set dist = SquareRoot(x * x + y * y) if (dist <= RANGE) then call KillDestructable(tree) set tree = null endif endif endfunction private function Sode_no_Shirayuki_Weather takes nothing returns nothing local SNS s = GetTimerData(GetExpiredTimer()) call RemoveRect(s.r) call RemoveWeatherEffect(s.we) set s.we = null call ReleaseTimer(GetExpiredTimer()) call s.destroy() endfunction private function Sode_no_Shirayuki_Run takes nothing returns nothing local SNS s = GetTimerData(GetExpiredTimer()) local group tg local unit tempunit local unit dummy local player tp call DisplayText(s.caster, MESSAGE_FINISH, 1) call SetUnitAnimation(s.caster, "Attack") if (GetUnitCurrentOrder(s.caster) == 852195) then set tp = GetOwningPlayer(s.caster) set tg = CreateGroup() call GroupEnumUnitsInRange(tg, s.x, s.y, RANGE, null) set dummy = CreateUnit(tp, 'h019', s.x, s.y, 0) call UnitApplyTimedLife(dummy, 'BTLF', 2.00) call SetUnitVertexColor(dummy, 255, 255, 255, 200) loop set tempunit = FirstOfGroup(tg) exitwhen tempunit == null if TargetCheck(s.caster, tempunit) then call UnitDamageTargetEx(s.caster, tempunit, s.damage, ATTACK_TYPE_NORMAL, DAMAGE_TYPE_SPELL, false, true) set dummy = CreateUnit(tp, 'h00B', s.x, s.y, 0) call UnitAddAbility(dummy, 'A04M') call SetUnitAbilityLevel(dummy, 'A04M', (4 + s.level * 2)) call IssueTargetOrder(dummy, "thunderbolt", tempunit) call UnitApplyTimedLife(dummy, 'BTLF', 1.00) endif call GroupRemoveUnit(tg, tempunit) endloop set dummy = null endif set TreeX = s.x set TreeY = s.y call EnumDestructablesInRect(s.r, null, function Sode_no_Shirayuki_Trees) call UnitRemoveAbility(s.caster, 'Avul') set s.caster = null set tp = null call TimerStart(GetExpiredTimer(), 1, false, function Sode_no_Shirayuki_Weather) endfunction private function Sode_no_Shirayuki_Actions takes nothing returns nothing local SNS s = SNS.create() local timer t = NewTimer() local unit dummy set s.caster = GetTriggerUnit() set s.level = GetUnitAbilityLevel(s.caster, SS) set s.x = GetSpellTargetX() set s.y = GetSpellTargetY() call SetUnitPosition(s.caster, s.x, s.y) set s.x = GetUnitX(s.caster) set s.y = GetUnitY(s.caster) set s.damage = (s.level * 100) + GetHeroInt(s.caster, true) call DisplayText(s.caster, MESSAGE_BEGIN, 1) call UnitAddAbility(s.caster, 'Avul') set dummy = CreateUnit(GetOwningPlayer(s.caster), 'h018', s.x, s.y, 0) call UnitApplyTimedLife(dummy, 'BTLF', 1.50) set dummy = null set s.r = Rect(s.x-512, s.y-512, s.x+512, s.y+512) set s.we = AddWeatherEffect(s.r, 'SNhs') call EnableWeatherEffect(s.we, true) call SetTimerData(t,s) call TimerStart(t, 2, false, function Sode_no_Shirayuki_Run) endfunction //=========================================================================== private function In_Sode_no_Shirayuki takes nothing returns nothing local trigger t_Sode_no_Shirayuki = CreateTrigger() call TriggerRegisterAnyUnitEventBJ( t_Sode_no_Shirayuki, EVENT_PLAYER_UNIT_SPELL_EFFECT ) call TriggerAddCondition( t_Sode_no_Shirayuki, Condition( function Sode_no_Shirayuki_Conditions ) ) call TriggerAddAction( t_Sode_no_Shirayuki, function Sode_no_Shirayuki_Actions ) set t_Sode_no_Shirayuki = null endfunction endscope Edit: It should be invul for 2s. xD Thanks in advance for any help! |
| 02-01-2010, 04:23 PM | #2 |
native SetUnitInvulnerable takes unit whichUnit, boolean flag returns nothing? |
| 02-01-2010, 04:27 PM | #3 | |
Quote:
Edit: It was better without the native code xD |
| 02-01-2010, 04:49 PM | #4 |
Perhaps you have a conflict with another script. Also, you really ought to put many of those hardcoded variables in private constant globals, like "Attack" and 'Ainv' and such. |
| 02-01-2010, 09:21 PM | #5 |
Apparently, "Disable other abilitys" on channel disable invulnerability. Thanks for the help anyway. Also, what is the difference between "UnitAddAbility(unit, 'Avul')" and your function? |
| 02-01-2010, 09:42 PM | #6 |
One adds an ability, the other just makes in Invulnerable with no ability. |
| 02-02-2010, 01:05 PM | #7 |
AFAIK, the SetUnitInvulnerable native adds 'Avul' to the unit in question. |
| 02-02-2010, 02:16 PM | #8 |
According to this it doesn't: JASS:library InvulnerabilityTest initializer init private function init takes nothing returns nothing local unit u = CreateUnit(Player(0),'hfoo',0,0,270) call SetUnitInvulnerable(u,true) if GetUnitAbilityLevel(u,'Ainv') >= 1 then call BJDebugMsg("The native SetUnitInvulnerable does just add the 'Ainv' ability") // Didn't appear. =P endif endfunction endlibrary |
| 02-02-2010, 02:20 PM | #9 | |
Quote:
JASS:library InvulnerabilityTest initializer init private function init takes nothing returns nothing local unit u = CreateUnit(Player(0),'hfoo',0,0,270) call SetUnitInvulnerable(u,true) if GetUnitAbilityLevel(u,'Avul') >= 1 then call BJDebugMsg("The native SetUnitInvulnerable does just add the 'Avul' ability") // IT APPEARS! endif endfunction endlibrary To make it short, SetUnitInvulnerable just adds the ability 'Avul'. |
| 02-02-2010, 02:47 PM | #10 |
Shit. Hah, I misspelled the rawcode. |
