找回密码
 点一下
查看: 2825|回复: 5

新手发贴。限制召唤单位数量,达到上限则替换生命最少(优先)的或最早召唤的。

[复制链接]
发表于 2009-4-3 18:26:39 | 显示全部楼层 |阅读模式
技能描述:召唤一朵花。持续时间无限。上限为7/10/13/16个。
达到上限则替换生命最少的或最早召唤的,优先替换生命最少的。。。

一个变量udg_GC游戏缓存


function hua2J takes nothing returns nothing
local unit u
local unit array uu
local integer int
local integer i
local integer num
if GetUnitTypeId(GetSummonedUnit()) == 'oeye' then
set i = GetStoredInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetSummoningUnit()))),"I")
set num = GetStoredInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetSummoningUnit()))),"NUM")
set i = i + 1
call SetUnitUserData(GetSummonedUnit(),i)
call StoreInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetSummoningUnit()))),"I",i)
call StoreInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetSummoningUnit()))),"Flowers"+I2S(i),H2I(GetSummonedUnit()))
if i > num then
set int = 1
loop
exitwhen int > num
set uu[int] = I2U(GetStoredInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetSummoningUnit()))),"Flowers"+I2S(int)))
set int = int + 1
endloop
set u = uu[1]
set int = 1
loop
exitwhen int > num
if GetUnitLifePercent(u) > GetUnitLifePercent(uu[int]) then
set u = uu[int]
endif
set int = int+1
endloop
call KillUnit(u)
set int = 1
loop
exitwhen int > num
set uu[int] = null
set int = int+1
endloop
set u = null
endif
endif
endfunction

function hua1J takes nothing returns nothing
local integer num
if GetLearnedSkill() == 'AHwe' then
set num = GetStoredInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))),"NUM")
set num = ( num + 3 )
call StoreInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetLearningUnit()))),"NUM",num)
endif
endfunction

function Trig_huahua_Conditions takes nothing returns nothing
local trigger hua1 = CreateTrigger()
local trigger hua2 = CreateTrigger()
if GetUnitTypeId(GetSoldUnit()) == 'Hamg' then
call StoreInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetSoldUnit()))),"I",0)
call StoreInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetSoldUnit()))),"NUM",4)
call TriggerRegisterUnitEvent(hua1,GetSoldUnit(),EVENT_UNIT_HERO_SKILL)
call TriggerRegisterUnitEvent(hua2,GetSoldUnit(),EVENT_UNIT_SUMMON)
call TriggerAddCondition(hua1,Condition(function hua1J))
call TriggerAddCondition(hua2,Condition(function hua2J))
endif
set hua1 = null
set hua2 = null
endfunction
//===========================================================================
function InitTrig_huahua takes nothing returns nothing
set gg_trg_huahua = CreateTrigger( )
call TriggerRegisterAnyUnitEventBJ( gg_trg_huahua, EVENT_PLAYER_UNIT_SELL )
call TriggerAddCondition( gg_trg_huahua, Condition( function Trig_huahua_Conditions ) )
endfunction
//===========================================================================
function huasi takes nothing returns nothing
    local integer n
    local integer int
    local integer i
    local unit array uu
    if GetUnitTypeId(GetDyingUnit()) == 'oeye' then
        set i = GetStoredInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))),"I")
        set int = GetUnitUserData(GetDyingUnit())
        set n = int
        loop
            exitwhen n > i
            set uu[n] = I2U(GetStoredInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))),"Flowers"+I2S(n+1)))
            call SetUnitUserData(uu[n],n)
            call StoreInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))),"Flowers"+I2S(n),H2I(uu[n]))
            set n = n + 1
        endloop
        set i = i - 1
        call StoreInteger(udg_GC,"Uxiang"+I2S(GetConvertedPlayerId(GetOwningPlayer(GetDyingUnit()))),"I",i)
    endif
endfunction
//===========================================================================
function InitTrig_huasi takes nothing returns nothing
    set gg_trg_huasi = CreateTrigger(  )
    call TriggerRegisterAnyUnitEventBJ( gg_trg_huasi, EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddCondition( gg_trg_huasi, Condition( function huasi ) )
endfunction

U香.w3x

25 KB, 下载次数: 32

评分

参与人数 1威望 +500 收起 理由
eff + 500 很好很好

查看全部评分

 楼主| 发表于 2009-4-3 18:27:31 | 显示全部楼层
2个T完全可以合成1个,而且还可以更加纯洁,但偶懒。。。。。偶又新手,于是忽略。。。
回复

使用道具 举报

发表于 2011-6-28 12:51:40 | 显示全部楼层
你为什么要改成文本格式呢?   真垃圾    难道怕别人学会了?
回复

使用道具 举报

发表于 2011-6-28 13:25:30 | 显示全部楼层
楼上真搞笑……
难道你不知道有种东西叫Jass吗?
回复

使用道具 举报

发表于 2011-6-28 18:25:17 | 显示全部楼层
      你可以把漠漠的东西转成Jass 试试 会气死你的
回复

使用道具 举报

发表于 2011-7-3 20:17:38 | 显示全部楼层
LSSS是为了展示自己的无知特此挖坟的么
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 点一下

本版积分规则

Archiver|移动端|小黑屋|地精研究院

GMT+8, 2024-12-22 15:02 , Processed in 0.170454 second(s), 25 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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