|
楼主 |
发表于 2008-10-16 00:36:40
|
显示全部楼层
function H2I takes handle h returns integer
return h
return 0
endfunction
function I2U takes integer i returns unit
return i
return null
endfunction
function Dig2Str takes integer i returns string
if i == 1 then
return "1"
elseif i == 2 then
return "2"
elseif i == 3 then
return "3"
elseif i == 4 then
return "4"
elseif i == 5 then
return "5"
elseif i == 6 then
return "6"
elseif i == 7 then
return "7"
elseif i == 8 then
return "8"
elseif i == 9 then
return "9"
else
return "0"
endif
endfunction
function Int2Str takes integer ic returns string
local string s = ""
local integer i = ic
local integer ialt = 0
local boolean neg = false
if i == 0 then
return "0"
endif
if i < 0 then
set neg = true
set i = (-1)*i
endif
loop
exitwhen i == 0
set ialt = i
set i = i / 10
set s = Dig2Str( ialt - 10*i ) + s
endloop
if neg then
set s = "-"+s
endif
return s
endfunction
function StringFind takes string subject,string find,integer offset returns integer
local integer len = StringLength(find)
local integer pos = offset
local string s
local string str
if ( offset < 1 ) then
set pos = 1
endif
if ( find == "" ) then
return -1
endif
loop
set s = SubString(subject, pos-1, pos+len-1)
if ( s == find ) then
return pos
endif
if ( SubString(subject, pos-1, pos) == "" ) then
return -1
endif
set pos = pos + 1
endloop
return -1
endfunction
function RecordAbility takes integer uid,integer ab1,integer ab2,integer ab3,integer ab4,integer ab5 returns nothing
call StoreInteger(udg_GC,"HeroAbilities",I2S(uid)+"_1",ab1)
call StoreInteger(udg_GC,"HeroAbilities",I2S(uid)+"_2",ab2)
call StoreInteger(udg_GC,"HeroAbilities",I2S(uid)+"_3",ab3)
call StoreInteger(udg_GC,"HeroAbilities",I2S(uid)+"_4",ab4)
call StoreInteger(udg_GC,"HeroAbilities",I2S(uid)+"_5",ab5)
endfunction
function RecordLearn_sequence takes integer uid,string ls1,string ls2,string ls3,string ls4,string ls5 returns nothing
call StoreString(udg_GC,"learn_quence",I2S(uid)+"_1",ls1)
call StoreString(udg_GC,"learn_quence",I2S(uid)+"_2",ls2)
call StoreString(udg_GC,"learn_quence",I2S(uid)+"_3",ls3)
call StoreString(udg_GC,"learn_quence",I2S(uid)+"_4",ls4)
call StoreString(udg_GC,"learn_quence",I2S(uid)+"_5",ls5)
endfunction
function HeroLearnSkillAI takes unit hero,integer uid,integer level returns integer
local string array learn_sequence
local integer numofskill = 5
local integer array skills
local integer i = 1
local integer learnskill
set skills[1] = GetStoredInteger(udg_GC,"HeroAbilities",I2S(uid)+"_1")
set skills[2] = GetStoredInteger(udg_GC,"HeroAbilities",I2S(uid)+"_2")
set skills[3] = GetStoredInteger(udg_GC,"HeroAbilities",I2S(uid)+"_3")
set skills[4] = GetStoredInteger(udg_GC,"HeroAbilities",I2S(uid)+"_4")
set skills[5] = GetStoredInteger(udg_GC,"HeroAbilities",I2S(uid)+"_5")
set learn_sequence[1] = GetStoredString(udg_GC,"learn_quence",I2S(uid)+"_1")
set learn_sequence[2] = GetStoredString(udg_GC,"learn_quence",I2S(uid)+"_2")
set learn_sequence[3] = GetStoredString(udg_GC,"learn_quence",I2S(uid)+"_3")
set learn_sequence[4] = GetStoredString(udg_GC,"learn_quence",I2S(uid)+"_4")
set learn_sequence[5] = GetStoredString(udg_GC,"learn_quence",I2S(uid)+"_5")
loop
exitwhen i > numofskill
if StringFind(learn_sequence , "^" + Int2Str(level) + "^", 1) != -1 then
//trace msg
// if GetUnitAbilityLevel(hero,skills)==0 then
// call UnitAddAbility(hero,skills)
// else
// call IncUnitAbilityLevel(hero,skills)
// endif
call SelectHeroSkill(hero,skills)
call DisplayTimedTextToPlayer(GetLocalPlayer(), 0, 0, 3600, ( "学习 " + GetAbilityName(skills)+ "," + "目前技能等级为" +I2S(GetUnitAbilityLevel(hero,skills))))
return skills
endif
set i = i + 1
endloop
return 0
endfunction
function HeroMaxSkillAI takes unit hero returns nothing
local integer level = GetHeroLevel(hero)
local integer uid = GetUnitTypeId(hero)
local integer numofskill = 5
local integer i
local integer array skills
call ModifyHeroSkillPoints( hero, bj_MODIFYMETHOD_SET, level )
call HeroLearnSkillAI(hero,uid,1)
set i = 0
loop
set i = i + 1
exitwhen i>level
call HeroLearnSkillAI(hero,uid,i)
endloop
endfunction
这个了~~~你看下怎么把它弄进新建触发器里`~谢谢了~~~我快哭了```` |
|