NPC Scropting Code Problem.

Results 1 to 8 of 8
  1. #1
    Member Dor Maudi is offline
    MemberRank
    Apr 2013 Join Date
    55Posts

    information NPC Scropting Code Problem.

    well hi guys i started NPC scripting not long ago and stated my first NPC:

    Code:
    var status = 0;
    
    
    function start() {
    status = -1;
    action(1, 0, 0);
    }
    
    
    function action(mode, type, selection) {
    
    
    
    
    if (mode == -1) {
    cm.dispose();
    
    
    }else if (mode == 0){
    cm.sendOk("FareWell");
    cm.dispose();
    
    
    }else{
    if (mode == 1)
    status++;
    else
    status--;
    if (status == 0) {
    cm.sendNext("Welcome to BlueStory hope you will have a good time our rate's are 500/300/5");
    }
    else if (status == 1) {
    cm.sendYesNo("Do you want a small gift from #b Jack Frost #k have fun");
    cm.gainItem("1012006, 1");
    cm.gainNX("10000");
    cm.warp(910000000, 0);
    cm.dispose();
    }
    }
    }
    every thing is cool untill i press YES in the Yes / No window after clicking "yes" the window got dispose and nothing happed do i have any problem with the code ?

    if some 1 can fix me i will be gratefull :)
    Last edited by Dor Maudi; 30-06-13 at 05:52 PM.


  2. #2
    Moongran Saii is offline
    MemberRank
    Jan 2012 Join Date
    510Posts

    Re: NPC Scropting Code Problem.

    Typo in last dispose and items are obtained before even pressing yes

  3. #3
    Member Dor Maudi is offline
    MemberRank
    Apr 2013 Join Date
    55Posts

    Re: NPC Scropting Code Problem.

    can you edit my code and post it here i cant understand how to fix it...

  4. #4
    How cool is that? sonnyeb is offline
    MemberRank
    Oct 2012 Join Date
    /f425/Location
    393Posts

    Re: NPC Scropting Code Problem.

    Quote Originally Posted by Dor Maudi View Post

    Code:
     cm.despose(); 
    Check your 4th last line.

  5. #5
    Member Dor Maudi is offline
    MemberRank
    Apr 2013 Join Date
    55Posts

    Re: NPC Scropting Code Problem.

    ok but it didnt fix the problem now after i click YES nothing happend what do i need to do ?

  6. #6
    $_SESSION['DEV']; hecari is offline
    MemberRank
    Dec 2008 Join Date
    336Posts

    Re: NPC Scropting Code Problem.

    PHP Code:
    var status 0;


    function 
    start() {
    status = -1;
    action(100);
    }


    function 
    action(modetypeselection) {
        if (
    mode == -1) {
            
    cm.dispose();
            } else {
                if(
    mode == 1) {
                        
    status++;
                    } else {
                        
    status--;
                    }
            }
        if (
    status == 0) {
            
    cm.sendNext("Welcome to BlueStory hope you will have a good time our rate's are 500/300/5");
        } else if (
    status == 1) {
            
    cm.sendYesNo("Do you want a small gift from #b Jack Frost #k have fun");
        } else if(
    status == 2) {
            
    cm.gainItem("1012006, 1");
            
    cm.gainNX("10000");
            
    cm.warp(9100000000);
            
    cm.dispose();
        }


  7. #7
    I'm overrated. Fraysa is offline
    MemberRank
    Apr 2008 Join Date
    4,891Posts

    Re: NPC Scropting Code Problem.

    Quote Originally Posted by hecari View Post
    PHP Code:
    var status 0;


    function 
    start() {
    status = -1;
    action(100);
    }


    function 
    action(modetypeselection) {
        if (
    mode == -1) {
            
    cm.dispose();
            } else {
                if(
    mode == 1) {
                        
    status++;
                    } else {
                        
    status--;
                    }
            }
        if (
    status == 0) {
            
    cm.sendNext("Welcome to BlueStory hope you will have a good time our rate's are 500/300/5");
        } else if (
    status == 1) {
            
    cm.sendYesNo("Do you want a small gift from #b Jack Frost #k have fun");
        } else if(
    status == 2) {
            
    cm.gainItem("1012006, 1");
            
    cm.gainNX("10000");
            
    cm.warp(9100000000);
            
    cm.dispose();
        }

    Your script is correct, however, a few mistakes; you used quotes in brackets. Don't include quoutes if it's integer.
    @OP, Next time, you have to advance to the next status after sending something like sendYesNo or sendNext, and the next status will execute the code of it if the user clicked Next or Yes or Accept or whatever.

    PHP Code:
    var status 0;


    function 
    start() {
    status = -1;
    action(100);
    }


    function 
    action(modetypeselection) {
        if (
    mode == -1) {
            
    cm.dispose();
            } else {
                if(
    mode == 1) {
                        
    status++;
                    } else {
                        
    status--;
                    }
            }
        if (
    status == 0) {
            
    cm.sendNext("Welcome to BlueStory hope you will have a good time our rate's are 500/300/5");
        } else if (
    status == 1) {
            
    cm.sendYesNo("Do you want a small gift from #b Jack Frost #k have fun");
        } else if (
    status == 2) {
            
    cm.gainItem(10120061);
            
    cm.gainNX(10000);
            
    cm.warp(9100000000);
            
    cm.dispose();
        }


  8. #8
    Moongran Saii is offline
    MemberRank
    Jan 2012 Join Date
    510Posts

    Re: NPC Scropting Code Problem.

    PHP Code:
    var status = -1;

    function 
    start() {
        
    cm.sendNext("Welcome to BlueStory. Hope you will have a good time. Our rates are 500/300/5");
    }


    function 
    action(modetypeselection) {
        if (
    mode != 1) {
            
    cm.dispose();
            return;
        }
        
    status ++;
        if (
    status == 0) {
            
    cm.sendYesNo("Do you want a small gift from #bJack Frost#k?");
        } else if (
    status == 1) {
            
    cm.gainItem(10120061);
            
    cm.gainNX(10000);
            
    cm.warp(9100000000);
            
    cm.sendOk("Have fun");
            
    cm.dispose();
        }




Advertisement