找回密码
 点一下
查看: 1776|回复: 35

又来发问了,这J有错误吗?

[复制链接]
发表于 2008-8-14 00:48:21 | 显示全部楼层 |阅读模式
[codes=jass]function InitTrig_rh takes nothing returns nothing
local trigger tri0 = CreateTrigger()
local trigger tri1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(tri0,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(tri0,Condition(function tiaojian))
call TriggerAddAction(tri0,function fh)
call TriggerRegisterAnyUnitEventBJ(tri1,EVENT_PLAYER_HERO_REVIVE_FINISH)
call TriggerAddCondition(tri1,Condition(function tiaojian))
call TriggerAddAction(tri1,function Revive)
set tri0 = null
set tri1 = null
endfunction[/codes]



我这样写Revive这个动作没有运行,我想让Revive这个动作运行,可是怎么写我不知道啊.求助了.
发表于 2008-8-14 00:54:16 | 显示全部楼层
应该没有错误,只要函数名没错
回复

使用道具 举报

 楼主| 发表于 2008-8-14 01:01:34 | 显示全部楼层
[codes=jass]function tiaojian takes nothing returns boolean
if (not(IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO) == true)) then
return false
endif
return true
endfunction

function jishiqi takes nothing returns nothing
local unit u =I2U(GetStoredInteger(GameCache(),I2S(H2I(GetExpiredTimer())),"TriggerUnit"))
if (not(IsUnitAlly(u,Player(11)) == true)) then
call ReviveHeroLoc(u,GetRectCenter(gg_rct______________020),false)
else
call ReviveHeroLoc(u,GetRectCenter(gg_rct______________021),false)
endif
call SetUnitManaPercentBJ(u,100)
set u = null
endfunction

function fh takes nothing returns nothing
local unit u = GetTriggerUnit()
local timer t = CreateTimer()
local timerdialog td = CreateTimerDialog(t)
call TimerDialogSetTitle(td, GetPlayerName(GetOwningPlayer(GetTriggerUnit())) + "复活时间:" )
call StoreInteger(GameCache(),I2S(H2I(t)),"TriggerUnit",H2I(GetTriggerUnit()))
call StoreInteger(GameCache(),I2S(H2I(t)),"Timer",H2I(t))
call StoreInteger(GameCache(),I2S(H2I(t)),"TimerDialog",H2I(td))
call TimerStart(t,180,false,function jishiqi)
call TimerDialogDisplay(td,true)
call PlaySoundBJ(udg_shengyin[GetRandomInt(1,12)])
set u = null
set t = null
set td = null
endfunction

function Revive takes nothing returns nothing
local timer t = I2T(GetStoredInteger(GameCache(),I2S(H2I(GetExpiredTimer())),"Timer"))
local timerdialog td = I2TD(GetStoredInteger(GameCache(),I2S(H2I(GetExpiredTimer())),"TimerDialog"))
call DestroyTimerDialog(td)
call PauseTimer(t)
call DestroyTimer(t)
call FlushStoredMission(GameCache(), I2S(H2I(GetExpiredTimer())))
set t = null
set td = null
endfunction

function InitTrig_rh takes nothing returns nothing
local trigger tri0 = CreateTrigger()
local trigger tri1 = CreateTrigger()
call TriggerRegisterAnyUnitEventBJ(tri0,EVENT_PLAYER_UNIT_DEATH)
call TriggerAddCondition(tri0,Condition(function tiaojian))
call TriggerAddAction(tri0,function fh)
call TriggerRegisterAnyUnitEventBJ(tri1,EVENT_PLAYER_HERO_REVIVE_FINISH)
call TriggerAddCondition(tri1,Condition(function tiaojian))
call TriggerAddAction(tri1,function Revive)
set tri0 = null
set tri1 = null
endfunction[/codes]

可是没有运行Revive的这个动作啊...
回复

使用道具 举报

发表于 2008-8-14 01:17:30 | 显示全部楼层
哪来的GetExpiredTimer………………

复活英雄做事件怎么可能得到到期的计时器………………
回复

使用道具 举报

 楼主| 发表于 2008-8-14 01:20:50 | 显示全部楼层
