如何建立一个商店NPC方法
-
传送员有很多介绍的勒,偶再说个如何添加1个商店NPC
tgs/help里添加文本林月如(实际自己想用名字自己换,但是要换全勒)内容
< trade>
< title>林月如</title>
<image name=z54 value=133>
<text>
出售好东西啦!!
</text>
<command send='close'>关闭</command>
<command send="sell">购买物品</command>
<command send="buy">卖出物品</command>
</trade>
tgs/npcsetting/添加文本林月如,内容如下
SELLTITLE:林月如
SELLCAPTION:出售各种好东西
SELLIMAGE:133
SELLITEM:,买的东西,最多40件
SELLITEM:
SELLITEM:
BUYCAPTION:多余的可以卖这!
BUYIMAGE:133
BUYITEM:卖的东西
tgs/npcsetting/里添加林月如.sdb文件,内容如下
Name,boSelfSay,boMain,MainNumber,HearString,SayString,NeedItem,GiveItem,CountLimit,RecoverTime,DelayTime,
1,TRUE,,,,买 卖 各种极品噢^_^!,,,,,1000,
2,TRUE,,,,一般人可买不到的好东东噢^_^!,,,,,1833,
tgs/script里添加文本林月如 内容如下
unit 林月如;
interface
function GetToken (aStr, aToken, aSep : String) : String;
function CompareStr (aStr1, aStr2 : String) : Boolean;
function callfunc (aText: string): string;
procedure print (aText: string);
function Random (aScope: integer): integer;
function Length (aText: string): integer;
procedure Inc (aInt: integer);
procedure Dec (aInt: integer);
function StrToInt (astr: string): integer;
function IntToStr (aInt: integer): string;
procedure exit;
procedure OnGetResult (aStr : String);
procedure OnLeftClick (aStr : String);
implementation
procedure OnLeftClick (aStr : String);
var
Str : String;
Race : Integer;
begin
Str := callfunc ('getsenderrace');
Race := StrToInt (Str);
if Race = 1 then begin
Str := 'showwindow .\help\林月如.txt 1';
print (Str);
exit;
end;
end;
procedure OnGetResult (aStr : String);
var
Str, Name : String;
begin
if aStr = 'close' then begin
exit;
end;
if aStr = 'sell' then begin
Name := callfunc ('getsendername');
Str := 'tradewindow ' + Name;
Str := Str + ' 0';
print (Str);
exit;
end;
if aStr = 'buy' then begin
Name := callfunc ('getsendername');
Str := 'tradewindow ' + Name;
Str := Str + ' 1';
print (Str);
exit;
end;
if aStr = 'log' then begin
Str := 'logitemwindow';
print (Str);
exit;
end;
end;
end.
init/npc.sdb里添加
林月如,林月如,-100,,林月如.txt,TRUE,,TRUE,,,,,23,42,126,600,196,183,208,83,3500,-20,0,0,0,,4,,,,,,,,,,,,,,,,
script.sdb里添加
XXX,林月如.txt,, 注:XXX为你最后1个号码,并且为唯一
对应NPC的设置地点里添加
最后1个数字,林月如,坐标,坐标,几个,范围,刚才哪个XXX的数字,林月如.sdb,
举个例子
5,林月如,56,88,1,3,148,林月如.sdb,

