战神引擎php,战神引擎常用脚本接口

83da378c315142df455a3cf2ada96768.png

GowLom2战神引擎常用脚本接口

给物品 :

This_Player.Give('屠龙',2);

***给物品前务必判断包裹中是否有足够的空间,否则将不能给予物品,但相应货币或者材料将会正常扣除***

空包裹:

This_Player.FreeBagNum

如要给玩家2个屠龙,屠龙不可堆叠,所以至少需要两个包裹空位:

if This_Player.FreeBagNum >= 2 then

This_Player.Give('屠龙',2);

包裹中物品数量:

This_Player.GetBagItemCount('物品')

扣除物品

This_Player.Take('屠龙',2');

***扣除物品前物品判断包裹中是否有足够的物品,切记在扣除的方法中判断***

if This_Player.GetBagItemCount ('屠龙') >= 2 then

This_Player.Take('屠龙',2');

随机数:

random(x) 返回值为0到 x-1 中的随机一个整数数

比如random(10) 返回值为0-9 中随机一个整数

*综合以上常用接口,活动为使用100个金刚石可抽取随机一个武器,1%的概率抽取屠龙档武器 19%怒斩档  80%裁决

procedure _getRdmWP;

var Rdm_int : integer;

WpName : string;

begin

Rdm_int := random(100);  //获取随机数,随机数为 0-99中随机一个数字

if This_Player.GetBagItemCount('金刚石') >= 100 then// 查看包裹中是否有足够的金刚石

begin

if This_Player.FreeBagNum >=1 then// 查看是否有足够的包裹空间

begin

if Rdm_int < 1 then // 随机到0的概率为1%

begin

case random(3) of

0 : WpName := '屠龙';

1 : WpName := '嗜魂法杖';

2 : WpName := '逍遥扇';

end;

end else if Rdm_int < 20 then //随机到1-19的概率为19%

begin

case random(3) of

0 : WpName := '怒斩';

1 : WpName := '龙牙';

2 : WpName := '龙纹剑';

end;

end else if Rdm_int < 100 then //随机到20-99的概率为80%

begin

case random(3) of

0 : WpName := '裁决之杖';

1 : WpName := '骨玉权杖';

2 : WpName := '无极棍';

end;

end;

This_Player.Take('金刚石',100);

This_Player.Give(WpName , 1);

This_NPC.NpcDialog(This_Player,

WpName + '已放入您的包裹!\|'

+'{cmd}');

end else

This_NPC.NpcDialog(This_Player,

'没有足够的包裹空间!\|'<

  • 1
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值