找回密码
 点一下
查看: 2762|回复: 13

两个看不懂的东西

[复制链接]
发表于 2008-4-17 17:42:11 | 显示全部楼层 |阅读模式
1     call SetWidgetLife( )

2     set udg_Temp_Trigger=CreateTrigger()
发表于 2008-4-17 17:48:47 | 显示全部楼层
call SetWidgetLife( )

那个括号里应该有参数的吧?~~

这个函数需要提供2个参数~~第一个是widget型的(也就是所有的doodad和单位和物品都可以接受)~~第二个是实数型的变量~~就是要设置成的生命值数~~当然~~不能超过对象的最大生命值~~

总之这个函数可以给所有有生命值的单位设置当前生命值~~



第二句是说~~创建一个新触发~~然后用udg_Temp_Trigger这个触发器类型的变量来保存之~~
回复

使用道具 举报

发表于 2008-4-17 17:49:23 | 显示全部楼层
- -
上面那两个一个是自定义函数,另一个是用户定的义的变量---->Temp_Trigger
回复

使用道具 举报

发表于 2008-4-17 17:51:23 | 显示全部楼层
SetWidgetLife不是自定义函数啦~~它是一个cj函数~~所以楼主显然是漏参数了~~

[jass]
native  SetWidgetLife   takes widget whichWidget, real newLife returns nothing
[/jass]
回复

使用道具 举报

 楼主| 发表于 2008-4-17 17:52:40 | 显示全部楼层
   - -~~~

有没有工具可以翻译代码的意思啊,看不懂=。=
回复

使用道具 举报

发表于 2008-4-17 17:55:34 | 显示全部楼层
基本上~~函数都可以望文生义~~

把函数名中每个大写字母视作新单词的开头~~那么

Set 设置
Widget 物件
Life 生命

望文生义一下就能猜出作用来了~~碰到真的理解不了的话~~还可以来这里问嗯嗯~~
回复

使用道具 举报

 楼主| 发表于 2008-4-17 18:04:38 | 显示全部楼层
正在学习JASS

我想先试试把JASS翻译回触发,希望这样可以对代码加深点记忆

这几天一直在翻译澄海的JASS

大部分都能勉强翻译的回来,就是暗影猎手的30级技能看不懂

Renee大人救救我

=。=
回复

使用道具 举报

发表于 2008-4-18 07:13:07 | 显示全部楼层
首先~~我可不知道那dota"暗影猎手的30级技能"是啥东西~~

你起码给段代码或者给张图罢?~~
回复

使用道具 举报

 楼主| 发表于 2008-4-18 09:10:08 | 显示全部楼层


大大,偶说的是澄海的暗影猎手30呀

代码如下

[jass]
unit array udg_Divine_Unit1
unit array udg_Divine_Unit2

trigger gg_trg_Divine_Cast=CreateTrigger()
trigger gg_trg_Divine_Action=CreateTrigger()
trigger gg_trg_Divine_End=CreateTrigger()
trigger gg_trg_Divine_Cast_Action=CreateTrigger()
trigger gg_trg_Divine_Cast_End=CreateTrigger()

function Trig_Divine_Cast_Conditions takes nothing returns boolean
return(GetSpellAbilityId()=='A043')
endfunction
function Trig_Divine_Cast_Func013Func002002001002003 takes nothing returns boolean
return(IsUnitEnemy(GetFilterUnit(),GetOwningPlayer(GetTriggerUnit())))
endfunction

