Jump to content
  • 0

Need help for this gold room please


Yaziid91

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  04/20/19
  • Last Seen:  

Hello and Good day,

I need help regarding about adding a restriction to the Gold Room NPC we are currently working on.

I would like that when the player is killed by another he loses all points gained and that the other player steals all the points of the player he killed

Our server is currently running on rAthena.

Thank you so much for the help!

Here is the script:

askald,104,205,5    script    PvP Gold Room    4_F_KAFRA1,{
    doevent "gold_room_main::OnTalk";
}
// warp portal back prontera
ordeal_3-2,123,123,0    warp    gold_room_back_prt    1,1,prontera,155,181

// peco peco summon
ordeal_3-2,0,0,0,0    monster    Gold    1954,100,60000,0,"gold_room_main::OnKill"

-    script    gold_room_main    -1,{
    
    OnInit:
        // gold room map
        .map$ = "ordeal_3-2";
        // entrance fee
        .zeny_cost = 500000;
        // rate to get gold
        .rate = 100;
        // gold random amount
        setarray .gold_amount,1,5;
        
        setmapflag .map$,mf_noteleport;
        setmapflag .map$,mf_nobranch;
        setmapflag .map$,mf_nosave;
        setmapflag .map$,mf_nomemo;
        setmapflag .map$,mf_noreturn;
        setmapflag .map$,mf_nowarp;
        setmapflag .map$,mf_nowarpto;
        setmapflag .map$,mf_pvp;        
        end;
    
    OnTalk:
        mes "Enter Gold Room ?";
        if ( .zeny_cost )
            mes F_InsertComma( .zeny_cost ) + " Zeny";
        switch ( select( "Enter Gold Room","Exchange Gold Point","Information" )) {
            case 1:
            
                if ( Zeny < .zeny_cost ) {
                    mes "Not enough Zeny.";
                }
                else {
                    Zeny -= .zeny_cost;
                    warp .map$,0,0;
                }
                next;
                break;
            case 2:    
                mes "You got "+F_InsertComma( #GOLDPOINTS )+" Points";
                input .@value,0,#GOLDPOINTS;
                if (.@value == 0) {
                    mes "Exchange canceled.";
                close;
                }
                if ( checkweight( 969, .@value ) ) {
                    #GOLDPOINTS -= .@value;
                    getitem 969,.@value;
                    mes "Gained "+.@value+" Gold.";
                }
                else {
                    mes "You are overweight.";
                }
                break;
             case 3:    
                mes "In this room you will have the chance to get 2 points for each monster killed, but if another player kills you you lose all your points! 1 point gets you 1 gold";
                next;
                break;
        }
        close;
        
    OnKill:    
        if ( .rate > rand( .100 ) ) {
            .@point = 2;
            #GOLDPOINTS += .@point;
            dispbottom "Gained "+.@point+" Point. You got "+F_InsertComma( #GOLDPOINTS )+" Points now.";

        }
        end;

    OnPCDieEvent:
        .@killerrid = killerrid;
        if ( strcharinfo(3) == .map$ && .@killerrid != getcharid(3) && getmonsterinfo( .@killerrid,MOB_NAME ) != "null" ) {
            #GOLDPOINTS = 0;
            dispbottom "You died, you lost all the point.";
        }
        end;
}

 

 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  236
  • Reputation:   87
  • Joined:  06/30/18
  • Last Seen:  

I didn't test it, but this should give you an idea how to achieve what you want:
 

askald,104,205,5    script    PvP Gold Room    4_F_KAFRA1,{
    doevent "gold_room_main::OnTalk";
}
// warp portal back prontera
ordeal_3-2,123,123,0    warp    gold_room_back_prt    1,1,prontera,155,181

// peco peco summon
ordeal_3-2,0,0,0,0    monster    Gold    1954,100,60000,0,"gold_room_main::OnKill"

-    script    gold_room_main    -1,{
    OnInit:
        // gold room map
        .map$ = "ordeal_3-2";
        // entrance fee
        .zeny_cost = 500000;
        // rate to get gold
        .rate = 100;
		// points per kill
		.points_per_kill = 2;
        // gold random amount
        setarray(.gold_amount, 1, 5);
        
        setmapflag .map$,mf_noteleport;
        setmapflag .map$,mf_nobranch;
        setmapflag .map$,mf_nosave;
        setmapflag .map$,mf_nomemo;
        setmapflag .map$,mf_noreturn;
        setmapflag .map$,mf_nowarp;
        setmapflag .map$,mf_nowarpto;
        setmapflag .map$,mf_pvp;        
        end;
    
    OnTalk:
        mes "Enter Gold Room?";
		next;

        if(.zeny_cost) {
            mes F_InsertComma(.zeny_cost) + " Zeny";
			close;
		}

        switch(select("Enter Gold Room","Exchange Gold Point","Information")) {
            case 1:
                if (Zeny < .zeny_cost) {
                    mes "Not enough Zeny.";
					break;
                }
 
				Zeny -= .zeny_cost;
				warp .map$,0,0;
				end;
            case 2:    
                mes "You got " + F_InsertComma(#GOLDPOINTS) + " Points";
                input .@value,0,#GOLDPOINTS;
                if (.@value == 0) {
                    mes "Exchange canceled.";
                	break;
                }

                if(checkweight(969, .@value)) {
                    #GOLDPOINTS -= .@value;
                    getitem(969, .@value);
                    mes "Gained " + .@value + " Gold.";
					break;
                }
                break;
             case 3:    
                mes "In this room you will have the chance to get " + .points_per_kill + " points for each monster killed, but if another player kills you you lose all your points! 1 point gets you 1 gold";
                break;
        }
        close;

    OnKill:    
        if(rand(100) < .rand) {
            #GOLDPOINTS += .points_per_kill;
            dispbottom "You gained " + .points_per_kill + " Points. You do have " + F_InsertComma(#GOLDPOINTS) + " Points now.";
        }
        end;

    OnPCKillEvent:
        if (strcharinfo(3) != .map$) end;

		.@killer_name$ = strcharinfo(0);
		.@killed_name$ = rid2name(killedrid);
		.@killed_char_id = getcharid(0, .@killed_name$);
		.@killed_gold_points = getvar("#GOLDPOINTS", .@killed_char_id);

		#GOLDPOINTS += .@killed_gold_points;
		dispbottom("You killed " + .@killed_name$ + " and got all his points. You do have " + F_InsertComma(#GOLDPOINTS) + " Points now.";

		attachrid(killedrid);
		#GOLDPOINTS = 0;
		dispbottom("You died and lost all your points to " + .@killer_name$ + ".");
}

 

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  17
  • Reputation:   0
  • Joined:  04/20/19
  • Last Seen:  

Thanks you, i have this error now

 

[Error]: buildin_getvar: Not a variable
[Debug]: Data: string value="#GOLDPOINTS"
[Debug]: Source (NPC): gold_room_main (invisible/not on a map)

 

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...