Jump to content
  • 0
Mythryx

Looking for help with Goldroom Script

Question

Im trying to get this to work. When you get killed you will lose all the gold points you have.

prontera,164,146,3    script    Gold Room Assistant#goldroom    4_F_KAFRA1,{
    doevent "gold_room_main::OnTalk";

OnInit:
delwaitingroom;
waitingroom "  Gold Room",0;


end;


}

// 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    Peco Gold    1369,600,0,0,"gold_room_main::OnKill"


-    script    gold_room_main    -1,{
    
    OnInit:
        // gold room map
        .map$ = "ordeal_3-2";
        // entrance fee
        .zeny_cost = 250000;
        // rate to get gold
        .rate = 50;
        // gold random amount
        setarray .gold_amount,1,3;
        

        setmapflag .Map$,mf_nogo;
        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_noskill;
        setmapflag .Map$,mf_noloot;


        end;
    
    OnTalk:
        mes "Wasup, Low Class People! I know you want to become rich!";
        mes "Well i have a place where you can find a very rare Birds.";
    next;
        mes "And if you kill those birthds you will gain a random amount of GOLD";
        mes "Points or GP and you can ^FF0000TRADE^000000 it into real GOLD!";
    next;
        mes "But there is something you should know...";
        mes "There are guardians that lurking around the map and they are strong!!!";
    next;
        mes "^FF0000All of your points will lose when you die!^000000 ";
    next;
        mes "I need";
        if ( .zeny_cost ) 
            mes F_InsertComma( .zeny_cost ) + " Zeny";
        switch ( select( 
            "Enter Gold Room",
            "Exchange Gold Point",
            "Cancel"
        )) {
            case 1:
                if ( Zeny < .zeny_cost ) {
                    mes "Not enough Zeny.";
                }
                else {
                    Zeny -= .zeny_cost;
                    warp .map$,153,153;
                }
                break;
            case 2:    
                mes "You got "+F_InsertComma( #GOLDPOINTS )+" Points";
                input [email protected],0,#GOLDPOINTS;
                if ( checkweight( 969, [email protected] ) ) {
                    #GOLDPOINTS -= [email protected];
                    getitem 969,[email protected];
                    mes "Gained "[email protected]+" Gold.";
                }
                else {
                    mes "You overweight.";
                }
            default:
                break;
        }
        close;
        
    OnKill:
        if ( .rate < rand( 100 ) ) {
            [email protected] = rand( .gold_amount[0],.gold_amount[1] );
            #GOLDPOINTS += [email protected];
            dispbottom "Gained "[email protected]+" Point. You got "+F_InsertComma( #GOLDPOINTS )+" Points now.";
        }
        end;
 
    OnPCDieEvent:
        [email protected] = killerrid;
        if ( strcharinfo(3) == .map$ && [email protected] != getcharid(3) && getmonsterinfo( [email protected],MOB_NAME ) != "null" ) {
            #GOLDPOINTS = 0;
            dispbottom "You died, you lost all the point.";
        }
        end;
}

Im not really sure on why its not working.

Abit of help would be much appreciated. 

Thanks!

Edited by Emistry
Link to comment
Share on other sites

4 answers to this question

Recommended Posts

  • 0
    OnPCDieEvent:
        [email protected] = killerrid;
        if (strcharinfo(3) == .map$ && [email protected] != getcharid(3)) {
            #GOLDPOINTS = 0;
            dispbottom "You died, you lost all the point.";
        }
        end;

try this

Link to comment
Share on other sites

  • 0
On 4/9/2020 at 8:16 AM, Emistry said:
    OnPCDieEvent:
        [email protected] = killerrid;
        if (strcharinfo(3) == .map$ && [email protected] != getcharid(3)) {
            #GOLDPOINTS = 0;
            dispbottom "You died, you lost all the point.";
        }
        end;

try this

@Emistry thanks for this.  can you add if you killed someone inside the gold room you'll get their points? thanks

Link to comment
Share on other sites

  • 0
	OnPCDieEvent:
		[email protected] = killerrid;
		if (strcharinfo(3) == .map$ && [email protected] != getcharid(3)) {
			[email protected]_gold_point = #GOLDPOINTS;
			#GOLDPOINTS = 0;
			dispbottom "You died, you lost all the points.";
			
			if (attachrid([email protected])) {
				#GOLDPOINTS += [email protected]_gold_point;
				dispbottom "You gained "[email protected]_gold_point+" gold points.";
			}
		}
		end;

 

Edited by Emistry
Link to comment
Share on other sites

  • 0
17 hours ago, Emistry said:
	OnPCDieEvent:
		[email protected] = killerrid;
		if (strcharinfo(3) == .map$ && [email protected] != getcharid(3)) {
			[email protected]_gold_point = #GOLDPOINTS;
			#GOLDPOINTS = 0;
			dispbottom "You died, you lost all the points.";
			
			if (attachrid([email protected])) {
				#GOLDPOINTS += [email protected]_gold_point;
				dispbottom "You gained "[email protected]_gold_point+" gold points.";
			}
		}
		end;

 

thank you so much, works perfect!

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

Important Information

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