Jump to content
  • 0

Help with this little script


Erebos

Question


  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

-	script	cashmvp	-1,{


OnInit:
	.randcash == rand(10,20);


OnNPCKillEvent:
	if( getmonsterinfo( killedrid,MOB_MVPEXP )){
		atcommand "@cash" .randcash;
		dispbotton .randcash;
			end;
			}
			}

Can't make it work, its supposed to give a random amount of cash, between 10 and 20 every time a player kils an MVP monster. And show a message of how much cash the player got.

Link to comment
Share on other sites

5 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

50 minutes ago, Brizyous said:

-	script	cashmvp	-1,{


OnInit:
	.randcash == rand(10,20);


OnNPCKillEvent:
	if( getmonsterinfo( killedrid,MOB_MVPEXP )){
		atcommand "@cash" .randcash;
		dispbotton .randcash;
			end;
			}
			}

Can't make it work, its supposed to give a random amount of cash, between 10 and 20 every time a player kils an MVP monster. And show a message of how much cash the player got.

dispbottom instead of dispbotton???

 

Update:  Should be good.

Quote

-    script    cashmvp    -1,{
OnNPCKillEvent:
        .@mobIDK = killedrid;
        //dispbottom (" killedrid :: " + killedrid );
        if ( getmonsterinfo( .@mobIDK , MOB_MVPEXP) > 0 ) {
            .@a = callfunc("F_Rand",100,200);
            atcommand ("@Cash " + .@a);
            dispbottom ("Increased Cash " + .@a );
        }
        end;
}

 

Edited by utofaery
  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

Thanks! it worked but i get either 100 or 200 cash, how do i make so i get a random number from 100 to 200?

edit: i figured it out thanks!

Edited by Brizyous
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

my bad

change 100 and 200 to anything.

-	script	cashmvp	-1,{
OnNPCKillEvent:
		.@i1 = 100;
		.@i2 = 200;
		if ( getmonsterinfo( killedrid , MOB_MVPEXP) > 0 ) {
			.@a = callfunc("F_Rand",.@i1,.@i2);
			atcommand ("@Cash " + .@a);
			dispbottom ("Increased Cash " + .@a );
		}
		end;
}


 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  26
  • Topics Per Day:  0.01
  • Content Count:  65
  • Reputation:   4
  • Joined:  10/25/18
  • Last Seen:  

i used  rand(10,20) instead of the function, do u think it could have any bugs like that or its fine?

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  23
  • Topics Per Day:  0.01
  • Content Count:  228
  • Reputation:   19
  • Joined:  10/27/12
  • Last Seen:  

On 1/29/2019 at 4:15 AM, Brizyous said:

i used  rand(10,20) instead of the function, do u think it could have any bugs like that or its fine?

Replace the line from :

-    script    cashmvp    -1,{
OnNPCKillEvent:
        if ( getmonsterinfo( killedrid , MOB_MVPEXP) > 0 ) {
            .@a = rand(10,20);
            atcommand ("@Cash " + .@a);
            dispbottom ("Increased Cash " + .@a );
        }
        end;
}
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...