冲锋技能jass脚本重写
生活随笔
收集整理的這篇文章主要介紹了
冲锋技能jass脚本重写
小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.
優(yōu)化前的腳本:
//沖鋒技能 function Trig_ChongFengB_Conditions takes nothing returns boolean if(not(GetSpellAbilityId()=='A06B'))then return false endif return true endfunction function Trig_ChongFengB_Actions takes nothing returns nothing set udg_ChongFeng_Unit[3]=GetTriggerUnit() set udg_ChongFeng_Jiaodu[3]=AngleBetweenPoints(GetUnitLoc(udg_ChongFeng_Unit[3]),GetSpellTargetLoc()) call CreateNUnitsAtLoc(1,'o00W',Player(3),GetUnitLoc(udg_ChongFeng_Unit[3]),bj_UNIT_FACING) call IssuePointOrderLoc(GetLastCreatedUnit(),"impale",GetSpellTargetLoc()) call UnitApplyTimedLife(GetLastCreatedUnit(),'BHwe',2.00) call SetUnitPathing(udg_ChongFeng_Unit[3],false) call ShowUnitHide(udg_ChongFeng_Unit[3]) call PolledWait(0.90) call SetUnitPositionLoc(udg_ChongFeng_Unit[3],PolarProjectionBJ(GetUnitLoc(udg_ChongFeng_Unit[3]),900.00,udg_ChongFeng_Jiaodu[3])) call SetUnitPathing(udg_ChongFeng_Unit[3],true) call ShowUnitShow(udg_ChongFeng_Unit[3]) call SelectUnitForPlayerSingle(udg_ChongFeng_Unit[3],Player(3)) endfunction function InitTrig_ChongFengB takes nothing returns nothing set gg_trg_ChongFengB=CreateTrigger() call TriggerRegisterPlayerUnitEventSimple(gg_trg_ChongFengB,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerAddCondition(gg_trg_ChongFengB,Condition(function Trig_ChongFengB_Conditions)) call TriggerAddAction(gg_trg_ChongFengB,function Trig_ChongFengB_Actions) endfunction優(yōu)化前對每個玩家都要寫一遍上面的代碼,而且容易出錯。
優(yōu)化后的腳本:
//沖鋒技能觸發(fā)器 function ChongFeng_actions takes nothing returns nothing//發(fā)動技能的玩家local player fadong_player = GetTriggerPlayer()//施法單位,也就是發(fā)動沖鋒技能的武將local unit fadong_unit = GetTriggerUnit()//施法目標(biāo)坐標(biāo)local location mubiao_loc = GetSpellTargetLoc()local real jiaodu = AngleBetweenPoints(GetUnitLoc(fadong_unit),mubiao_loc)call CreateNUnitsAtLoc(1,'o00W',fadong_player,GetUnitLoc(fadong_unit),bj_UNIT_FACING)//給單位發(fā)送命令到 點(diǎn) impale命令call IssuePointOrderLoc(GetLastCreatedUnit(),"impale", mubiao_loc)//設(shè)置單位生命計時器call UnitApplyTimedLife(GetLastCreatedUnit(),'BHwe',2.00)//關(guān)閉施法單位碰撞效果,即可以穿人效果call SetUnitPathing(fadong_unit,false)//隱藏施法單位call ShowUnitHide(fadong_unit)//等待0.9秒call PolledWait(0.90)//移動單位 到指定坐標(biāo)(立刻)。PolarProjectionBJ向指定方向位移900call SetUnitPositionLoc(fadong_unit,PolarProjectionBJ(GetUnitLoc(fadong_unit),900.00,jiaodu))//開啟施法單位碰撞效果,即不能穿人call SetUnitPathing(fadong_unit,true)//顯示單位call ShowUnitShow(fadong_unit)//玩家選定指定單位call SelectUnitForPlayerSingle(fadong_unit,fadong_player) endfunction //判斷是否是發(fā)動了沖鋒技能 function ChongFeng_Conditions takes nothing returns booleanif(GetSpellAbilityId()=='A06B')thenreturn trueendifreturn false endfunction//沖鋒技能觸發(fā)器 set gg_jn_chongfeng = CreateTrigger() call TriggerRegisterPlayerUnitEventSimple(gg_jn_chongfeng,Player(1),EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerRegisterPlayerUnitEventSimple(gg_jn_chongfeng,Player(2),EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerRegisterPlayerUnitEventSimple(gg_jn_chongfeng,Player(3),EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerRegisterPlayerUnitEventSimple(gg_jn_chongfeng,Player(4),EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerRegisterPlayerUnitEventSimple(gg_jn_chongfeng,Player(5),EVENT_PLAYER_UNIT_SPELL_EFFECT)call TriggerRegisterPlayerUnitEventSimple(gg_jn_chongfeng,Player(7),EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerRegisterPlayerUnitEventSimple(gg_jn_chongfeng,Player(8),EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerRegisterPlayerUnitEventSimple(gg_jn_chongfeng,Player(9),EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerRegisterPlayerUnitEventSimple(gg_jn_chongfeng,Player(10),EVENT_PLAYER_UNIT_SPELL_EFFECT) call TriggerRegisterPlayerUnitEventSimple(gg_jn_chongfeng,Player(11),EVENT_PLAYER_UNIT_SPELL_EFFECT)call TriggerAddCondition(gg_jn_chongfeng,Condition(function ChongFeng_Conditions)) call TriggerAddAction(gg_jn_chongfeng,function ChongFeng_actions)總結(jié)
以上是生活随笔為你收集整理的冲锋技能jass脚本重写的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: linux获取路由器wan口的ip地址,
- 下一篇: mipsel_24kc的linux内核,