找回密码
 立即注册
楼主: 大谎言家

余波中的JASS研究

[复制链接]
 楼主| 发表于 2015-4-13 17:19:25 | 显示全部楼层
function PlatoonReinforcements takes nothing returns nothing
    local real handicap = 0.0
    local integer i = 1
    local integer id = 0
    local integer LZSelect = GetRandomInt(1,8)
    local real x = GetRectCenterX(udg_LandingZones[LZSelect])
    local real y = GetRectCenterY(udg_LandingZones[LZSelect])
    local location l
    local real angle
    local boolean present
    local unit u
    local real theta = GetRandomReal(0.0,6.28)
    local real ux = Clamp(x+3000.0*Cos(theta),GetRectMinX(bj_mapInitialPlayableArea),GetRectMaxX(bj_mapInitialPlayableArea))
    local real uy = Clamp(y+3000.0*Sin(theta),GetRectMinY(bj_mapInitialPlayableArea),GetRectMaxY(bj_mapInitialPlayableArea))
    local unit blackhawk//一大坨变量的定义
    if udg_InitialPlayers==udg_Players then//这个条件意义不明,从字面上来讲
        return
    else
        loop
            exitwhen i>udg_InitialPlayers//循环1~初始玩家数量
            if (GetWidgetLife(udg_Hero[udg_Sorted])<=0.405 or udg_Experience[udg_Sorted]>400000) and GetPlayerSlotState(ConvertedPlayer(udg_Sorted))!=PLAYER_SLOT_STATE_LEFT//玩家没有离开游戏
