| 09-08-2008, 05:59 AM | #1 |
The Wind Rider's FlyHeight won't change; it stays at the same height. BUT: The the 'casting' deactivates after some time, indicating that measurement of the Wind Rider's FlyHeight == gR_MaxFlyHeight or gR_MinFlyHeight... BUT VISIBLY IT STAYS AT THE SAME FLY HEIGHT. What is wrong? JASS:library WindRider initializer Init requires GeneralLibrary globals integer gINT_UnitIdWindRider = 'E00V' endglobals scope PredatorOfTheSkies globals integer gINT_AbilityIdPredatorOfTheSkiesAscend = 'A068' integer gINT_AbilityIdPredatorOfTheSkiesDescend = 'A067' string gSTR_OrderPredatorOfTheSkiesAscendOn = "immolation" string gSTR_OrderPredatorOfTheSkiesAscendOff = "unimmolation" string gSTR_OrderPredatorOfTheSkiesDescendOn = "defend" string gSTR_OrderPredatorOfTheSkiesDescendOff = "undefend" private trigger gTRIG_Order private group gUG_Ascender private group gUG_Descender private integer gINT_CountCaster private timer gTIM = CreateTimer() private constant real gR_DurationTimer = 1.00 private constant real gR_MaxFlyHeight = 1000.00 private constant real gR_MinFlyHeight = 0. private constant real gR_IncrementFlyHeight = 50.00 endglobals private function Callback takes nothing returns nothing local unit U_Query local group UG_Ascender = CreateGroup() local group UG_Descender = CreateGroup() local real R_FlyHeight call GroupAddGroup(gUG_Ascender, UG_Ascender) call GroupAddGroup(gUG_Descender, UG_Descender) loop set U_Query = FirstOfGroup(UG_Ascender) exitwhen U_Query == null set R_FlyHeight = GetUnitFlyHeight(U_Query) if GetUnitState(U_Query, UNIT_STATE_LIFE) > 0 and R_FlyHeight < gR_MaxFlyHeight - gR_IncrementFlyHeight then call UnitAddAbility(U_Query, 'Arav') call SetUnitFlyHeight(U_Query, R_FlyHeight + gR_IncrementFlyHeight, 1.00) call UnitRemoveAbility(U_Query, 'Arav') call SetUnitAnimationByIndex(U_Query, 4) else call IssueImmediateOrder(U_Query, gSTR_OrderPredatorOfTheSkiesAscendOff) endif call GroupRemoveUnit(UG_Ascender, U_Query) endloop loop set U_Query = FirstOfGroup(UG_Descender) exitwhen U_Query == null set R_FlyHeight = GetUnitFlyHeight(U_Query) if GetUnitState(U_Query, UNIT_STATE_LIFE) > 0 and R_FlyHeight > gR_MinFlyHeight + gR_IncrementFlyHeight then call UnitAddAbility(U_Query, 'Arav') call SetUnitFlyHeight(U_Query, R_FlyHeight - gR_IncrementFlyHeight, 1.00) call UnitRemoveAbility(U_Query, 'Arav') call SetUnitAnimationByIndex(U_Query, 5) else call IssueImmediateOrder(U_Query, gSTR_OrderPredatorOfTheSkiesDescendOff) endif call GroupRemoveUnit(UG_Descender, U_Query) endloop set U_Query = null call DestroyGroup(UG_Ascender) call DestroyGroup(UG_Descender) endfunction private function gTRIG_Order_Conditions takes nothing returns boolean local boolean BOOL1 = (OrderId2String(GetIssuedOrderId()) == gSTR_OrderPredatorOfTheSkiesAscendOn or OrderId2String(GetIssuedOrderId()) == gSTR_OrderPredatorOfTheSkiesAscendOff) and GetUnitAbilityLevel(GetTriggerUnit(), gINT_AbilityIdPredatorOfTheSkiesAscend) > 0 local boolean BOOL2 = (OrderId2String(GetIssuedOrderId()) == gSTR_OrderPredatorOfTheSkiesDescendOn or OrderId2String(GetIssuedOrderId()) == gSTR_OrderPredatorOfTheSkiesDescendOff) and GetUnitAbilityLevel(GetTriggerUnit(), gINT_AbilityIdPredatorOfTheSkiesDescend) > 0 return BOOL1 or BOOL2 endfunction private function gTRIG_Order_Actions takes nothing returns nothing local unit U_Caster = GetTriggerUnit() local real R_FlyHeight = GetUnitFlyHeight(U_Caster) local string STR_Order = OrderId2String(GetIssuedOrderId()) if STR_Order == gSTR_OrderPredatorOfTheSkiesAscendOn and R_FlyHeight < gR_MaxFlyHeight then call IssueImmediateOrder(U_Caster, gSTR_OrderPredatorOfTheSkiesDescendOff) call GroupAddUnit(gUG_Ascender, U_Caster) set gINT_CountCaster = gINT_CountCaster + 1 elseif STR_Order == gSTR_OrderPredatorOfTheSkiesDescendOn and R_FlyHeight > gR_MinFlyHeight then call IssueImmediateOrder(U_Caster, gSTR_OrderPredatorOfTheSkiesAscendOff) call GroupAddUnit(gUG_Descender, U_Caster) set gINT_CountCaster = gINT_CountCaster + 1 elseif STR_Order == gSTR_OrderPredatorOfTheSkiesAscendOff then call GroupRemoveUnit(gUG_Ascender, U_Caster) set gINT_CountCaster = gINT_CountCaster - 1 elseif STR_Order == gSTR_OrderPredatorOfTheSkiesDescendOff then call GroupRemoveUnit(gUG_Descender, U_Caster) set gINT_CountCaster = gINT_CountCaster - 1 else call PauseUnit(U_Caster, true) call IssueImmediateOrder(U_Caster, "stop") call PauseUnit(U_Caster, false) endif if gINT_CountCaster == 1 then call TimerStart(gTIM, gR_DurationTimer, true, function Callback) elseif gINT_CountCaster == 0 then call PauseTimer(gTIM) endif set STR_Order = null set U_Caster = null endfunction public function PredatorOfTheSkiesInit takes nothing returns nothing set gUG_Ascender = CreateGroup() set gUG_Descender = CreateGroup() set gINT_CountCaster = 0 set gTRIG_Order = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gTRIG_Order, EVENT_PLAYER_UNIT_ISSUED_ORDER) call TriggerAddCondition(gTRIG_Order, Condition(function gTRIG_Order_Conditions)) call TriggerAddAction(gTRIG_Order, function gTRIG_Order_Actions) endfunction endscope private function Init takes nothing returns nothing call PredatorOfTheSkies_PredatorOfTheSkiesInit() endfunction endlibrary |
| 09-08-2008, 11:32 AM | #2 |
Give it crow form, thne remove crow form ability instantly. The changing flying height should be no problem in the triggers. |
| 09-08-2008, 01:12 PM | #3 |
crow form add-remove is already applied... still doesnt work edit: after changing it a bit, i have found out that it works only when gR_MinFlyHeight is set to 0.00. if it is set to 250.00, w/c is the unit's minimum fly height and initial fly height value in the object editor, (or 260, 240) it doesnt work. what's wrong here? |
| 09-09-2008, 01:56 AM | #4 |
Add it, remove it, and then set the flyheight. Not: Add it, set the flyheight, and then remove it. |
| 09-09-2008, 08:53 AM | #5 |
still isnt changin ++ problem: c that bit "snag"? well it "go"'s, then it runs the snag bit; but the unit itself does nothing. after the snag bit is run the it is RE RUN - wit the unit actually doing the anims and with a NEW INDEX (check bjdebugmsg). so this is what happens in a run: it "go"s to the target |BUT IT DOESNT CHANGE ITS FLY HEIGHT|; then it "snag"s thgat target - though the unit does not do anything; then it resnags the target with a NEW INDEX. wtf is wrong here JASS:scope FalconDive globals constant integer gINT_AbilityIdFalconDive = 'A06A' private trigger gTRIG_Cast private timer gTIM = CreateTimer() private constant real gR_DurationTimer = 0.05 private constant real gR_IncrementGo = 35.00 private constant real gR_MaxOffsetDistance = 2000.00 private constant real gR_MaxDuration = 3.00 private FalconDiveData array gDATA private integer gINT_CountData = 0 endglobals private function Callback takes nothing returns nothing local integer INT_CountData = 0 loop set INT_CountData = INT_CountData + 1 call gDATA[INT_CountData].Execute() exitwhen INT_CountData == gINT_CountData endloop endfunction struct FalconDiveData integer intDataIndex unit uCaster integer intLevelAbilityCast unit uTarget boolean boolGo real rDuration static method Create takes unit caster, unit target returns nothing local FalconDiveData New = FalconDiveData.allocate() set gINT_CountData = gINT_CountData + 1 set New.intDataIndex = gINT_CountData set New.uCaster = caster set New.intLevelAbilityCast = GetUnitAbilityLevel(caster, gINT_AbilityIdFalconDive) set New.uTarget = target set New.boolGo = true set New.rDuration = 0 set gDATA[gINT_CountData] = New call SetUnitTimeScale(caster, 0.25) call SetUnitAnimation(caster, "spell") if gINT_CountData == 1 then call TimerStart(gTIM, gR_DurationTimer, true, function Callback) endif call BJDebugMsg(I2S(gINT_CountData)) endmethod private method Destroy takes nothing returns nothing if this.boolGo == false then call PauseUnit(this.uTarget, false) endif call PauseUnit(this.uCaster, false) call SetUnitTimeScale(this.uCaster, 1.00) call SetUnitAnimation(this.uCaster, "stand") set this.uCaster = null set this.uTarget = null call BJDebugMsg(I2S(gINT_CountData)) endmethod method Execute takes nothing returns nothing local real R_XCaster = GetUnitX(this.uCaster) local real R_YCaster = GetUnitY(this.uCaster) local real R_XTarget = GetUnitX(this.uTarget) local real R_YTarget = GetUnitY(this.uTarget) local real R_OffsetDistance = SquareRoot(Pow(R_XCaster - R_XTarget, 2) + Pow(R_YCaster - R_YTarget, 2)) local real R_OffsetAngle = bj_RADTODEG * Atan2(R_YTarget - R_YCaster, R_XTarget - R_XCaster) local real R_FlyHeightCaster = GetUnitFlyHeight(this.uCaster) local real R_FlyHeightTarget = GetUnitFlyHeight(this.uTarget) local real R_IncrementFlyHeight = (R_FlyHeightCaster - R_FlyHeightTarget) if GetUnitState(this.uCaster, UNIT_STATE_LIFE) > 0.00 and GetUnitState(this.uTarget, UNIT_STATE_LIFE) > 0.00 then if this.boolGo then //Go actions// call BJDebugMsg("CHARGED!") call SetUnitX(this.uCaster, R_XCaster + gR_IncrementGo * Cos(R_OffsetAngle * bj_DEGTORAD)) call SetUnitY(this.uCaster, R_YCaster + gR_IncrementGo * Sin(R_OffsetAngle * bj_DEGTORAD)) call UnitAddAbility(this.uCaster, gINT_AbilityIdCrowForm) call UnitRemoveAbility(this.uCaster, gINT_AbilityIdCrowForm) call SetUnitFlyHeight(this.uCaster, R_FlyHeightCaster - R_IncrementFlyHeight, 0.00) call SetUnitFacing(this.uCaster, R_OffsetAngle) if R_OffsetDistance <= gR_IncrementGo then set this.boolGo = false endif if R_OffsetDistance > gR_MaxOffsetDistance then call this.Destroy() endif else //Snag actions// call BJDebugMsg("SNAGGED!") set this.rDuration = this.rDuration + gR_DurationTimer if this.rDuration == 0 then call SetUnitTimeScale(this.uCaster, 2.00) call SetUnitAnimation(this.uCaster, "spell") elseif this.rDuration == 0.50 then call SetUnitTimeScale(this.uCaster, 0.75) elseif this.rDuration > 1 then //Make the caster push the target.// endif if this.rDuration == gR_MaxDuration then call this.Destroy() endif endif else call this.Destroy() endif endmethod endstruct private function gTRIG_Cast_Conditions takes nothing returns boolean return GetSpellAbilityId() == gINT_AbilityIdFalconDive endfunction private function gTRIG_Cast_Actions takes nothing returns nothing local unit U_Caster = GetTriggerUnit() local unit U_Target = GetSpellTargetUnit() //Create sound sfx// call IssueImmediateOrder(U_Caster, gSTR_OrderPredatorOfTheSkiesAscendOff) call IssueImmediateOrder(U_Caster, gSTR_OrderPredatorOfTheSkiesDescendOff) call PauseUnit(U_Caster, true) call SetUnitTimeScale(U_Caster, 3.00) call SetUnitAnimation(U_Caster, "victory") call PolledWait(0.50) call FalconDiveData.Create(U_Caster, U_Target) set U_Caster = null set U_Target = null endfunction public function FalconDiveInit takes nothing returns nothing set gTRIG_Cast = CreateTrigger() call TriggerRegisterAnyUnitEventBJ(gTRIG_Cast, EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerAddCondition(gTRIG_Cast, Condition(function gTRIG_Cast_Conditions)) call TriggerAddAction(gTRIG_Cast, function gTRIG_Cast_Actions) endfunction endscope |