function Trig_Divine_Cast_Actions takes nothing returns nothing
set udg_Temp_Trigger=CreateTrigger()
call TriggerExecute(gg_trg_Divine_Action)
call UnitAddAbility(udg_Init_Hero_Unit[15],'Amrf')
call UnitRemoveAbility(udg_Init_Hero_Unit[15],'Amrf')
call SetUnitFlyHeight(udg_Init_Hero_Unit[15],300.,100.)
call TriggerRegisterUnitEvent(udg_Temp_Trigger,udg_Init_Hero_Unit[15],EVENT_UNIT_SPELL_ENDCAST)
call TriggerRegisterUnitEvent(udg_Temp_Trigger,udg_Init_Hero_Unit[15],EVENT_UNIT_SPELL_FINISH)
set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=5
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
set udg_Temp_Point=PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()),350.,(I2R(bj_forLoopAIndex)*72.))
call CreateNUnitsAtLoc(1,'e00N',GetOwningPlayer(GetTriggerUnit()),udg_Temp_Point,bj_UNIT_FACING)
call RemoveLocation(udg_Temp_Point)
set udg_Divine_Unit1[bj_forLoopAIndex]=bj_lastCreatedUnit
call UnitRemoveAbility(udg_Divine_Unit1[bj_forLoopAIndex],'Aloc')
call UnitApplyTimedLifeBJ(30.,'BTLF',bj_lastCreatedUnit)
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
set bj_forLoopAIndex=6
set bj_forLoopAIndexEnd=15
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
set udg_Temp_Point=GetUnitLoc(GetTriggerUnit())
call CreateNUnitsAtLoc(1,'e00N',GetOwningPlayer(GetTriggerUnit()),udg_Temp_Point,bj_UNIT_FACING)
call RemoveLocation(udg_Temp_Point)
call SetUnitFlyHeight(bj_lastCreatedUnit,300.,100.)
call UnitApplyTimedLifeBJ(30.,'BTLF',bj_lastCreatedUnit)
set udg_Divine_Unit1[bj_forLoopAIndex]=bj_lastCreatedUnit
call ShowUnitHide(bj_lastCreatedUnit)
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
loop
exitwhen GetTriggerEvalCount(udg_Temp_Trigger)>0
set bj_forLoopAIndex=6
set bj_forLoopAIndexEnd=10
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
call SetWidgetLife(udg_Divine_Unit1[(bj_forLoopAIndex-5)],1.)
call IssueImmediateOrderById(udg_Divine_Unit1[bj_forLoopAIndex],851972)
call IssueTargetOrderById(udg_Divine_Unit1[bj_forLoopAIndex],852501,udg_Divine_Unit1[(bj_forLoopAIndex-5)])
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
set bj_forLoopAIndex=11
set bj_forLoopAIndexEnd=15
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
call IssueImmediateOrderById(udg_Divine_Unit1[bj_forLoopAIndex],851972)
set udg_Temp_Unit=GroupPickRandomUnit(GetRandomSubGroup(1,GetUnitsInRangeOfLocMatching(1200.,GetUnitLoc(GetTriggerUnit()),Condition(function Trig_Divine_Cast_Func013Func002002001002003))))
call IssueTargetOrderById(udg_Divine_Unit1[bj_forLoopAIndex],852119,udg_Temp_Unit)
set udg_Temp_Unit=null
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
call TriggerSleepAction(1.)
set udg_Temp_Point=GetUnitLoc(udg_Divine_Unit1[3])
call IssuePointOrderByIdLoc(udg_Divine_Unit1[1],851986,udg_Temp_Point)
call RemoveLocation(udg_Temp_Point)
set udg_Temp_Point=GetUnitLoc(udg_Divine_Unit1[5])
call IssuePointOrderByIdLoc(udg_Divine_Unit1[3],851986,udg_Temp_Point)
call RemoveLocation(udg_Temp_Point)
set udg_Temp_Point=GetUnitLoc(udg_Divine_Unit1[2])
call IssuePointOrderByIdLoc(udg_Divine_Unit1[5],851986,udg_Temp_Point)
call RemoveLocation(udg_Temp_Point)
set udg_Temp_Point=GetUnitLoc(udg_Divine_Unit1[4])
call IssuePointOrderByIdLoc(udg_Divine_Unit1[2],851986,udg_Temp_Point)
call RemoveLocation(udg_Temp_Point)
set udg_Temp_Point=GetUnitLoc(udg_Divine_Unit1[1])
call IssuePointOrderByIdLoc(udg_Divine_Unit1[4],851986,udg_Temp_Point)
call RemoveLocation(udg_Temp_Point)
call TriggerSleepAction(1.33)
endloop
call SetUnitFlyHeight(udg_Init_Hero_Unit[16],.0,.0)
call TriggerSleepAction(2)
set udg_Temp_Trigger=null
endfunction