then
                set id=1337//噗这不是……
            endif
            set i=i+1
        endloop
        set i=1
        if id!=1337 then//这作者是把1337当做flag来用了啊,好好用布尔不行嘛?
            return
        endif
    endif
    set l = Location(x,y)
    set udg_LZPoint = Location(x,y)
    set blackhawk = CreateUnit(Player(11),'h009',ux,uy,theta+3.14)//创建黑鹰单位
    call UnitApplyTimedLife(blackhawk,'Bhwd',90.0)//设置生命周期
    call SetUnitScalePercent(blackhawk,50.0,50.0,50.0)//设置单位缩放
    call RemoveGuardPosition(blackhawk)//忽视单位警戒点
    call TriggerSleepAction(0.)//等待0s
    call IssuePointOrder(blackhawk,"move",x,y)//发布命令移动到坐标点
    call StartSound(gg_snd_BlackHawkRotor)//播放黑鹰音效
    call PolledWait(5.5)//等待5.5s
    call SetUnitFlyHeight(blackhawk,15.0,130.0)//设置单位飞行高度
    call SmoothUnitResize(blackhawk,0.6,1.2,4)//一个自己写的函数,看了一下大概是改变缩放?反正我也想不出这里需要什么奇妙的函数来作甚么
    call EnableTrigger(gg_trg_Landing_Area)//开启触发,landingArea字面意思是着陆区域啊
    call PolledWait(3.)//等待3s
    call SetUnitTimeScalePercent(blackhawk,65.0)//改变单位缩放,仔细想想余波里头黑鹰的缩放似乎是有不科学的地方
    call ExecuteFunc("BlackHawkWashOff")//烟尘效果额外做成一个函数了
    call HeloShock(blackhawk)//这个是周围的单位会受到伤害,其实我在想又没这个必要,直升机降下来都要造成伤害
    call AttachSoundToUnit(gg_snd_BlackHawkLand,blackhawk)//跟随单位播放声音
    call SetSoundVolume(gg_snd_BlackHawkLand,127)//设置多通道音量
    call StartSound(gg_snd_BlackHawkLand)//播放着陆声音
    call PolledWait(2.5)//等待2.5s
    call KiloEvac(blackhawk)//回收友军尸体的函数
    call IssueImmediateOrder(blackhawk,"holdposition")//无目标命令原地站岗
    loop
        exitwhen i>udg_InitialPlayers
        set angle = 360.0*(I2R(i)-1)/I2R(udg_InitialPlayers)
        if (GetWidgetLife(udg_Hero[udg_Sorted])<=0.405 or udg_Experience[udg_Sorted]>400000) and GetPlayerSlotState(ConvertedPlayer(udg_Sorted))!=PLAYER_SLOT_STATE_LEFT then
            set present = true
            set handicap = handicap + 0.015
            if GetRandomInt(0,10)==1 and udg_Experience[udg_Sorted]>60000 then
                set id = 'z00E' //IUL
            elseif udg_Chapter!=1 and GetRandomInt(0,55)==1 and udg_Experience[udg_Sorted]>60000 then
                set id = 'z006' //Pilot
            elseif GetRandomInt(0,12)==1 and udg_Experience[udg_Sorted]>30000 then
                set id = 'z00G' //Sniper
            elseif GetRandomInt(0,6)==1 then
                set id = 'z009' //Flamethrower
            elseif GetRandomInt(0,6)==1 then
                set id = 'z001' //Corpsman
            elseif GetRandomInt(0,8)==1 then
                set id = 'z004' //Engineer
            elseif GetRandomInt(0,3)==1 then
                set id = 'z000' //Machine Gunner
            elseif GetRandomInt(0,5)==1 then
                set id = 'z00F' //Marksman
            else
                set id = 'z008' //Rifleman
            endif
            set u = CreateUnit(ConvertedPlayer(udg_Sorted),id,x+80.0,y-175.0,0.0)//以上,创建援军单位
            call SetLoadState(I2S(H2I(u)),1)//又是函数,Load什么东西呢
            call UnitAddItemById(u,'I004') //Medkit//初始物品,看样子是一人一个包
            if id=='z001' then
                call TriggerRegisterUnitEvent(gg_trg_Anti_Venom,u,EVENT_UNIT_SPELL_EFFECT)
            elseif id=='z006' then
                call TriggerRegisterUnitEvent(gg_trg_Control_Aircraft,u,EVENT_UNIT_SPELL_EFFECT)
            elseif id=='z004' then
                call UnitAddItemById(u,'I014') //Field Lights
                call TriggerRegisterUnitEvent(gg_trg_Nanosteel_Net,u,EVENT_UNIT_SPELL_EFFECT)
            endif//上面是注册单位事件
            call UnitAddAbility(u,'A04R') //NVG
            call TriggerRegisterUnitEvent(gg_trg_Ailments,u,EVENT_UNIT_DAMAGED)//哈……单位受伤害事件的注册,没有YDWE呢……
            call TriggerRegisterUnitEvent(gg_trg_Article_15,u,EVENT_UNIT_DEATH)
            call IssuePointOrder(u,"attack", x + (325.0*Cos(angle*0.01745)), y + (325.0*Sin(angle*0.01745)) )//发布命令攻击移动
        endif
        call TriggerSleepAction(0.)//等待0s,这个玩意到底意义何在
        set i=i+1
    endloop
    if present then
        call StartSound(gg_snd_RockandRoll)//援军抵达的音效
    endif
    if present then
        call SetCameraQuickPosition(x,y)//设置镜头
        call PingMinimapEx(x,y,15.0,255,0,0,false)//小地图信号
        call ALICEText(15.0, "|cfff3ad00ALICE|r : Reinforcements have arrived." )//ALICE报信息
        call SetPlayerHandicap(Player(13),GetPlayerHandicap(Player(13))+handicap)//handicap,不知道是什么
        call SetPlayerHandicap(Player(14),GetPlayerHandicap(Player(14))+handicap)
    endif
    set i=1
    loop
        exitwhen i>12
        call PolledWait(5.)
        call KiloEvac(blackhawk)//啊,又运行了一遍,开头检查一遍回收尸体,结尾又是一遍。
        set i=i+1
    endloop
    call ExecuteFunc("BlackHawkWashOff")//又是一遍烟尘,这是起飞了
    call SetUnitFlyHeight(blackhawk,800.0,200.0)//设置飞行高度
    call SmoothUnitResize(blackhawk,1.2,0.5,3)//我猜这个函数是平滑的设置单位缩放的意思
    call SetUnitTimeScalePercent(blackhawk,100.0)//设置缩放
    call IssuePointOrder(blackhawk,"move",13000.0,10000.0)//点目标命令移动到……哪里?看起来像是地图的右上角
    call PolledWait(3.5)//等待
    call DisableTrigger(gg_trg_Landing_Area)//关闭触发
    call EnumDestructablesInCircleBJ(600,l,function TreeShakeEnd)//选取可破坏物做动作,停止摇晃树木……原来如此
    call PolledWait(3.)
    call RemoveUnit(blackhawk)//删除单位
    call RemoveLocation(l)
    call RemoveLocation(udg_LZPoint)
    set l = null
    set u = null
    set blackhawk = null//排泄中
