: 27)

声明时钟的代码:

unit Q2;

inte**ce

  uses Classes, SysUtils;

procedure Main(Npc: TNormNpc; Player: TPlayObject; Args: TArgs);

implementation

procedure Main(Npc: TNormNpc; Player: TPlayObject; Args: TArgs);

begin   

  //增加一个无限循环的时钟,需要使用ClearDelayGoto来停止时钟

  Player.DelayGoto(100{时钟ID}, 60{执行时钟的间隔时间}, True{切换地图时时钟失效且被删除}, False{不是一个只执行一次的时钟});

  Player.ClearDelayGoto(100);

  //增加一个值使用一次的时钟,不需要手工清除

  Player.DelayGoto(101{时钟ID}, 60{执行时钟的间隔时间}, False{切换地图时时钟不失效}, True{只执行一次});

  //个人时钟执行时候调用TimeManageNpc单元的PrivyEventExecute函数,个人时钟移除时调用TimeManageNpc的PrivyEventRemove函数

end;

end.

时钟NPC执行代码:

unit TimeManageNpc;

inte**ce

  uses Classes, SysUtils, DefiniensConst, Q38;

//个人的时钟事件

procedure PrivyEventExecute(Npc: TNormNpc; Player: TPlayObject; TimeID: Integer);

procedure PrivyEventRemove(Npc: TNormNpc; Player: TPlayObject; TimeID: Integer);

//全局的时钟事件

procedure GlobalEventExecute(Npc: TNormNpc; TimeID: Integer);   

procedure GlobalEventRemove(Npc: TNormNpc; TimeID: Integer);   

implementation

procedure PrivyEventExecute(Npc: TNormNpc; Player: TPlayObject; TimeID: Integer);

begin

  case TimeID of

   100: Player.Messagebox(‘100:时钟被执行’);  

    101: Player.Messagebox(‘101:时钟被执行’);

  end;

end;

procedure PrivyEventRemove(Npc: TNormNpc; Player: TPlayObject; TimeID: Integer);

begin

  case TimeID of

   100: Player.Messagebox(‘100:时钟结束’);  

    101: Player.Messagebox(‘101:时钟结束’);

  end;

end;

procedure GlobalEventExecute(Npc: TNormNpc; TimeID: Integer);

begin

  //这个是全局时钟执行的地方

end;

procedure GlobalEventRemove(Npc: TNormNpc; TimeID: Integer);

begin

  //这个是全局时钟结束

end;

end.

注:时钟需要配合TimeManageNpc使用

声明:本站所有文章,任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们(hljlife@vip.qq.com)进行处理。

本站所有资源来源于网络,本站未参与任何dump或hack活动。若有侵犯您的权益请提供相关证明致邮hljlife@vip.qq.com,我将及时撤下该资源。

All resources come from the network, this site does not participate in any dump or hack activities, if there is any violation of your rights, please provide relevant proof and email hljlife@vip.qq.com, I will promptly delete it.

如果下载资源文件后缀为.PDF,请删除后缀.PDF之后运行。

部分失效链接可通过文末填写有效邮箱到Email输入框留言索取。

免责声明:游戏资源均来自网络收集购买,不保证BUG,不保证病毒,不解答游戏问题(传奇服务端提供付费架设服务),为了安全,请尽量选择虚拟机运行服务端。