Jump to content
  • 0

Rock Paper Scissor Announce Winner.


cross10hunter

Question


  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

Hi. I try to edit the rpsroulette by Acky 1.2. I came up with this but I cant make it work. Can someone point out to me on what did i do wrong? I try to put an announcer and add a jackpot prize and consilation prize. Here is the script that i did.

KILL:
	specialeffect EF_SUI_EXPLOSION;
	emotion e_omg;
	mes "*^0000FFClick^000000* *^FF0000BANG^000000*";
	mes "OWWW @#$%^!! THAT HURT LIKE HELL!!";
	next;
	set .@rand, rand(1,100);
	if(.@rand < 2) { //Jackpot Prize 1% Win
	Announce "Crazy Boris: " + strcharinfo(0) + " has won the Jackpot Prize of 1 POD! ",8;
	getitem 7179,1;
	}
	else if(.@rand < 5) { // Conso Prize 5% win
	mes "Congratulations you won consolation prize!!";
	switch(rand(6)) {
		case 1: getitem 7539,5; break;
		case 2: getitem 677,1; break;
		case 3: getitem 12103,1; break;
		case 4: getitem 7539,2; break;
		case 5: geitem 750,1; break;	// 1x bapodoll
		case 6: geitem 7008,1; break;	// 1x Stiff Horn
	}
	}
	else if(.@rand < 70) { // Trash
	switch(rand(7)) {
		case 1: geitem 984,10; break;
		case 2: geitem 601,100; break;	// 100x Fly Wings
		case 3: geitem 603,8; break;	// 8x Old Blue Box
		case 4: geitem 4,617; break;	// 4x Old Violet Box
		case 5: geitem 7139,3; break;	// 3x Gold
		case 6: geitem 11502,20 break;	// 20x Light Blue Potion
		case 7: geitem 985,10;
	}
	}
	else {
	mes "too bad you didn't win anything!!";
	}

LEAVE:
	mes "Pansy.";
	close;
}

 

Edited by cross10hunter
Link to comment
Share on other sites

22 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

In your switch you have forgot to check the command "getitem". There is nearly all with "geitem" and in your 70% switch you have in case 6 forgot the semikolon (;) after the getitem command.

Try to put a close command at the end of the event "KILL" to close the message from the npc. I'm not sure if it necessary or not.

Edited by Hismoon
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

1 hour ago, Hismoon said:

In your switch you have forgot to check the command "getitem". There is nearly all with "geitem" and in your 70% switch you have in case 6 forgot the semikolon (;) after the getitem command.

Try to put a close command at the end of the event "KILL" to close the message from the npc. I'm not sure if it necessary or not.

Thanks for fast reply!. its working!. Now im going to observe if the jackpot prize will be announce. Btw, how about if he already got the jackpot prize, how am i going to make him not play the NPC anymore? i mean he cant play the npc anymore.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

Just give the player who won the jackpot prize a permanent character variable e.g.

//Jackpot Prize 1% Win
	Announce "Crazy Boris: " + strcharinfo(0) + " has won the Jackpot Prize of 1 POD! ",8;
	getitem 7179,1;
	set JackPotWin, 1;
}

and check this variable with a if-statement before the player comes to this option to play the game.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

13 minutes ago, Hismoon said:

Just give the player who won the jackpot prize a permanent character variable e.g.


//Jackpot Prize 1% Win
	Announce "Crazy Boris: " + strcharinfo(0) + " has won the Jackpot Prize of 1 POD! ",8;
	getitem 7179,1;
	set JackPotWin, 1;
}

and check this variable with a if-statement before the player comes to this option to play the game.

Sorry this is kinda difficult for me especially the character variable you were saying. can you give me an example with char variable and where do i insert it in the jackpot prize? and about the announcement, someone already got the jackpot prize but there was no announcement going on.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

17 minutes ago, cross10hunter said:

Sorry this is kinda difficult for me especially the character variable you were saying. can you give me an example with char variable and where do i insert it in the jackpot prize? and about the announcement, someone already got the jackpot prize but there was no announcement going on.