endfunction

[ 本帖最后由 大谎言家 于 2015-4-13 23:38 编辑 ]
回复

使用道具 举报

 楼主| 发表于 2015-4-14 00:01:00 | 显示全部楼层
附带一下烟尘特效函数:

function BlackHawkWashOff takes nothing returns nothing
    local real x = GetLocationX(udg_LZPoint)
    local real y = GetLocationY(udg_LZPoint)
    local real dist = 0
    local integer i//变量声明
    call DestroyEffect(AddSpecialEffect("Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl",x,y))//创建特效,这个应该是在中心点的?
    set bj_meleeNearestMineDist = x
    set bj_lastTransmissionDuration = y
    set udg_soundpath = "Abilities\\Spells\\NightElf\\Immolation\\ImmolationDecay1.wav"
    call ExecuteFunc("PlaySoundPath3D")//播放音效
    loop
        exitwhen dist>320
        set i = 0
        loop
            exitwhen i>320
            if GetRandomInt(0,1)==1 then
                call DestroyEffect(AddSpecialEffect( "Objects\\Spawnmodels\\Undead\\ImpaleTargetDust\\ImpaleTargetDust.mdl", x + dist * Cos(i * bj_DEGTORAD), y + dist * Sin(i * bj_DEGTORAD) ))//二分之一的几率,神马鬼特效……
            endif
            set i=i+40
        endloop
        if GetRandomInt(0,1)==1 then
            call TriggerSleepAction(0.)
        endif
        set dist=dist+40
    endloop//意义不明的循环,明明没必要搞成这个样子
endfunction
回复

使用道具 举报

 楼主| 发表于 2015-4-14 00:41:24 | 显示全部楼层
关于那个改变缩放的函数的效果是把单位从当前缩放平滑的变换到目标缩放,最后一个参数是用的时间
回复

使用道具 举报

 楼主| 发表于 2015-4-19 16:16:48 | 显示全部楼层
喷火的燃料合成,没啥意思
function FuelSynthesizerConditions takes nothing returns boolean
    return GetSpellAbilityId()=='A031'//条件
endfunction

function FuelSynthesizer takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local player p = GetOwningPlayer(u)
    local integer i = GetConvertedPlayerId(p)
    local integer fuel = 0//声明变量
    if udg_Rounds==0 then
        call UnitAddAbility(u,'A044') //Flametip//这个是喷火兵枪上的那一团火,不知道有甚么鸟用,还是说喷火兵没子弹了就会删掉这团火?
    endif
    set udg_Reloading[GetConvertedPlayerId(p)] = 0
    call UnitRemoveAbility(u,'A02H')//删除装弹时头上的光环
    if udg_Rounds<2450 then
        set fuel = 50
    elseif udg_Rounds<2500 then
        set fuel = 2500 - udg_Rounds//判断数量给燃料
    endif
    set udg_mystring = "+" + I2S(fuel)//myString,字符串,这个是漂浮文字
    set udg_Rounds = udg_Rounds + fuel
    call SetPlayerState(p,PLAYER_STATE_RESOURCE_GOLD,udg_Rounds)//设置子弹
    call AttachSoundToUnit(gg_snd_FuelSynthesizer, u)//音效
    call SetSoundVolume(gg_snd_FuelSynthesizer, 127)
    call StartSound(gg_snd_FuelSynthesizer)
    call AddFadingTextTag(udg_mystring,GetUnitX(u),GetUnitY(u),255,220,0,200)//漂浮文字
    set u = null//排泄
endfunction
回复

使用道具 举报

 楼主| 发表于 2015-4-21 22:37:34 | 显示全部楼层
医生的重要资料:

function CorpsmanVitalSignsConditions takes nothing returns boolean
    return GetSpellAbilityId()=='A03D'
