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

  

建立一个传送员

  • 枫之精英

    在 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 1 165 775';

    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 208 248';

    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;

    if aStr = 'goroom13' then begin

          print ('mapregen 38');

    print ('getsenderitem 钱币:10000');

          Name := callfunc ('getsendername');

          Str := 'movespace ' + Name;

          Str := Str + ' user 1 560 120';

          print (Str);

           exit;

          end;

    end;

    end.


    ------------------------------------------------

    在tgs1000\script文件夹里得script.sdb里

    最后一行加入

    --------------------

    92,传送员.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="goroom11">传送到黄金沙漠入口

    <a send="goroom13">传送到双花店

    </body>

    </trade>

    -----------------------------------------------------


    最后在tgs1000\Setting文件夹里得CreateNpc1.sdb里加

    -----------------------------

    92,传送员,500,500,1,5,72,, 

    -----------------------------

    (92是我里面得最后一行 具体数字可以设定你这个文件里得最后一行)



    1楼  2022/1/28 12:48:27  回复

  发表回复

    发帖