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,
'没有足够的包裹空间!\|'<