endfunction//条件

function CorpsmanVitalSigns takes nothing returns nothing
    local integer i = 1
    local integer a = 0
    local integer attention = 0//变量声明
    call DisplayTimedTextToPlayer( GetLocalPlayer(), 0.0, 0.0, 5.0, "|cfff3ad00重要资料 - E 连 3 排|r" )
    loop
        exitwhen i > udg_Players//循环玩家数量
        if udg_Hero[udg_Sorted]!=null then//玩家有英雄
            set attention = 0
            if GetUnitAbilityLevel(udg_Hero[udg_Sorted],'B00A')>0 then
                set a = 1
                set attention=1
                call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 5.0, udg_Pcolors[udg_Sorted] + GetPlayerName(ConvertedPlayer(udg_Sorted)) + "|r 受到开放性创伤." )//开放伤口判断
            endif
            if GetUnitAbilityLevel(udg_Hero[udg_Sorted],'Bslo')>0 then
                set a = 1
                set attention=1
                call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 5.0, udg_Pcolors[udg_Sorted] + GetPlayerName(ConvertedPlayer(udg_Sorted)) + "|r 骨折了." )//骨折判断
            endif
            if PoisonCheck(udg_Hero[udg_Sorted]) then
                set a = 1
                set attention=1
                call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 5.0, udg_Pcolors[udg_Sorted] + GetPlayerName(ConvertedPlayer(udg_Sorted)) + "|r 中毒了." )//中毒
            endif
            if GetWidgetLife(udg_Hero[udg_Sorted])<=175.0 then
                set a = 1
                if GetUnitTypeId(udg_Hero[udg_Sorted])=='h00E' then
                    call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 8.0, udg_Pcolors[udg_Sorted] + GetPlayerName(ConvertedPlayer(udg_Sorted)) + "|r 损坏严重." )
                else
                    set attention=1
                    call DisplayTimedTextToPlayer( GetLocalPlayer(), 0, 0, 8.0, udg_Pcolors[udg_Sorted] + GetPlayerName(ConvertedPlayer(udg_Sorted)) + "|r 受伤严重." )
                endif
            endif
            if attention==1 then
                call PingMinimapEx(GetUnitX(udg_Hero[udg_Sorted]), GetUnitY(udg_Hero[udg_Sorted]), 5.0, 200, 0, 0, false)
            endif
        endif
        set i = i + 1
    endloop
    if a==0 then
        call DisplayTimedTextToPlayer( GetLocalPlayer(), 0.0, 0.0, 5.0, "全体队员状态都很稳定." )//如果上面都没有,就是全员稳定
    endif
endfunction
回复

使用道具 举报

 楼主| 发表于 2015-5-9 11:31:10 | 显示全部楼层
激光指示

Laser Designator
function LaserDesignatorConditions takes nothing returns boolean
    local integer i = GetSpellAbilityId()
    return i=='A01O' or i=='A024' or i=='A03H' or i=='A06M' or i=='A07C'//条件判断
endfunction