it's already announcing but the first few minutes it doesnt.

additional question.

can i use bc_all instead of 8? in "Crazy Boris: " + strcharinfo(0) + " has won the Jackpot Prize of 1 POD! ",8; ?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

It's easy to understand...

You can use bc_all instead of 8 in the announce command yes. With the character variables have a look at the documents folder from rathena. There is a section wheres written: (Quote of docs/script_commands.txt)

Variables
---------

The meat of every programming language is variables - places where you store
data.

In the rAthena scripting language, variable names are not case sensitive.

Variables are divided into and uniquely identified by the combination of:
prefix  - determines the scope and extent (or lifetime) of the variable
name    - an identifier consisting of '_' and alphanumeric characters
postfix - determines the type of the variable: integer or string

Scope can be:
global    - global to all servers
local     - local to the server
account   - attached to the account of the character identified by RID
character - attached to the character identified by RID
npc       - attached to the NPC
scope     - attached to the scope of the instance

Extent can be:
permanent - They still exist when the server resets.
temporary - They cease to exist when the server resets.

Prefix: scope and extent
nothing  - A permanent variable attached to the character, the default variable
           type. They are stored by char-server in the `char_reg_num` and
           `char_reg_str`.
"@"      - A temporary variable attached to the character.
           SVN versions before 2094 revision and RC5 version will also treat
           'l' as a temporary variable prefix, so beware of having variable
           names starting with 'l' if you want full backward compatibility.
"$"      - A global permanent variable.
           They are stored by map-server in database table `mapreg`.
"$@"     - A global temporary variable.
           This is important for scripts which are called with no RID
           attached, that is, not triggered by a specific character object.
"."      - A NPC variable.
           They exist in the NPC and disappear when the server restarts or the
           NPC is reloaded. Can be accessed from inside the NPC or by calling
           'getvariableofnpc'. Function objects can also have .variables which
           are accessible from inside the function, however 'getvariableofnpc'
           does NOT work on function objects.
".@"     - A scope variable.
           They are unique to the instance and scope. Each instance has its
           own scope that ends when the script ends. Calling a function with
           callsub/callfunc starts a new scope, returning from the function
           ends it. When a scope ends, its variables are converted to values
           ('return .@var;' returns a value, not a reference).
"'"      - An instance variable.
           These are used with the instancing system and are unique to each
           instance type.
"#"      - A permanent local account variable.
           They are stored by char-server in the `acc_reg_num` table and
           `acc_reg_str`.
"##"     - A permanent global account variable stored by the login server.
           They are stored in the `global_acc_reg_num` table and
		   `global_acc_reg_str`.
           The only difference you will note from normal # variables is when
           you have multiple char-servers connected to the same login server.
           The # variables are unique to each char-server, while the ## variables
           are shared by all these char-servers.