function Trig_Divine_Action_Actions takes nothing returns nothing
set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=50
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
set udg_Temp_Point=PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()),300.,(I2R(bj_forLoopAIndex)*20.))
call CreateNUnitsAtLoc(1,'e00M',GetOwningPlayer(GetTriggerUnit()),udg_Temp_Point,bj_UNIT_FACING)
call RemoveLocation(udg_Temp_Point)
set udg_Divine_Unit2[bj_forLoopAIndex]=bj_lastCreatedUnit
call UnitApplyTimedLifeBJ(30.,'BTLF',bj_lastCreatedUnit)
call SetUnitFlyHeight(udg_Divine_Unit2[bj_forLoopAIndex],(I2R(bj_forLoopAIndex)*10.),.0)
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
loop
exitwhen GetTriggerEvalCount(udg_Temp_Trigger)>0
set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=49
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
call SetUnitFlyHeight(udg_Divine_Unit2[bj_forLoopAIndex],(GetUnitFlyHeight(udg_Divine_Unit2[bj_forLoopAIndex])+10.),100.)
set udg_Temp_Point=PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()),300.,((I2R(bj_forLoopAIndex)*20.)+20.))
call IssuePointOrderByIdLoc(udg_Divine_Unit2[bj_forLoopAIndex],851986,udg_Temp_Point)
call RemoveLocation(udg_Temp_Point)
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
call RemoveUnit(udg_Divine_Unit2[50])
call TriggerSleepAction(.1)
set udg_i=50
loop
exitwhen udg_i==1
set udg_Divine_Unit2[udg_i]=udg_Divine_Unit2[(udg_i-1)]
set udg_i=(udg_i-1)
endloop
set udg_Temp_Point=PolarProjectionBJ(GetUnitLoc(GetTriggerUnit()),300.,0)
call CreateNUnitsAtLoc(1,'e00M',GetOwningPlayer(GetTriggerUnit()),udg_Temp_Point,bj_UNIT_FACING)
call UnitApplyTimedLifeBJ(30.,'BTLF',bj_lastCreatedUnit)
call RemoveLocation(udg_Temp_Point)
set udg_Divine_Unit2[1]=bj_lastCreatedUnit
endloop
call SetUnitFlyHeight(udg_Init_Hero_Unit[16],.0,.0)
set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=15
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
call RemoveUnit(udg_Divine_Unit1[bj_forLoopAIndex])
set udg_Divine_Unit1[bj_forLoopAIndex]=null
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=50
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
call RemoveUnit(udg_Divine_Unit2[bj_forLoopAIndex])
set udg_Divine_Unit2[bj_forLoopAIndex]=null
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
endfunction

function Trig_Divine_End_Conditions takes nothing returns boolean
return(GetSpellAbilityId()=='A043')
endfunction
function Trig_Divine_End_Actions takes nothing returns nothing
call SetUnitFlyHeight(udg_Init_Hero_Unit[15],.0,.0)
call DisableTrigger(gg_trg_Divine_Action)
set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=15
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
call RemoveUnit(udg_Divine_Unit1[bj_forLoopAIndex])
set udg_Divine_Unit1[bj_forLoopAIndex]=null
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=50
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
call RemoveUnit(udg_Divine_Unit2[bj_forLoopAIndex])
set udg_Divine_Unit2[bj_forLoopAIndex]=null
set bj_forLoopAIndex=bj_forLoopAIndex+1
endloop
call TriggerSleepAction(30.)
call EnableTrigger(gg_trg_Divine_Action)
endfunction