function LaserDesignator takes nothing returns nothing
    local unit u = GetSpellTargetUnit()
    local unit u2 = GetTriggerUnit()
    local real x = GetUnitX(u)
    local real y = GetUnitY(u)
    local integer newdesignation = 0
    local integer i = 1//变量声明
    if GetUnitAbilityLevel(u,'B009')<=0 then//判断单位是否已经有buff
        if IsUnitType(u,UNIT_TYPE_HERO)==true then//是英雄
            if IsUnitEnemy(u,Player(0)) then//是敌人
                set newdesignation = 1//某种flag
            endif
            call DisplayTimedTextToPlayer( GetLocalPlayer(), 0.0, 0.0, 6.0, "|cfff3ad00" + GetPlayerName(GetOwningPlayer(u2)) + "|r : |cff1e90ff" + GetUnitName(u) + "|r 被激光指示." )//显示信息英雄版
        else
            call DisplayTimedTextToPlayer( GetLocalPlayer(), 0.0, 0.0, 3.0, "|cfff3ad00" + GetPlayerName(GetOwningPlayer(u2)) + "|r : " + GetUnitName(u) + " 被激光指示." )//不带蓝色名字
        endif
    endif
    if newdesignation==1 and GetUnitTypeId(GetTriggerUnit())=='h00E' and udg_InitialPlayers>2 then//有flag并且释放技能的是飞机并且玩家数量大于2
        set udg_Experience[GetConvertedPlayerId(udg_PredatorPlayer)] = udg_Experience[GetConvertedPlayerId(udg_PredatorPlayer)] + 5.0//奖励经验值!?
    endif
    call AttachSoundToUnit(gg_snd_LaserDesignator,u)//跟随单位音效
    call SetSoundVolume(gg_snd_LaserDesignator, 127)
    call StartSound(gg_snd_LaserDesignator)
    call SetCameraQuickPosition(x,y)//镜头
    call PingMinimapEx(x, y, 5.0, 38, 100, 242, false)//小地图信号
    if GetUnitAbilityLevel(u2,'A022')>3 or GetUnitAbilityLevel(u2,'A01K')>3 then //Covert Ops and Recon (Learn)//隐蔽行动或者侦查技能大于3
        loop
            exitwhen i>8 or GetWidgetLife(u)<0.405//不停的小地图信号直到生命值太低或者计数到8
            call PolledWait(2.5)
            set x = GetUnitX(u)
            set y = GetUnitY(u)
            call SetCameraQuickPosition(x,y)
            call PingMinimapEx(x, y, 1.35, 38, 115, 242, false)
            call StartSound(gg_snd_HeartBeat)
            set i=i+1
        endloop
    endif
    set u = null
    set u2 = null
endfunction
回复

使用道具 举报

 楼主| 发表于 2015-5-9 12:39:35 | 显示全部楼层
照明弹
Flare
function FlareGunConditions takes nothing returns boolean
    local integer i = GetSpellAbilityId()
    return i=='A058' or i=='A00G' or i=='Afla'
endfunction//条件,三种照明弹

function FlareGun takes nothing returns nothing
    local unit u
    local player p = GetOwningPlayer(GetTriggerUnit())
    local location l = GetSpellTargetLoc()
    local real x = GetLocationX(l)
    local real y = GetLocationY(l)
    local integer i = 1//变量声明
    call PolledWait(0.6)
    if udg_Mode==3 then//模式3,不知道是什么-原来是死亡竞赛
        set u = CreateUnit(Player(9),'e00M',x,y,0.0)//给玩家9一个单位,这个单位是减速用的
    elseif udg_LostCause==false then//不是败局
        set u = CreateUnit(Player(0),'e00M',x,y,0.0)//同上
    endif
    call UnitApplyTimedLife(u,'Bhwd',7.0)//生命周期
    if udg_Mode==3 then //Deathmatch
        loop
            exitwhen i>udg_InitialPlayers//循环玩家创建视野单位
            if IsPlayerAlly(ConvertedPlayer(udg_Sorted),p) then//死亡竞赛下只创建给盟友
                set u = CreateUnit(ConvertedPlayer(udg_Sorted),'e002',x,y,0.0)
                call UnitApplyTimedLife(u,'Bhwd',15.0)
            endif
            call TriggerSleepAction(0.)
            set i=i+1
        endloop
    else
        loop
            exitwhen i>udg_Players
            set u = CreateUnit(ConvertedPlayer(udg_Sorted),'e002',x,y,0.0)
            call UnitApplyTimedLife(u,'Bhwd',15.0)
            call TriggerSleepAction(0.)
            set i=i+1
        endloop
    endif
    set u = CreateUnit(Player(9),'e002',x,y,0.0) //Civilians or Patrols in LC
    call UnitApplyTimedLife(u,'Bhwd',15.0)
    call TriggerSleepAction(0.)
    if udg_LostCause then
        set u = CreateUnit(Player(13),'e002',x,y,0.0) //Static Defense in LC
        call UnitApplyTimedLife(u,'Bhwd',15.0)
        call TriggerSleepAction(0.)
    endif
    set u = CreateUnit(Player(0),'e001',x,y,0.0)//创建光源
    call UnitApplyTimedLife(u,'Bhwd',14.0)//14秒
    call RemoveLocation(l)
    set l = null
    set u = null
endfunction
回复

