Jump to content

Question

Posted

What does it do:

If you talk to this npc and  pay 100z, he will give you 1-10 random points, this points can be added as you continue paying him 100z.

 

and

 

Every time i talk to this npc, it will tell me how many points i have,  and when i reach 100 and above points it will tell me you reach greater than 100 points, here is your prize(the npc will give apple).

 

i dont mind if the points will be in just text(alchemy ranking points) or in item form(poring coin).

3 answers to this question

Recommended Posts

Posted (edited)

Perhaps this is what you are looking for.

 

RANDOMPOINTS is a PERMANENT CHARACTER VARIABLE. This means that the points will only apply to an individual character.

If you want it to be account based, insert # before the variable; #RANDOMPOINTS.

 

You can set the TEMPORARY NPC VARIABLE .@price to whatever value you wish your players to pay.

map,x,y,d<TAB>script<TAB>NPCNAME1<TAB>999,{

set .@price,100; // Set this to whatever value you wish your players to pay.
set .@reward,rand(1,10); // Set this to what point reward you want to range from. 1-10

mes "You have "+RANDOMPOINTS+" points";
mes " ";
mes "Would you like to donate "+.@price+"z?";

if(switch(select("Yes:No") == 1)) {

        if(Zeny < .@price){ // Checks if Player has enough Zeny.
           mes "You do not have enough Zeny...";
           close;
           }
           set .@reward,rand(1,10);
           mes "You have donated "+.@price+"z.";
           mes " ";
           mes "You have gained "+.@reward+" points";
           set RANDOMPOINTS,RANDOMPOINTS + .@reward;
           set Zeny,Zeny - .@price;
           close;
} else {
           mes "Come again another time!";
           close;
}

}
 

 

I did not test this yet btw so please tell me if there's any errors.

 

 

-- EDIT

 

Sadly the if->Switch Statement for me isn't working anymore ( I am getting an error with it... unsure why ) but I modified the script and tested.

This will 100% work out.

 

Change .@price to the value you wish your players to pay

Change RANDOMPOINTS to another PERMANENT ACCOUNT OR CHARACTER variable. ( It does not have to be RANDOMPOINTS )

Change .@reward if you wish to increase the amount of points you want to give.

prontera,160,180,4    script    NPCNAME1    999,{

set .@price,100; // Set this to whatever value you wish your players to pay.
set .@reward,rand(1,10); // Set this to what point reward you want to range from. 1-10

mes "You have "+RANDOMPOINTS+" points";
mes " ";
mes "Would you like to donate "+.@price+"z?";

    switch(select("Yes:No" )) {
    case 1:
        if(Zeny < .@price){ // Checks if Player has enough Zeny.
            mes "You do not have enough Zeny...";
            close;
            }
        mes "You have donated "+.@price+"z.";
        mes " ";
        mes "You have gained "+.@reward+" points";
        set RANDOMPOINTS,RANDOMPOINTS + .@reward;
        set Zeny,Zeny - .@price;
        close;
    case 2:
        mes "Come again another time!";
               close;
    }


}
Edited by Evelynn
  • Upvote 1
Posted

Thank you ill try it out later night. ^)^



Perhaps this is what you are looking for.

 

RANDOMPOINTS is a PERMANENT CHARACTER VARIABLE. This means that the points will only apply to an individual character.

If you want it to be account based, insert # before the variable; #RANDOMPOINTS.

 

You can set the TEMPORARY NPC VARIABLE .@price to whatever value you wish your players to pay.

map,x,y,d<TAB>script<TAB>NPCNAME1<TAB>999,{

set .@price,100; // Set this to whatever value you wish your players to pay.
set .@reward,rand(1,10); // Set this to what point reward you want to range from. 1-10

mes "You have "+RANDOMPOINTS+" points";
mes " ";
mes "Would you like to donate "+.@price+"z?";

if(switch(select("Yes:No") == 1)) {

        if(Zeny < .@price){ // Checks if Player has enough Zeny.
           mes "You do not have enough Zeny...";
           close;
           }
           set .@reward,rand(1,10);
           mes "You have donated "+.@price+"z.";
           mes " ";
           mes "You have gained "+.@reward+" points";
           set RANDOMPOINTS,RANDOMPOINTS + .@reward;
           set Zeny,Zeny - .@price;
           close;
} else {
           mes "Come again another time!";
           close;
}

}
 

 

I did not test this yet btw so please tell me if there's any errors.

 

 

-- EDIT

 

Sadly the if->Switch Statement for me isn't working anymore ( I am getting an error with it... unsure why ) but I modified the script and tested.

This will 100% work out.

 

Change .@price to the value you wish your players to pay

Change RANDOMPOINTS to another PERMANENT ACCOUNT OR CHARACTER variable. ( It does not have to be RANDOMPOINTS )

Change .@reward if you wish to increase the amount of points you want to give.

prontera,160,180,4    script    NPCNAME1    999,{

set .@price,100; // Set this to whatever value you wish your players to pay.
set .@reward,rand(1,10); // Set this to what point reward you want to range from. 1-10

mes "You have "+RANDOMPOINTS+" points";
mes " ";
mes "Would you like to donate "+.@price+"z?";

    switch(select("Yes:No" )) {
    case 1:
        if(Zeny < .@price){ // Checks if Player has enough Zeny.
            mes "You do not have enough Zeny...";
            close;
            }
        mes "You have donated "+.@price+"z.";
        mes " ";
        mes "You have gained "+.@reward+" points";
        set RANDOMPOINTS,RANDOMPOINTS + .@reward;
        set Zeny,Zeny - .@price;
        close;
    case 2:
        mes "Come again another time!";
               close;
    }


}

how can i make this npc delete points ?

Posted (edited)

Ah right, sorry I forgot about the rewards after 100 points.

 

When you want it to delete points the command you would want to use is

 

 

if (RANDOMPOINTS == 100 ) { // Checks if condition is met ( Value is 100 as you asked for ).
    getitem 501,1; // Red Potion
    set RANDOMPOINTS,RANDOMPOINTS - 100; 
}

 

The complete script would look like this:

 

 

prontera,160,180,4    script    NPCNAME1    999,{

setarray .@reward[0],501,1; // Set this to what you want your prize item to be and the amount.
set .@price,100; // Set this to whatever value you wish your players to pay.
set .@rand,rand(1,10); // Set this to what point reward you want to range from. 1-10
set .@remove,100; // Set this value to how ever points you want to be removed when condition is met.

mes "You have "+RANDOMPOINTS+" points";
mes " ";
mes "Would you like to donate "+.@price+"z?";
    switch(select("Yes:No" )) {
    case 1:
        if(Zeny < .@price){ // Checks if Player has enough Zeny.
            mes "You do not have enough Zeny...";
            close;
            }

        mes "You have donated "+.@price+"z.";
        mes " ";
        mes "You have gained "+.@rand+" points";
        set RANDOMPOINTS,RANDOMPOINTS + .@rand; // Adds Points based on .@rand amount
        set Zeny,Zeny - .@price; // Removes Zeny 

        if (RANDOMPOINTS >= .@remove ) { // Checks if player has enough points for reward
            next;
            mes "You have "+RANDOMPOINTS+" Points!";
            mes "Here is a reward for your generosity";
                getitem .@reward[0],.@reward[1]; // Reward is given here
                set RANDOMPOINTS,RANDOMPOINTS - .@remove; // Points are removed here.
        }
        close;
    case 2:
        mes "Come again another time!";
               close;
    }


}
 

 

Edited by Evelynn
  • Upvote 1

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...