战神引擎 召唤宝宝的NPC代码

游戏怪兽2023-09-12 22:20:46329


可以自己修改召唤的种类 设置多久恢复CD召唤 这个之前下面有发过代码 这次上视频方便查看


再发一次NPC代码

program Mir2;


 


procedure _DoExit;

begin

  This_Npc.CloseDialog(This_Player);

end;


function getMonNameByid(Mid : integer) : string;

begin

    case Mid of

        1 : result := '半兽勇士';

        2 : result := '骷髅刀兵';

        3 : result := '骷髅勇士';

        4 : result := '骷髅卫士';


        else  result := '';

    end;

end;


function getMonTrueNameByid(Mid : integer) : string;

begin

    case Mid of

        1 : result := '半兽勇士';

        2 : result := '骷髅刀兵9';

        3 : result := '骷髅勇士9';

        4 : result := '骷髅卫士9';


        else  result := '';

    end;

end;


function getMonLvbyId(Mid : integer) : integer;

begin

    case Mid of

        1 : result := 50;

        2 : result := 50;

        3 : result := 48;

        4 : result := 48;  //等级

        else  result := 0;


    end;

end; 


function getMonGoldbyId(Mid : integer) : integer;

begin

    case Mid of


        1 : result := 1000;

        2 : result := 1000;

        3 : result := 500;

        4 : result := 500;  //元宝

        else  result := 0;


    end;

end; 


function getMonMaxNumbyId(Mid : integer) : integer;

begin

    case Mid of

    1 : result := 30;

        2 : result := 50;

        3 : result := 50;

        4 : result := 50;  //总数召唤

        else  result := -1;

    end;

end; 


function getMonNextTime(Mid : integer) : integer;

begin

    case Mid of 

    1 : result := 6;

        2 : result := 6;

        3 : result := 5;

        4 : result := 5;   //未知

        else  result := -1;

    end;


end;

procedure setgTask(Ntime : integer);

var intG , i:integer; 

begin

    

    if GetG(15,1) <> Ntime then

    begin

        SetG(15,1,Ntime);

        for i := 1 to 4 do

        begin

            if GetG(15,i) < 0 then

            SetG(15,i,0);

            intG := GetG(15,i);

            SetG(15,i, intG + 1);    

        end; 

    end;

end;

//GetG(15,1...20 使用  

function getMonNum(Mid , decNum : integer) : integer;

var needG , intG , Mnum : integer; 

begin

    

    if getMonNextTime(Mid) > 0 then

    begin

        case Mid of

            1 : needG := 1;

            2 : needG := 2;

            3 : needG := 3;

            4 : needG := 4;

        end;

        intG := GetG(15,needG);  //每分钟+1  除以时间间隔为可刷新数量 

        

        Mnum := intG div getMonNextTime(Mid);

        if Mnum > getMonMaxNumbyId(Mid) then

        begin

         

           SetG(15,needG, getMonMaxNumbyId(Mid) * getMonNextTime(Mid));   

           result := getMonMaxNumbyId(Mid);

        end else

        result := Mnum;

        

        if decNum > 0 then

        begin

           intG := GetG(15,needG); 

           SetG(15,needG, intG - getMonNextTime(Mid));

        end;

    end else

    result := 0;


end;


procedure _GoldCallmob();

var Monstr : string; 

i : integer;

begin

    Monstr := '';

    for i:=2 to 4 do

    begin

        Monstr := Monstr + '<' + getMonNameByid(i) + '/@MonDialog~' + inttostr(i) + '>        ';

        case i of

            2,3,4  : Monstr := Monstr + '|\'; 

        end;

        

         

    end;

    This_Npc.NpcDialog(This_Player,          

    '请选择你要召唤的怪物!|\{cmd}'

    + Monstr 

    +'<返回/@main>');


end;


function getMonNumStr(Mid : integer) : string;

begin

    if getMonMaxNumbyId(Mid) = 0 then

    result := '还有很多'

    else

    result := inttostr(getMonNum(Mid , 0)); 

end;



procedure _MonDialog(MidStr : string);

