Jump to content
  • 0

Looking for help with Goldroom Script


Question

Posted (edited)

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 .@value,0,#GOLDPOINTS;
                if ( checkweight( 969, .@value ) ) {
                    #GOLDPOINTS -= .@value;
                    getitem 969,.@value;
                    mes "Gained "+.@value+" Gold.";
                }
                else {
                    mes "You overweight.";
                }
            default:
                break;
        }
        close;
        
    OnKill:
        if ( .rate < rand( 100 ) ) {
            .@point = rand( .gold_amount[0],.gold_amount[1] );
            #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;
}

Im not really sure on why its not working.

Abit of help would be much appreciated. 

Thanks!

Edited by Emistry

4 answers to this question

Recommended Posts

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

try this

  • 0
Posted
On 4/9/2020 at 8:16 AM, Emistry said:

    OnPCDieEvent:
        .@killerrid = killerrid;
        if (strcharinfo(3) == .map$ && .@killerrid != 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

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

 

Edited by Emistry
  • 0
Posted
17 hours ago, Emistry said:

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

 

thank you so much, works perfect!

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