Postfix: integer or string
nothing - integer variable, can store positive and negative numbers, but only
          whole numbers (so don't expect to do any fractional math)
'$'     - string variable, can store text

Examples:
  name  - permanent character integer variable
  name$ - permanent character string variable
 @name  - temporary character integer variable
 @name$ - temporary character string variable
 $name  - permanent global integer variable
 $name$ - permanent global string variable
$@name  - temporary global integer variable
$@name$ - temporary global string variable
 .name  - NPC integer variable
 .name$ - NPC string variable
.@name  - scope integer variable
.@name$ - scope string variable
 'name  - instance integer variable
 'name$ - instance string variable
 #name  - permanent local account integer variable
 #name$ - permanent local account string variable
##name  - permanent global account integer variable
##name$ - permanent global account string variable

If a variable was never set, it is considered to equal zero for integer
variables or an empty string ("", nothing between the quotes) for string
variables. Once you set it to that, the variable is as good as forgotten
forever, and no trace remains of it even if it was stored with character or
account data.

If you read my post I already give you a example where you can use the character variable. After the jackpot prize is given you can set a line under this, but also in the if statement, with the character variable for example "JackPotWin". There you need a value like 1 for the check. Then you need a if-statement before the game begins where you check the "JackPotWin" value like "if(JackPotWin == 1)".

if(JackPotWin)
{
	// There the text that the player already wins
}
// other code
if(.@rand < 2) {
	// jackpot wins
	set JackPotWin, 1;
} // other code

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

2 hours ago, Hismoon said:

In your switch you have forgot to check the command "getitem". There is nearly all with "geitem" and in your 70% switch you have in case 6 forgot the semikolon (;) after the getitem command.

Try to put a close command at the end of the event "KILL" to close the message from the npc. I'm not sure if it necessary or not.

   

PLAY:
    mes "Rock... Paper...";
    set .@opp, rand(1,3);
    menu "^0000FFROCK!",-,"^FF0000SCISSORS!",SCISSORS,"^00FF00PAPER!^000000",PAPER;
    
    if (#JackPotWin == 1) goto L_1;
      if (.@lastchoice == 1) set .@opp, rand(1,3);
      if (.@opp == 1) emotion e_rock;
      else if (.@opp == 2) emotion e_scissors;
      else emotion e_paper;
      set .@lastchoice,1;
    if (.@opp == 1) goto SAME;
    if (.@opp == 2) goto WIN;
    goto LOSE;
L_1:
    mes "You had already received the jackpot.";
    emotion e_bzz;
    close;




    specialeffect EF_SUI_EXPLOSION;
    emotion e_omg;
    mes "*^0000FFClick^000000* *^FF0000BANG^000000*";
    mes "OWWW @#$%^!! THAT HURT LIKE HELL!!";
    next;
    set .@rand, rand(1,100);
    {
    if(.@rand < 2) { //Jackpot Prize 1% Win
    Announce "Crazy Boris: " + strcharinfo(0) + " has won the Jackpot Prize of 1 POD! ",bc_all;
    getitem 7179,1;
    set #JackPotWin,1;
    }
    else if(.@rand < 5) { // Conso Prize 5% win
    mes "Congratulations you won consolation prize!!";
    switch(rand(6)) {
        case 1: getitem 7539,5; break;
        case 2: getitem 677,1; break;
        case 3: getitem 12103,1; break;
        case 4: getitem 7539,2; break;
        case 5: getitem 750,1; break;    // 1x bapodoll
        case 6: getitem 7008,1; break;    // 1x Stiff Horn

I added this if (#JackPotWin == 1) goto L_1;

L_1:
    mes "You had already received the jackpot.";
    emotion e_bzz;
    close;

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

If you want a permanent account variable then you can use the prefix "#" before the variable name. But if one character from the account has won the jackpot prize, no other characters can win the prize from this account.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

5 minutes ago, Hismoon said:

If you want a permanent account variable then you can use the prefix "#" before the variable name. But if one character from the account has won the jackpot prize, no other characters can win the prize from this account.

ohh ok isee, thats how # works. got it! so ill just remove it then. but do you think the script that i showed you will work?. like the goto L_1; then a msg will pop up "You had already received the jackpot."?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

I thinks so. The if statement is with a goto command so if the variable is true, then the goto command is running and goes to the L_1 Event.

If it not work you can answer in the thread. I look later here again and answer on it then or you PM me.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

14 minutes ago, Hismoon said:

I thinks so. The if statement is with a goto command so if the variable is true, then the goto command is running and goes to the L_1 Event.

If it not work you can answer in the thread. I look later here again and answer on it then or you PM me.

Thankyou so much ! you've been very helpful!! 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

No problem. You're welcome. =)

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

1 hour ago, Hismoon said:

No problem. You're welcome. =)

The players in my server are now addicted to RPSroulette lol. Some of them skipped WoE just to play it because my Jackpot is PODS! anyway, how about disabling NPC on a certain time example 8-10pm boris is disabled. then after 10pm he will return again.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

2 hours ago, Hismoon said:

No problem. You're welcome. =)

How about if I want the players to pay zeny first before playing it?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

1 hour ago, cross10hunter said:

The players in my server are now addicted to RPSroulette lol. Some of them skipped WoE just to play it because my Jackpot is PODS! anyway, how about disabling NPC on a certain time example 8-10pm boris is disabled. then after 10pm he will return again.

You need a Time Event e.g:

// some code
OnClock2000:
	disablenpc strnpcinfo(0);
	end;

OnClock2200:
	enablenpc strnpcinfo(0);
	end;
// other code

or use a variable instead of disable/enablenpc. Then you can check the variable at the beginning from the npc if he is active.

 

43 minutes ago, cross10hunter said:

How about if I want the players to pay zeny first before playing it?

Just put before the game begins this:

// some code
if(Zeny < 5000)
{
	mes "not enough money";
    close;
}
set Zeny, Zeny - 5000;
// other code

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

3 minutes ago, Hismoon said:

You need a Time Event e.g:


// some code
OnClock2000:
	disablenpc strnpcinfo(0);
	end;

OnClock2200:
	enablenpc strnpcinfo(0);
	end;
// other code

or use a variable instead of disable/enablenpc. Then you can check the variable at the beginning from the npc if he is active.

 

Just put before the game begins this:


// some code
if(Zeny < 5000)
{
	mes "not enough money";
    close;
}
set Zeny, Zeny - 5000;
// other code

 

OnClock1800:
OnClock0900:
enablenpc strnpcinfo(0);
end;
announce "Boris is Back!",bc_all;
OnClock2300:
OnClock0400:
disablenpc strnpcinfo(0);
end;
announce "It's time for me to rest",bc_all;
OnInit:
enablenpc strnpcinfo(0);
if (gettime(3) >= 18 && gettime(3) < 23) disablenpc strnpcinfo(0);
if (gettime(3) >= 04 && gettime(3) < 09) disablenpc strnpcinfo(0);
end;

This is what I've did. so from 6pm-11pm he will be disabled then 4am-9am disabled aswell. but the announcer is not working.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

The announce should before the end; command ... if it then the announce will work.

I would recommend a guide in scripting for you ... this is all something that everyone who hosts a server needs to know. Thats the basics from scripting.

A tipp from my side, look above the code and go through the code. Check if you know what you are doing here and try to understand it. When you go through the code then think about what happens in this line and so on.

Edited by Hismoon
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

3 hours ago, Hismoon said:

No problem. You're welcome. =)

 

22 minutes ago, Hismoon said:

You need a Time Event e.g:


// some code
OnClock2000:
	disablenpc strnpcinfo(0);
	end;

OnClock2200:
	enablenpc strnpcinfo(0);
	end;
// other code

or use a variable instead of disable/enablenpc. Then you can check the variable at the beginning from the npc if he is active.

 

Just put before the game begins this:


// some code
if(Zeny < 5000)
{
	mes "not enough money";
    close;
}
set Zeny, Zeny - 5000;
// other code

 

 

1 minute ago, Hismoon said:

The announce should before the end; command ... if it then the announce will work.

OnClock1800:
OnClock0900:
	enablenpc strnpcinfo(0);
	end;

OnClock2300:
OnClock0400:
	disablenpc strnpcinfo(0);
	end;

OnInit:
	enablenpc strnpcinfo(0); goto L_Start;
	if (gettime(3) >= 18 && gettime(3) < 23) disablenpc strnpcinfo(0); goto L_End;
	if (gettime(3) >= 04 && gettime(3) < 09) disablenpc strnpcinfo(0); goto L_End;
	end;

L_End:
	announce "It's time for me to rest",bc_all;
	end;

L_Start:

	announce "Boris is Back!",bc_all;
	end;

I think we are good here! Thank you very much for your help Hismoon.  i'll PM you if i saw any problems. BIG THANKS AGAIN!

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

OnInit:
	enablenpc strnpcinfo(0); goto L_Start;
	if (gettime(3) >= 18 && gettime(3) < 23) disablenpc strnpcinfo(0); goto L_End;
	if (gettime(3) >= 04 && gettime(3) < 09) disablenpc strnpcinfo(0); goto L_End;
	end;

This will not work because you need a { and } between the if-statements. You can only use one command after the if-statement. If you put two commands, then you need the brace.

OnInit:
	enablenpc strnpcinfo(0); goto L_Start;
	if (gettime(3) >= 18 && gettime(3) < 23) { disablenpc strnpcinfo(0); goto L_End; }
	if (gettime(3) >= 04 && gettime(3) < 09) { disablenpc strnpcinfo(0); goto L_End; }
	end;

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  18
  • Topics Per Day:  0.01
  • Content Count:  49
  • Reputation:   0
  • Joined:  10/13/17
  • Last Seen:  

17 hours ago, Hismoon said:

OnInit:
	enablenpc strnpcinfo(0); goto L_Start;
	if (gettime(3) >= 18 && gettime(3) < 23) disablenpc strnpcinfo(0); goto L_End;
	if (gettime(3) >= 04 && gettime(3) < 09) disablenpc strnpcinfo(0); goto L_End;
	end;

This will not work because you need a { and } between the if-statements. You can only use one command after the if-statement. If you put two commands, then you need the brace.


OnInit:
	enablenpc strnpcinfo(0); goto L_Start;
	if (gettime(3) >= 18 && gettime(3) < 23) { disablenpc strnpcinfo(0); goto L_End; }
	if (gettime(3) >= 04 && gettime(3) < 09) { disablenpc strnpcinfo(0); goto L_End; }
	end;

 

No wonder it only works once then the next hour didnt activate. Thanks! btw, i was trying to mapflag the turbo_room which the NPC is located with no resurrection skill but i always failed to do so.

THis is what i did.

 "turbo_room mapflag restricted 1" in restricted.txt 
"54,1 //Resu in" Skill_nocast_db.txt
"turbo_room    mapflag town" in town.txt.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.00
  • Content Count:  48
  • Reputation:   0
  • Joined:  12/07/11
  • Last Seen:  

Don't know why it won't work by you, but maybe there is some other mapflags for this map which are blocking each other.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  145
  • Reputation:   1
  • Joined:  04/03/17
  • Last Seen:  

On 06/12/2017 at 5:44 PM, cross10hunter said:

Hi. I try to edit the rpsroulette by Acky 1.2. I came up with this but I cant make it work. Can someone point out to me on what did i do wrong? I try to put an announcer and add a jackpot prize and consilation prize. Here is the script that i did.


KILL:
	specialeffect EF_SUI_EXPLOSION;
	emotion e_omg;
	mes "*^0000FFClick^000000* *^FF0000BANG^000000*";
	mes "OWWW @#$%^!! THAT HURT LIKE HELL!!";
	next;
	set .@rand, rand(1,100);
	if(.@rand < 2) { //Jackpot Prize 1% Win
	Announce "Crazy Boris: " + strcharinfo(0) + " has won the Jackpot Prize of 1 POD! ",8;
	getitem 7179,1;
	}
	else if(.@rand < 5) { // Conso Prize 5% win
	mes "Congratulations you won consolation prize!!";
	switch(rand(6)) {
		case 1: getitem 7539,5; break;
		case 2: getitem 677,1; break;
		case 3: getitem 12103,1; break;
		case 4: getitem 7539,2; break;
		case 5: geitem 750,1; break;	// 1x bapodoll
		case 6: geitem 7008,1; break;	// 1x Stiff Horn
	}
	}
	else if(.@rand < 70) { // Trash
	switch(rand(7)) {
		case 1: geitem 984,10; break;
		case 2: geitem 601,100; break;	// 100x Fly Wings
		case 3: geitem 603,8; break;	// 8x Old Blue Box
		case 4: geitem 4,617; break;	// 4x Old Violet Box
		case 5: geitem 7139,3; break;	// 3x Gold
		case 6: geitem 11502,20 break;	// 20x Light Blue Potion
		case 7: geitem 985,10;
	}
	}
	else {
	mes "too bad you didn't win anything!!";
	}

LEAVE:
	mes "Pansy.";
	close;
}

 

HI, can i have your rock scissor paper script it's look cool :)

Link to comment
Share on other sites

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.

×
×
  • Create New...