function Trig_Divine_Cast_Action_Conditions takes nothing returns boolean
return(GetSpellAbilityId()=='A043')
endfunction

function Trig_Divine_Cast_Action_Func001Func001C takes nothing returns boolean
return(IsUnitAlly(GetTriggerUnit(),Player(5)))
endfunction

function Trig_Divine_Cast_Action_Func001C takes nothing returns boolean
return(GetPlayerController(GetOwningPlayer(GetTriggerUnit()))==MAP_CONTROL_COMPUTER)
endfunction

function Trig_Divine_Cast_Action_Func007Func001Func001Func001C takes nothing returns boolean
return(IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO))and(IsUnitInGroup(GetTriggerUnit(),udg_AI_Hero_Group_Light))and(IsPlayerInForce(GetOwningPlayer(GetTriggerUnit()),udg_AI_Player_Light))and(UnitHasItemOfTypeBJ(GetTriggerUnit(),'ssil'))
endfunction

function Trig_Divine_Cast_Action_Func007Func001Func001C takes nothing returns boolean
return(IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO))and(IsUnitInGroup(GetTriggerUnit(),udg_AI_Hero_Group_Dark))and(IsPlayerInForce(GetOwningPlayer(GetTriggerUnit()),udg_AI_Player_Dark))and(UnitHasItemOfTypeBJ(GetTriggerUnit(),'ssil'))
endfunction

function Trig_Divine_Cast_Action_Func007Func001A takes nothing returns nothing
if(Trig_Divine_Cast_Action_Func007Func001Func001C())then
call UnitUseItemPointLoc(GetEnumUnit(),GetItemOfTypeFromUnitBJ(GetEnumUnit(),'ssil'),udg_AI_Silence_Point)
return
else
if(Trig_Divine_Cast_Action_Func007Func001Func001Func001C())then
call UnitUseItemPointLoc(GetEnumUnit(),GetItemOfTypeFromUnitBJ(GetEnumUnit(),'ssil'),udg_AI_Silence_Point)
return
endif
endif
endfunction

function Trig_Divine_Cast_Action_Func007C takes nothing returns boolean
return((1+GetPlayerId(GetOwningPlayer(GetTriggerUnit())))<7)
endfunction

function Trig_Divine_Cast_Action_Actions takes nothing returns nothing
if(Trig_Divine_Cast_Action_Func001C())then
if(Trig_Divine_Cast_Action_Func001Func001C())then
call GroupRemoveUnit(udg_AI_Hero_Group_Light,GetTriggerUnit())
else
call GroupRemoveUnit(udg_AI_Hero_Group_Light,GetTriggerUnit())
endif
endif
call SetUnitInvulnerable(GetTriggerUnit(),true)
call TriggerSleepAction(3.)
call SetUnitInvulnerable(GetTriggerUnit(),false)
set udg_AI_Silence_Point=GetUnitLoc(GetTriggerUnit())
set udg_AI_Silence_Range=1500.
if(Trig_Divine_Cast_Action_Func007C())then
call ForGroupBJ(GetUnitsInRangeOfLocAll(udg_AI_Silence_Range,udg_AI_Silence_Point),function Trig_Divine_Cast_Action_Func007Func001A)
endif
endfunction

function Trig_Divine_Cast_End_Conditions takes nothing returns boolean
return(GetSpellAbilityId()=='A043')
endfunction

function Trig_Divine_Cast_End_Func002Func001C takes nothing returns boolean
return(IsUnitAlly(GetTriggerUnit(),Player(5)))
endfunction

function Trig_Divine_Cast_End_Func002C takes nothing returns boolean
return(GetPlayerController(GetOwningPlayer(GetTriggerUnit()))==MAP_CONTROL_COMPUTER)
endfunction

