千年技术吧+ 关注 关注:3 帖子:257

  

添加一个可传送到10多个地方的完美传送员

  • 枫之精英

    在 tgs1000\init\npc.sdb里加
    传送员,传送员,0,,,,,,,,,,62,81,235,0,0,,,,20000,0,0,0,0,,0,,,,,,,,,,,,,,,TRUE,


    在tgs1000\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 OnAway (aStr : String);
    var
    Str : String;
    Race : Integer;
    begin
    Str := callfunc ('getsenderrace');
    Race := StrToInt (Str);
    if Race = 1 then begin
    print ('say 我是传送员,我可以送你到你想去的地方');
    exit;
    end;
    end;

    procedure OnApproach (aStr : String);
    var
    Str : String;
    Race : Integer;
    begin
    Str := callfunc ('getsenderrace');
    Race := StrToInt (Str);
    if Race = 1 then begin
    print ('say 但是你要给我10000个钱币');
    exit;
    end;
    end;


    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 0';
    print (Str);
    exit;
    end;
    end;

    procedure OnGetResult (aStr : String);
    var
    Str, Name : String;
    nValue : Integer;
    begin
    if aStr = 'close' then begin
    exit;
    end;
    Str := callfunc ('getsenderitemexistence 钱币:10000');
    if Str = 'false' then begin
    print ('say 钱币不足');
    exit;
    end;
    if aStr = 'goroom1' then begin
    print ('mapregen 32');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 1 744 585';
    print (Str);
    exit;
    end;
    if aStr = 'goroom2' then begin
    print ('mapregen 33');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 3 38 62';
    print (Str); 
    exit;
    end;
    if aStr = 'goroom3' then begin
    print ('mapregen 34');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 31 33 33';
    print (Str);
    exit;
    end;
    if aStr = 'goroom4' then begin
    print ('mapregen 35');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 46 30 48';
    print (Str);
    exit;
    end;
    if aStr = 'goroom5' then begin
    print ('mapregen 36');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 19 49 127';
    print (Str); 
    exit;
    end;
    if aStr = 'goroom6' then begin
    print ('mapregen 37');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 26 18 27';
    print (Str);
    exit;
    end;
    if aStr = 'goroom7' then begin
    print ('mapregen 27');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 27 54 54';
    print (Str);
    exit;
    end;
    if aStr = 'goroom8' then begin
    print ('mapregen 28');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 28 54 54';
    print (Str); 
    exit;
    end;
    if aStr = 'goroom9' then begin
    print ('mapregen 43');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 43 210 222';
    print (Str);
    exit;
    end;
    if aStr = 'goroom10' then begin
    print ('mapregen 44');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 44 91 378';
    print (Str);
    exit;
    end;
    if aStr = 'goroom11' then begin
    print ('mapregen 45');
    print ('getsenderitem 钱币:10000');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 45 200 200';
    print (Str); 
    exit;
    end;
    if aStr = 'goroom12' then begin
    print ('mapregen 43');
    print ('getsenderitem 古奕之心:1');
    Name := callfunc ('getsendername');
    Str := 'movespace ' + Name;
    Str := Str + ' user 73 18 24';
    print (Str);
    exit;
    end;

    end;
    end. 
    ------------------------------------------------
    在tgs1000\script文件夹里得script.sdb里
    最后一行加入
    --------------------
    72,传送员.txt,, 
    --------------------

    然后在tgs1000\help里建个文本文件 名字: 传送员
    内容如下
    ------------------------------------------------
    <trade>
    <title>传送员</title>
    <image name=z81 value=235>
    <text>
    想要传送是要付出代价的噢^_^
    </text>
    <command send='close'>关闭</command>
    <body>
    <a send="goroom1">传送到犀牛林
    <a send="goroom2">传送到帝王陵
    <a send="goroom3">传送到石棺洞(太极老人处)
    <a send="goroom4">传送到帝石谷
    <a send="goroom5">传送到狐狸洞
    <a send="goroom6">传送到参善堂
    <a send="goroom7">传送到极乐洞一馆
    <a send="goroom8">传送到极乐洞二馆
    <a send="goroom9">传送到东海沼泽
    <a send="goroom10">传送到黄金沙漠
    <a send="goroom11">传送到北海雪原
    </body>
    </trade>
    -----------------------------------------------------

    最后在tgs1000\Setting文件夹里得CreateNpc1.sdb里加
    -----------------------------
    79,传送员,500,500,1,5,72,, 
    -----------------------------
    (79是我里面得最后一行 具体数字可以设定你这个文件里得最后一行)

    精英注:很多人说添加传送员后不是比武老人就是其他人。或者出现很多问题。

    其实这里不仅79要根据你的情况而改,并且72,看见了吗,这个72一定要和script.sdb里你那个72,传送员.txt的编号一样!



    1楼  2023/2/1 20:57:52  回复

  发表回复

    发帖