传奇广告查询第一站 同步gm1.com

战神引擎php,战神引擎常用脚本接口
原创 于2026-01-05 18:07:00发布
2 阅读
0
0

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,

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

+'{cmd}');

end else

This_NPC.NpcDialog(This_Player,

'没有足够的金刚石,不可抽取\|'

+'{cmd}');

end;

begin //脚本入口 使用 可跳转到此处

This_NPC.NpcDialog(This_Player,

'巴拉巴拉巴拉一堆废话\|'

+'{cmd}<100金刚石抽取武器/@getRdmWP>');

end.

获取时间 :

GetYear : 返回当前年份

GetMonth : 返回当前月份

GetDay : 返回当前日期

GetDayOfWeek : 返回星期几

GetHour : 返回当前小时数

GetMin: 返回当前分钟数

GetNow() : 获取当前时间浮点数,返回值为double

GetDateNum(datatime : double) 返回值为datatime 所对应的数字

如2019年1月1日 使用GetDateNum(GetNow) 返回值为43466

查改变量:

私人变量为V,S ,服务器变量为G

使用方法详见《程序变量操作指南》

增加、查询、扣除灵符:

增加 :This_Player.AddLF(nType,LF_NUM);

查询 :This_Player.MyLFnum

扣除 :This_Player.DecLF(nType, LF_NUM, false);

LF_NUM : 灵符数量

nType : 编号,一般为0

***扣除前务必查询是否有足够的灵符***

增加、查询、扣除金币:

增加 : This_Player.AddGold(GoldNum);

查询 :This_Player.GoldNum

扣除 :This_Player.DecGold(GoldNum);

GoldNum : 金币数量

***扣除前务必查询是否有足够的金币***

增加、查询、扣除声望:

查询:This_Player.MyShengwan

声望的增加和扣除直接赋值即可

如扣除10点声望

if This_Player.MyShengwan >= 10 then

This_Player.MyShengwan := This_Player.MyShengwan - 10;

增加10点声望

This_Player.MyShengwan := This_Player.MyShengwan + 10;

***扣除前务必查询是否有足够的声望***

元宝购买:

This_Player.PsYBConsum(This_NPC,'回调函数名称',交易编号,元宝数量,购买个数);

交易编号为大于20000的整数,建议每次活动使用不同的编号,方便后期统计使用

回调函数必须返回boolean值,回调函数名称及逻辑都需自定义编写,请参照下面例子中的 function YB_NewComeBag(price, num: Integer):boolean;

***调用该接口时请判断好前置条件,该接口一经调用先扣除元宝,再执行回调函数***

如:2018年10月1日至7日每天12:00-19:00 可使用2元宝或2灵符随机抽奖(优先扣除灵符),奖励为5灵符(9%)、10声望(20%)、10000经验(40%)、10万金币(30%)、2个金条(1%)

procedure giveYBprz(); //灵符和元宝抽取奖励完全一样,自定义一个方法,方便调用 ,*****自定义方法内容需要写在调用之前*****

var rmd : integer;

itemStr : string;

begin

rmd := random(100);

if rmd < 9 then

begin

This_Player.AddLF(0,5);

itemStr := '5灵符';

end else if rmd < 29 then

begin

This_Player.MyShengwan := This_Player.MyShengwan + 10;

itemStr := '10声望';

end else if rmd < 69 then

begin

This_Player.Give('经验',10000);

itemStr := '1万经验';

end else if rmd < 99 then

begin

This_Player.AddGold(100000);

itemStr := '10万金币';

end else

begin

This_Player.Give('金条',2);

itemStr := '2个金条';

This_NPC.NpcNotice('恭喜“' + This_Player.Name + ' ”参加两元宝抽奖时获得了' + itemStr + '!!!'); //系统公告红字,全服可见

end;

This_Npc.NpcDialog(This_Player,

'你获得了:' + itemStr + '\|'+

'{cmd}'

);

end;

procedure _RdmYBPrz;

begin

if (GetYear = 2018) and (GetMonth = 10) and (GetDay >= 1) and (GetDay <= 7) then

begin

if (GetHour >= 12) and (GetHour < 19) then //注意结束时间,19:00:00-19:59:59 GetHour均返回19

begin

if This_Player.FreeBagNum >= 2 then

begin

if This_Player.MyLFnum >= 2 then //优先使用灵符,灵符足够直接扣除灵符并给与奖励

begin

This_Player.DecLF(0,2,false);

giveYBprz(); //直接调用给奖励方法 *****自定义方法内容需要写在调用之前*****

end else //灵符不足则使用元宝

This_Player.PsYBConsum(This_NPC,'YB_NewComeBag',20001,2,1); //YB_NewComeBag为自定义回调函数名称, 20001为扣除编号,方便统计,2为元宝数量,1为个数(一般使用1即可)

本帖隐藏的内容

end else

This_NPC.NpcDialog(This_Player, '包裹空间不足,请整理后再来抽取奖励!');

end else

This_NPC.NpcDialog(This_Player, '每日抽奖时间为12:00-19:00!');

end else

This_NPC.NpcDialog(This_Player, '活动时间为10月1日至7日!');

end;

function YB_NewComeBag(price, num: Integer):boolean; //YB_NewComeBag为自定义回调函数名称,其余参数为固定格式 ,不可以改变

begin

result := true;

giveYBprz(); //直接调用给奖励方法 *****自定义方法内容需要写在调用之前*****

