Jump to content
  • 0

Question

9 answers to this question

Recommended Posts

Posted

ill try this

-	script	AllDrop	-1,{
OnPCKillEvent:
if( rand(100) < 10 )
	getitem .item[ rand( .item_size ) ],1;
end;
 
OnInit:
	setarray .item[0],607,608,512;
	.item_size = getarraysize( .item );
	end;
}
 

is this right?

Posted

OnPCKillEvent will only be executed when a player will kill another player so to achieve a global monster drop use OnNPCKillEvent

 

So the script should look like this:

OnNPCKillEvent:
if( rand(1000) < 10 ) // Chance: 10 = 1%, 100 = 10%, etc.
    getitem  .item[ rand( .item_size ) ],1;
end;

OnInit:
setarray .item[0],<item id1>,<item id2>,<item id3>,<more>;
.item_size = getarraysize( .item );
end;
Posted (edited)

If you want the mobs to actually DROP it (on your location, probably the easiest way), use makeitem though. Be aware that autoloot won't work on it and anyone can pick it up immediately.

 

 

if (getmapxy(.@map$,.@x,.@y,0,strcharinfo(0))!=1) {
   makeitem ID,amount,.@map$,.@x,.@y;
}

 

if it should drop a bit further from your character, you can add a number to x and y

like

 

.@x+1

or .@x+rand(2)

whatever

 

my 0.02$ :b

Edited by HollyEnix
  • Upvote 1
Posted (edited)

1/

OnNPCKillEvent:
    if( rand(1000) < 500 ) // Chance: 10 = 1%, 100 = 10%, etc.
        getitem callfunc( "F_RandMes", 5, 501,502,503,504,505 ), rand( 1,10 ); // http://rathena.org/board/topic/78263-scripting-faqtipstricks/
    end;
 

 

how about random amount of item per monster?? i want 1 monster = something like 50% item then 1-10 amount

amount 1-10 : rand( 1,10 );

 

 

 

2/

If you want the mobs to actually DROP it (on your location, probably the easiest way), use makeitem though. Be aware that autoloot won't work on it and anyone can pick it up immediately.

 

 

if (getmapxy(.@map$,.@x,.@y,0,strcharinfo(0))!=1) {
   makeitem ID,amount,.@map$,.@x,.@y;
}

*getmapxy("<variable for map name>",<variable for x>,<variable for y>,<type>{,"<search string>"})

This function will locate a character object, NPC object or pet's coordinates
and place their coordinates into the variables specified when calling it. It
will return 0 if the search was successful, and -1 if the parameters given were
not variables or the search was not successful.

always != 1

 

OnNPCKillEvent:
	if( rand(1000) < 500 ) { // Chance: 10 = 1%, 100 = 10%, etc.
		getmapxy .@map$, .@x, .@y, 0;
		makeitem callfunc( "F_RandMes", 5, 501,502,503,504,505 ), rand( 1,10 ), .@map$, .@x, .@y; // <num item>, <item id1>,<item id2>,<item id3>
	}
	end;
Edited by Capuche
  • Upvote 1
Posted (edited)

having the npc named after an event label (OnNPCKillEvent) returns your error, I believe.

use another npc name, like bahmut did, and put the OnNPCKillEvent as a label within the npc

don't have a server to confirm atm

Edited by HollyEnix

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