Jump to content
  • 0
Sign in to follow this  
Holiness

Slot machine

Question

So I was wondering, is it possible to create a script that uses almost the same dynamic of one player catching a pet? I mean:

- Talk to npc

- Pay some zeny

- Slot machine (the one you see when catching a pet) appears

If "SUCCESS" -> you'll get a prize.

If "Failure" -> talk again to the npc.


Not sure if it's possible, but would be awesome if it was.

Share this post


Link to post
Share on other sites

7 answers to this question

Recommended Posts

  • 0

You would need a custom command to send the clif packet of both of those images. Something like slotmachine(<0|1>);

Where 0 is fail and 1 is pass. Then you can just calculate the random chance by using rand(1,100) and properly telling which version of the command to use.

 

OR

 

you could just make a set of images and produce the same effect using cutin animations

Share this post


Link to post
Share on other sites
  • 0

- Slot machine (the one you see when catching a pet) appears

Not sure if it's possible, but would be awesome if it was.

seems impossible

I tested it

 src/map/script.c | 17 +++++++++++++++++ 1 file changed, 17 insertions(+)diff --git a/src/map/script.c b/src/map/script.cindex cbea20e..0d1a416 100644--- a/src/map/script.c+++ b/src/map/script.c@@ -18778,10 +18778,27 @@ bool script_hp_add(char *name, char *args, bool (*func)(struct script_state *st) 	return script->add_builtin(&buildin, true); } +BUILDIN(catch_process) {+	TBL_PC *sd = script->rid2sd(st);+	if ( sd )+		clif->catch_process(sd);+	return true;+}++BUILDIN(pet_roulette) {+	TBL_PC *sd = script->rid2sd(st);+	if ( sd )+		clif->pet_roulette( sd, script_getnum(st,2) ? 1:0 );+	return true;+}++ #define BUILDIN_DEF(x,args) { buildin_ ## x , #x , args } #define BUILDIN_DEF2(x,x2,args) { buildin_ ## x , x2 , args } void script_parse_builtin(void) { 	struct script_function BUILDIN[] = {+		BUILDIN_DEF(catch_process,""),+		BUILDIN_DEF(pet_roulette,"i"), 		// NPC interaction 		BUILDIN_DEF(mes,"s*"), 		BUILDIN_DEF(next,""),
-	script	jdskjsf	-1,{OnInit:	bindatcmd "petcatch", strnpcinfo(0)+"::Onbbb";	bindatcmd "petroll", strnpcinfo(0)+"::Onaaa";	end;Onaaa:	pet_roulette( atoi( .@atcmd_parameters$ ) );	end;Onbbb:	catch_process();	end;}
the clif->catch_process demands the player to click on the monster (poring)

Alt+1 to execute @petcatch, and the cursor change into monster taming one,

after click on the poring only the machine start rolling,

I Alt+2 (@petroll 0) and gets fail without monster, Alt+3 (@petroll 1) gets success but without monster too

 

seems like there's no known way to just make the machine appear ... probably need some client hexing already

 

EDIT: its not difficult to write the command, but doesn't look promising

yeah better use cutin

 

 

PS: reminds me of this

http://rathena.org/board/topic/90717-r-color-game-machine/?hl=cutin#entry236736

Edited by AnnieRuru

Share this post


Link to post
Share on other sites
  • 0

@Annieruru - Is it possible to send the client a dummy mob Id? As in, also send a packet to the client saying you clicked on a mob? If not the yeah, cutin is the way to go.

 

Edit: Okay here is the script with Cutins. I simplified it quite a bit, so there isn't much room for customizations unless you know what your doing =P

prontera,152,176,4	script	SlotMachine	563,{mes "Do you want to play a game?","It costs: "+ .zeny +" zeny to play.";if( select("YES:NO") == 2 || Zeny < .zeny ){ close; }while( @menu == 1 ){Zeny -= .zeny;.@a = rand(1,100);if( .@a < atoi(.animate$[0]) ){ .@a = 1; } else { .@a = 2; }.@b = 1;while( .@b < atoi(.animate$[.@a]) ) {	cutin .animate$[3] + .@b,4; sleep2 ( ( atoi(.animate$[4]) * 1000 ) / atoi(.animate$[1]) ); .@b++;	}if( .@a == 1 ){ 	cutin .animate$[3] + atoi(.animate$[1]),4;	dispbottom "Failed";	} else {	cutin .animate$[3] + atoi(.animate$[2]),4;	getitem .prize[0], .prize[1];	}if( select("Another Round:I'm done") == 2 || Zeny < .zeny ){ cutin "",255; close; }}end;OnInit://[0] = Fail Rate//[1] = Fail (Do not change)//[2] = Success (Do not change)//[3] = File Name (Do not change)//[4] = Animation Time (Do not change, for best results )setarray .animate$[0],"30","29","33","slot_","3";setarray .prize[0],501,10;.zeny = 100;end;}

 

And Also, the cutin files: slot_machine.rar

Just add these to your:  data/texture/À¯ÀúÀÎÅÍÆäÀ̽º/illust folder.

Edited by GmOcean

Share this post


Link to post
Share on other sites
  • 0

@Annieruru - Is it possible to send the client a dummy mob Id? As in, also send a packet to the client saying you clicked on a mob? If not the yeah, cutin is the way to go.

no, the server send packet to tell the client to change cursor into monster taming

its the client that send the packet to tell the server about which mob ID was tamed

Share this post


Link to post
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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.