使用道具 举报

 楼主| 发表于 2015-5-9 17:33:43 | 显示全部楼层
战刀
Combat Knife
function CombatKnifeConditions takes nothing returns boolean
    local integer i = GetSpellAbilityId()
    return i=='A04Y' or i=='A016' or i=='A02X' or i=='A07V' //first two knives and second two firearm//条件
endfunction

function CombatKnife takes nothing returns nothing
    local unit u = GetTriggerUnit()
    local player p = GetOwningPlayer(u)
    local integer i = GetConvertedPlayerId(p)
    local integer id = GetSpellAbilityId()
    local integer unitid = GetUnitTypeId(u)
    local force f = CreateForce()//变量
    call ForceAddPlayer(f,p)//把玩家加入玩家组
    set bj_meleeNearestMineDist = GetUnitX(u)
    set bj_lastTransmissionDuration = GetUnitY(u)
    set udg_soundpath = "war3mapImported\\CombatKnife.wav"//播放音效
    call ExecuteFunc("PlaySoundPath3D")//3D音效
    if (id=='A04Y' or id=='A016') and GetUnitAbilityLevel(u,'A04X')==0 then//如果没有战斗刀
        call UnitAddAbility(u,'A04X')//添加战刀实际效果
        if unitid=='H003' then //Designated Marksman
            call UnitRemoveAbility(u,'A016')//战斗刀技能删掉
            call UnitAddAbility(u,'A07V')//添加主要作战武器技能
        else
            call UnitRemoveAbility(u,'A04Y')
            call UnitAddAbility(u,'A02X')//这个是步枪的
        endif
        if udg_Reloading!=4 then//大概跟装弹有关
            set udg_Reloading = 5
        endif
        set udg_CombatKnife = true//flag=true
        call ShiftMoveSpeed(u,12.0)//加12点移动速度
        call DisplayTimedTextToPlayer(p,0.0,0.0,2.0, "|cff828250使用战刀|r" )
    elseif id=='A02X' or id=='A07V' then
        if unitid=='H003' then //Designated Marksman
            call UnitAddAbility(u,'A016')
            call UnitRemoveAbility(u,'A07V')
        else
            call UnitAddAbility(u,'A04Y')
            call UnitRemoveAbility(u,'A02X')
        endif
        call UnitRemoveAbility(u,'A04X')
        if udg_Reloading!=4 then
            if udg_Rounds==0 then
                if udg_Magazines==0 or GetUnitTypeId(udg_Hero)=='H000' then
                    set udg_Reloading = 3
                endif
            else
                set udg_Reloading = 0
            endif
        endif
        set udg_CombatKnife = false
        call ShiftMoveSpeed(u,-12.0)//减去12点移动速度
        call DisplayTimedTextToPlayer(p,0.0,0.0,2.0, "|cff828250使用主作战武器|r" )
    endif
    call DestroyForce(f)
    set f = null
    set u = null
endfunction
回复

使用道具 举报

 楼主| 发表于 2015-5-12 23:50:07 | 显示全部楼层
SMAW

SMAW
function SMAW takes nothing returns nothing
    local location l
    local unit u
    local integer id = GetSpellAbilityId()
    local integer i = GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))//变量声明
    if id=='A01D' or id=='A002' or id=='A036' then //Regular,HEDP,HEAA//判断是什么技能
        set l = GetSpellTargetLoc()
        set u = GetTriggerUnit()
        set udg_SMAWWarhead = ATTACK_TYPE_SIEGE//哎哟?看来火箭的伤害还分不同弹头的,有点厉害
        if udg_SectorClear==false then
            call FieldChat(u,2.0, udg_Pcolors + GetUnitName(GetTriggerUnit()) + "|r :爆炸!" )//漂浮文字,FieldChat应该是自己写的函数
        endif
        if id=='A01D' then
            call SMAW_Handler(u,l,3,1)//不明作用
        elseif id=='A002' then
            set udg_SMAWWarhead = ATTACK_TYPE_MAGIC
            call SMAW_Handler(u,l,udg_HEDP,2)//这里应该是判断不同的技能类型做处理,SMAW_Handler是效果函数
        else
            call SMAW_Handler(u,l,udg_HEAA,3)
        endif
        call PolledWait(5.)//等待五秒之后就排泄,完全不知道发生了什么
        call RemoveLocation(l)
        set l = null
        set u = null
    endif