function Trig_Divine_Cast_End_Actions takes nothing returns nothing
call SetUnitInvulnerable(GetTriggerUnit(),false)
if(Trig_Divine_Cast_End_Func002C())then
if(Trig_Divine_Cast_End_Func002Func001C())then
call GroupAddUnit(udg_AI_Hero_Group_Light,GetTriggerUnit())
call IssuePointOrderByIdLoc(GetTriggerUnit(),851983,udg_Region_Centers[5])
else
call GroupAddUnit(udg_AI_Hero_Group_Dark,GetTriggerUnit())
call IssuePointOrderByIdLoc(GetTriggerUnit(),851983,udg_Region_Centers[1])
endif
endif
endfunction

call TriggerRegisterUnitEvent(gg_trg_Divine_Cast,gg_unit_Oshd_0341,EVENT_UNIT_SPELL_EFFECT)
call TriggerAddCondition(gg_trg_Divine_Cast,Condition(function Trig_Divine_Cast_Conditions))
call TriggerAddAction(gg_trg_Divine_Cast,function Trig_Divine_Cast_Actions)
call TriggerAddAction(gg_trg_Divine_Action,function Trig_Divine_Action_Actions)
call TriggerRegisterUnitEvent(gg_trg_Divine_End,gg_unit_Oshd_0341,EVENT_UNIT_SPELL_FINISH)
call TriggerRegisterUnitEvent(gg_trg_Divine_End,gg_unit_Oshd_0341,EVENT_UNIT_SPELL_ENDCAST)
call TriggerAddCondition(gg_trg_Divine_End,Condition(function Trig_Divine_End_Conditions))
call TriggerAddAction(gg_trg_Divine_End,function Trig_Divine_End_Actions)
call TriggerRegisterUnitEvent(gg_trg_Divine_Cast_Action,gg_unit_Oshd_0341,EVENT_UNIT_SPELL_CAST)
call TriggerAddCondition(gg_trg_Divine_Cast_Action,Condition(function Trig_Divine_Cast_Action_Conditions))
call TriggerAddAction(gg_trg_Divine_Cast_Action,function Trig_Divine_Cast_Action_Actions)
call TriggerRegisterUnitEvent(gg_trg_Divine_Cast_End,gg_unit_Oshd_0341,EVENT_UNIT_SPELL_ENDCAST)
call TriggerRegisterUnitEvent(gg_trg_Divine_Cast_End,gg_unit_Oshd_0341,EVENT_UNIT_SPELL_FINISH)
call TriggerAddCondition(gg_trg_Divine_Cast_End,Condition(function Trig_Divine_Cast_End_Conditions))
call TriggerAddAction(gg_trg_Divine_Cast_End,function Trig_Divine_Cast_End_Actions)
[/jass]
回复

使用道具 举报

发表于 2008-4-18 09:28:58 | 显示全部楼层
好吧~~不管澄海还是dota我都一样不知道~~

先帮你看看罢~~但是你不明白的地方究竟在哪里呢?~~
回复

使用道具 举报

 楼主| 发表于 2008-4-18 09:31:27 | 显示全部楼层
几个尤其看不懂的地方

set udg_Temp_Trigger=CreateTrigger()

loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd

尤其是这个loop,理了好久都没理明白


set bj_forLoopAIndex=1
set bj_forLoopAIndexEnd=15
loop
exitwhen bj_forLoopAIndex>bj_forLoopAIndexEnd
这样的ForA循环,我倒是可以看明白
回复

使用道具 举报

发表于 2008-4-18 10:01:19 | 显示全部楼层
loop就是循环的意思呀~~
从loop到endloop之间的就是循环的内容,exitwhen后面的就是跳出循环的条件,恩~~
回复

使用道具 举报

 楼主| 发表于 2008-4-18 10:02:42 | 显示全部楼层


说错了
应该是这个不懂

loop
exitwhen GetTriggerEvalCount(udg_Temp_Trigger)>0
回复

使用道具 举报

发表于 2008-4-18 10:06:18 | 显示全部楼层
貌似是udg_Temp_Trigger触发条件判断次数超过0就退出循环吧
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-11-22 04:01 , Processed in 0.033498 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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