var Mid : integer;

begin

    Mid := StrToIntDef(MidStr,0);

     

    This_Npc.NpcDialog(This_Player, 

   // '你已召唤怪物:' + inttostr(This_Player.RegisterMethod('')) + '/5:\|'     

    +'召唤怪物:' + getMonNameByid(Mid) + '\|'

    +'召唤等级:' + inttostr(getMonLvbyId(Mid)) + '级\|' 

    +'需要元宝:' + inttostr(getMonGoldbyId(Mid)) + '\|' 

    +'剩余数量:' + getMonNumStr(Mid) + '\|'  

    +'{cmd}<我要召唤/@CallmobNow~' + MidStr + '>');

end;


procedure CallMobTrue(Mid : integer);

var needGold : integer;

MName : string;

begin

    needGold := getMonGoldbyId(Mid);

    MName := getMonNameByid(Mid);

    if This_Player.YBNum >= needGold then

    begin

        This_Player.ScriptRequestSubYBNum(needGold);

        This_Player.MakeSlaveEx(getMonTrueNameByid(Mid) , 1 ,0);

        getMonNum(Mid , 1)

         This_Npc.NpcDialog(This_Player,          

        MName + '我已帮你召唤了,还有什么事吗?|\'

        +'{cmd}<继续召唤' + MName + '/@CallmobNow~' + inttostr(Mid) + '>      ^<返回/@GoldCallmob>');  

    end else

    This_Npc.NpcDialog(This_Player, 

    '没钱我也没办法!');

end; 


procedure _CallmobNow(MidStr : string);

var Mid : integer;

begin

    Mid := StrToIntDef(MidStr,0);

    

    if This_Player.Job = 1 then

    begin

        if This_Player.Level >= getMonLvbyId(Mid) then

        begin 

            if This_Player.GetSlaveCount('') < 5 then

            begin

                if getMonMaxNumbyId(Mid) < 0 then

                exit

                else if getMonMaxNumbyId(Mid) = 0 then

                CallMobTrue(Mid)

                else if getMonNum(Mid , 0) > 0 then

                CallMobTrue(Mid) else

                This_Npc.NpcDialog(This_Player,          

                '我已体力不支,无法召唤' + getMonNameByid(Mid) + '了!');

            end else 

            This_Npc.NpcDialog(This_Player,          

            '每人最多只能召唤5个怪物!');

        end else

        This_Npc.NpcDialog(This_Player,          

        '请修炼到' + inttostr(getMonLvbyId(Mid)) + '级再尝试召唤' + getMonNameByid(Mid)  + '吧!');  

    end else

    This_Npc.NpcDialog(This_Player,          

    '法师才可以在我这里召唤怪物!');

end;


procedure Execute;

var nowTime : integer;

begin

    nowTime := (GetHour * 1) + GetMin;

    setgTask(nowTime);

end;


begin


    This_Npc.NpcDialog(This_Player,          

    '我已驯养了一些法师可以召唤怪物,但你要付我一定的费用,我能力有限,有些怪物我隔一段时间才能获得到,数量有限,先到先得!\'

   +'|<骷髅刀兵:/FCOLOR=253><平衡魔防>^<综合魔防伤害平衡/fcolor=250>\'

   +'|<骷髅勇士:/FCOLOR=253><高级魔防>^<抵御魔法伤害较强/fcolor=250>\'

   +'|<骷髅卫士:/FCOLOR=253><高级防御>^<抵御物理伤害较强/fcolor=250>\'

   +'|<购买后记得在庄园进行宝宝登记,随时召唤。/FCOLOR=249>\'   

    +'|{cmd}<元宝召唤怪物/@GoldCallmob>');

  //  _MonDialog('2');

end.


文章评论

OSAAA-游戏经验分享是一个专注于手游技巧,PC游戏和单机游戏的技术交流平台.提供原创博客,游戏攻略,游戏问答,游戏指南与提示等.用户可以在这里分享游戏资讯,评论,资源,脚本,视频,教程,经验心得等。
请先 登录 再评论,如果还未注册,请先 注册