endfunction

//===========================================================================
function InitTrig_SMAW takes nothing returns nothing
    set gg_trg_SMAW = CreateTrigger()
    call TriggerRegisterPlayerUnitEvent(gg_trg_SMAW, Player(9), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerRegisterPlayerUnitEvent(gg_trg_SMAW, Player(11), EVENT_PLAYER_UNIT_SPELL_EFFECT, null)
    call TriggerAddAction(gg_trg_SMAW,function SMAW)
endfunction//注册事件之类的

———————————————————————————————————————————
FieldChat

function FieldChat takes unit u, real time, string text returns nothing//接收参数单位,实数(持续时间),文本内容
    local texttag t
    local real x
    local real y
    if GetWidgetLife(u)>0.405 then//说话的单位活着
    set x = GetUnitX(u)
    set y = GetUnitY(u)
    call StartSound(gg_snd_Radio)//播放音效
    set t = CreateTextTag()//漂浮文字
    call SetTextTagText(t, text, 0.02)
    call SetTextTagPos(t, x, y, 35.0)
    call SetTextTagVisibility(t, true)
    call SetTextTagLifespan(t, time)
    call SetTextTagPermanent(t, false)
    endif
    set t = null
endfunction
回复

使用道具 举报

 楼主| 发表于 2015-5-13 00:11:22 | 显示全部楼层
function SMAW_Handler takes unit caster, location spelltarget, integer rpg_l, integer rockettype returns nothing
//参数为施法单位,释放目标,整数rpg_l(不知是啥),整数火箭类型
    local location cast_loc = GetUnitLoc(caster)
    local real x = GetUnitX(caster)
    local real y = GetUnitY(caster)
    local real missilespeed = 2500 //from unit SMAW missile
    local real dx = x - GetLocationX(spelltarget)
    local real dy = y - GetLocationY(spelltarget)
    local real arctime = (SquareRoot(dx*dx+dy*dy)/missilespeed) + 0.2
    local integer id = GetConvertedPlayerId(GetOwningPlayer(caster))
    local unit launcher//大串的变量声明
    call PolledWait(udg_SMAWLaunch[id])//等待火箭发射时间,每个玩家不同
    if GetWidgetLife(caster)<=0.405 then//施法单位挂了就结束
        call RemoveLocation(cast_loc)
        set cast_loc = null
        return
    endif
    call UnitAddAbility(caster,'A03F') //Lighting effect//发光特效
    set launcher = CreateUnitAtLoc(Player(11), 'hctw', cast_loc, 0.0 )//创建发射的马甲单位
    call UnitApplyTimedLife(launcher, 'Bhwd', 6.0)//设置生命周期
    call IssuePointOrderLoc( launcher, "attackground", spelltarget )//发布A地板命令
    if arctime>1.0 then//arctime是估计的火箭到达时间,如果大于1.o
        call TriggerSleepAction(1.0)
        call KillUnit(launcher)
        call TriggerSleepAction(arctime - 1.0)//不知道这一段干嘛
        call SMAW_Effect(spelltarget,caster,id,rpg_l,rockettype)//SMAW的效果,又是一个函数
    else
        call TriggerSleepAction(arctime)//如果arctime比1大就1,否则就arctime
        call SMAW_Effect(spelltarget,caster,id,rpg_l,rockettype)
        call TriggerSleepAction(1.0-arctime)
        call KillUnit(launcher)
    endif
    call RemoveLocation(cast_loc)
    set cast_loc = null
    call UnitRemoveAbility(caster,'A03F')//删掉闪光
    if GetWidgetLife(launcher)>0.405 then
        call RemoveUnit(launcher)
    endif
    set launcher = null
endfunction
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

QQ|Archiver|手机版|小黑屋|夜天使联盟论坛

GMT+8, 2026-10-5 19:43 , Processed in 0.017323 second(s), 15 queries .

Powered by Discuz! X5.0

© 2005-2025  技术支持 by 夜天使联盟.

快速回复 返回顶部 返回列表