不是得到 "到期的计时器" ,那么得到什么?其实我也在想,可是没想到.
回复

使用道具 举报

发表于 2008-8-14 01:22:21 | 显示全部楼层
这个跟触发是一样的,你在英雄完成复活做事件的触发里能得到什么这里也能得到什么,一般就一个触发单位而已

删除计时器的内容写在jishiqi那个函数里就好了
回复

使用道具 举报

 楼主| 发表于 2008-8-14 01:43:23 | 显示全部楼层
搞不懂,我做的是,计时器没到期,英雄复活了,那个计时期窗口就删掉.可以怎么做就不清楚了.
回复

使用道具 举报

发表于 2008-8-14 02:08:55 | 显示全部楼层
没想到LZ过了这么长时间还在弄这个英雄复活


很明显你还不理解这些代码是怎么工作的,所以您还是把原来的例子拿来慢慢研究,逐个弄清每个函数的意思和作用,先把基础打好再来写这个
回复

使用道具 举报

 楼主| 发表于 2008-8-14 13:53:10 | 显示全部楼层
我最初学JASS的目的就是为了做复活系统,所以一定要做完这个复活.

我是不太懂工作原理的;尤其是Gamecache这里,可我找不到内容.

我现在有这个思路:我把计时器绑到死亡的单位上,当单位完成复活,就把计时器和计时器窗口X掉,可是令我头疼的就是这个怎么绑.
回复

使用道具 举报

发表于 2008-8-14 14:07:06 | 显示全部楼层
删除计时器放在计时器到期的那个函数里
回复

使用道具 举报

 楼主| 发表于 2008-8-14 14:09:05 | 显示全部楼层
这个我放了进去了,不放不运行的
回复

使用道具 举报

发表于 2008-8-14 14:10:41 | 显示全部楼层
我开始听不懂了,revive这个函数根本就没有任何效果也没有任何意义额………………
回复

使用道具 举报

 楼主| 发表于 2008-8-14 14:16:16 | 显示全部楼层
那么,我说下我的思路啊,单位死亡,运行  fh   ,然后计时器到期,就复活英雄,因为我上面写了单位完成复活事件,当单位复活了后就运行 revive 这个,为什么我要这样呢,因为,如果计时器没到期,英雄就复活了,那么那个计时器窗口还是会在的.所以我就这样写.我想做的就是不等到计时器到期才删那个窗口和停止没到期的计时器.
回复

使用道具 举报

发表于 2008-8-14 14:18:14 | 显示全部楼层
哦哦,有提前复活的方法啊

这样的话就要做单位和计时器的双向挂钩了,光计时器挂钩单位是不行的
回复

使用道具 举报

 楼主| 发表于 2008-8-14 14:25:16 | 显示全部楼层
但是我不知道该怎么写啊.
回复

使用道具 举报

发表于 2008-8-14 14:30:07 | 显示全部楼层
把timer改成trigger就成了
回复

使用道具 举报

 楼主| 发表于 2008-8-14 14:35:58 | 显示全部楼层
首先我问个问题先.
call StoreInteger(GameCache(),I2S(H2I(t)),"TriggerUnit",H2I(GetTriggerUnit()))

local unit u = I2U(GetStoredInteger(GameCache(),I2S(H2I(GetExpiredTimer())),"TriggerUnit"))

把I2S(H2I(GetExpiredTimer()改为I2S(H2I(t)  可不可行的?  关于缓存问题我没搞明白,
回复

使用道具 举报

 楼主| 发表于 2008-8-14 15:26:38 | 显示全部楼层
怎么没人理我的.楼上的东西是不可行的.我是想问,有没一些内容是讲解关于缓存的东西.
回复

使用道具 举报

发表于 2008-8-14 15:33:49 | 显示全部楼层
为什么2个触发...
不能写在 TimerStart运行的函数里面么
回复

使用道具 举报

 楼主| 发表于 2008-8-14 15:40:12 | 显示全部楼层
TimerStart?  不清楚, 我现在都不知道自己在写些什么了.
回复

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-7-21 04:17 , Processed in 0.270313 second(s), 18 queries .

Powered by Discuz! X3.5

© 2001-2023 Discuz! Team.

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