end;

begin

This_NPC.NpcDialog(This_Player, '巴拉巴拉巴拉巴拉废话先来一段\|'

+'{cmd}<2元宝抽奖/@RdmYBPrz>');

end.

地图刷怪 检测地图怪物数量:

检测某地图指定怪物数量:This_NPC.CheckMapMonByName(mapName , monName)

检测指定地图所有怪物数量:CheckOtherMapMon(mapname) ;该接口不需要npc调用

指定地图刷怪:This_NPC.CreateMon(地图名,X,Y,R,怪物名称,数量);

如:This_NPC.CreateMon('D5071',20,23,10,'混沌牛魔王',1);

传送:

This_Player.Flyto(地图名,x,y); 将角色传送至某地图的x、y点

This_Player.RandomFlyTo(地图名); 将角色传送至某地图的随机点

如:

This_Player.Flyto('D711',200 + random(3) - 1,204 + random(3) - 1);

表示将角色传送至地图 D711的 200,204的 3*3范围内随机点

获取角色信息:

This_Player.Name 角色名称

This_Player.Gender 角色性别0:男 1:女

This_Player.Level 角色等级

This_Player.Job 角色职业0:战士 1:法师 2:道士

行会相关:

This_Player.IsCastle 是否为沙巴克行会

This_Player.GuildName 返回行会名称,没有行会返回''

This_npc.GetCastleGuildName 获取沙巴克行会行会名称

组队,for循环:

Procedure _doexit;

begin

This_Npc.CloseDialog(This_Player);

end;

procedure _SP_Wealth_5_1;

begin

This_NPC.NpcDialog(This_Player,

' '

);

end;

procedure SP_Wealth_open(roomIdx:integer);

var

Group: TBaseGroup;

MemberCount,i: Integer;

APlayer: TPlayer;

bIsstu: boolean;

s: string;

begin

if This_Player.MapName <> 'GA0' then

Exit;

Group := This_Player.MyGroup;

if Group = nil then

begin

This_NPC.NpcDialog(This_Player,

'财神宝库需要组队才能进入。');

exit;

end

if not This_Player.IsGroupOwner then

begin

This_Npc.NpcDialog(This_Player,

'您不是所在队伍的队长,不能进入。'

);

Exit;

end;

if This_Player.Level < 35 then

begin

This_Npc.NpcDialog(This_Player,

'你的等级未到35级,不能带领大家进入宝库。'

);

Exit;

end;

if (This_Player.MyLFnum < 10) then

begin

This_Npc.NpcDialog(This_Player,

'你身上携带的灵符不足10张,不能带领大家进入宝库。'

);

Exit;

end

MemberCount := Group.GetMemberCount;

//整队飞到房间中

bIsstu := True;

for i := 0 to MemberCount - 1 do

begin

APlayer := TPlayer(Group.GetMember(i));

if APlayer <> This_Player then

begin

if compareText(APlayer.MapName,'GA0') <> 0 then

begin

s := '你队伍里' + APlayer.Name + '不在庄园,不能进入。\';

bIsstu := false;

break;

end;

end;

end;

if bIsstu = false then

begin

This_NPC.NpcDialog(This_Player,s);

exit;

end

else

begin

This_Player.DecLF(30018,10,false);

This_Player.CallOut(This_NPC,1800,'callOutFlyBack');

for i := 0 to MemberCount - 1 do

begin

APlayer := TPlayer(Group.GetMember(i));

if APlayer <> This_Player then

begin

if compareText(APlayer.MapName,'GA0') = 0 then

begin

APlayer.CallOut(This_NPC,1800,'callOutFlyBack'); //1800秒后执行传出房间的函数

end;

end;

end;

case roomIdx of

1:This_Player.GroupFly('D5074~04');

2:This_Player.GroupFly('D5074~02');

3:This_Player.GroupFly('D5074~03');

end;

end;

end;

procedure callOutFlyBack; //传出房间的函数,判断是否在活动地图,如果在活动地图,传送回庄园

begin

if (CompareText(This_Player.MapName,'D5074~04') = 0) or (CompareText(This_Player.MapName,'D5074~02') = 0)

or (CompareText(This_Player.MapName,'D5074~03') = 0) then

This_Player.RandomFlyTo('GA0');

end;

procedure _SP_Wealth_5_1_1;

begin

SP_Wealth_open(1);

end;

procedure _SP_Wealth_5_1_2;

begin

SP_Wealth_open(2);

end;

procedure _SP_Wealth_5_1_3;

begin

SP_Wealth_open(3);

end;

begin

This_NPC.NpcDialog(This_Player,

'宝库中每过一段时间出现守卫,击败守卫掉落大量珍贵道具,\'

+'还可能出现传说中的“夕兽”,记得要带够足量的“爆竹”哦。\'

+'进入条件:35级玩家为队长,由35级玩家消耗10张灵符,\'

+'带领小队进入,进入后,你的小队有30分钟探宝时间。\ \'

+' '

);

end.

管理员
0
0
0
分享
上一篇: 传奇开区发布广告和选择广告投放网站的那些事
下一篇: ROS常用脚本1
评论
历史记录
回顶部
浏览时间 游戏名称 游戏IP 开区网址
注册1GM论坛账号
  • 上传头像
注册

已有账号,

微信扫码登录
重置密码
重置密码

注册

绑定关联手机号
关联手机号