Jump to content
  • 0

Spawn NPC + Random mob + request item


Question

Posted
prontera,154,179,4	script	summoner	100,{
monster "prontera", 157, 181, "Poring", 1005, 1, strnpcinfo(0) + "::OnMobKilled";
monster "prontera", 157, 181, "Poring", 1115, 1, strnpcinfo(0) + "::OnMobKilled";
end;


OnMobKilled:
getitem 501, 1; // 1 red potion
end;
}

My plan is to have this script have a random spawn and to spawn it requires an item. If you press this npc it will ask for the item to avoid spam.

I already love this script spawn, it just needs extra random spawn on this script. If possible, I want random items to fall off the mob as well.

 

Thanks to those who helped me...?

11 answers to this question

Recommended Posts

  • 0
Posted

here.  ?

prontera,154,179,4	script	summoner	100,{

if( countitem(512) > 500){
	monster "prontera", 0, 0, "Poring", 1005, 1, strnpcinfo(0) + "::OnMobKilled";
	monster "prontera", 0, 0, "Poring", 1115, 1, strnpcinfo(0) + "::OnMobKilled";
	end;
}else{
	mes "sorry you need 500 apple to summon";
}



OnMobKilled:
getitem 501, 1; // 1 red potion
end;
}

 

  • 0
Posted
Completing the script : @BeWan
prontera,154,179,4	script	summoner	100,{

if( countitem(512) > 500){
	delitem 512,500;
	monster "prontera", 0, 0, "Poring", 1005, 1, strnpcinfo(0) + "::OnMobKilled";
	monster "prontera", 0, 0, "Poring", 1115, 1, strnpcinfo(0) + "::OnMobKilled";
	end;
}else{
	mes "sorry you need 500 apple to summon";
}

OnMobKilled:
set @amount, rand(1,5); //quantity of different items
set @whatItem, rand(0,.@size); //Which item was chosen
set @amountItem, rand(1,10); //Quantity of item you will receive

for (i = 0; i < @amount; i++) {
getitem @whatItem, @amountItem;
}
end;

OnInit:
setarray .@listItens[0],500,501,502,503,504,505,506,507; //Itens
.@size = getarraysize(.@listItens); //Size Array Itens
end;
}

 

  • 0
Posted
8 minutes ago, Disabled LOOLP said:

Completing the script : @BeWan

prontera,154,179,4	script	summoner	100,{

if( countitem(512) > 500){
	delitem 512,500;
	monster "prontera", 0, 0, "Poring", 1005, 1, strnpcinfo(0) + "::OnMobKilled";
	monster "prontera", 0, 0, "Poring", 1115, 1, strnpcinfo(0) + "::OnMobKilled";
	end;
}else{
	mes "sorry you need 500 apple to summon";
}

OnMobKilled:
set @amount, rand(1,5); //quantity of different items
set @whatItem, rand(0,.@size); //Which item was chosen
set @amountItem, rand(1,10); //Quantity of item you will receive

for (i = 0; i < @amount; i++) {
getitem @whatItem, @amountItem;
}
end;

OnInit:
setarray .@listItens[0],500,501,502,503,504,505,506,507; //Itens
.@size = getarraysize(.@listItens); //Size Array Itens
end;
}

 

sorry my bad. lol

  • 0
Posted
29 minutes ago, Disabled LOOLP said:

You did it correct, I just presented some improvements :)

i know but im kinda in a rush thats why hehe

  • 0
Posted
4 hours ago, Disabled LOOLP said:

Completing the script : @BeWan

prontera,154,179,4	script	summoner	100,{

if( countitem(512) > 500){
	delitem 512,500;
	monster "prontera", 0, 0, "Poring", 1005, 1, strnpcinfo(0) + "::OnMobKilled";
	monster "prontera", 0, 0, "Poring", 1115, 1, strnpcinfo(0) + "::OnMobKilled";
	end;
}else{
	mes "sorry you need 500 apple to summon";
}

OnMobKilled:
set @amount, rand(1,5); //quantity of different items
set @whatItem, rand(0,.@size); //Which item was chosen
set @amountItem, rand(1,10); //Quantity of item you will receive

for (i = 0; i < @amount; i++) {
getitem @whatItem, @amountItem;
}
end;

OnInit:
setarray .@listItens[0],500,501,502,503,504,505,506,507; //Itens
.@size = getarraysize(.@listItens); //Size Array Itens
end;
}

 

Thanks for this script and for your help.

Actually there is a little more to add, if possible, I want a random spawn mob.

 

  • 0
Posted
3 minutes ago, Disabled LOOLP said:
 

To spawn random mobs, use the same array idea as the items, set the quantity, id of the mobs, and invoke the same way as the poring in question.

Just use the array [x]
alb2trea,84,69,4	script	summoner	100,{
set .monster, .mob_id[.random];
if( countitem(512) > 1){
	delitem 512,1;
	monster "alb2trea",0,0,getmonsterinfo(.monster, 0),.monster,.amount,strnpcinfo(0)+ "::OnMobKilled";
	end;
}else{
	mes "sorry you need 1 apple to summon";
}

OnMobKilled:
announce "Monster is already killed",0;
set @amount, rand(1,5); //quantity of different items
set @whatItem, rand(0,.@size); //Which item was chosen
set @amountItem, rand(1,10); //Quantity of item you will receive

for (i = 0; i < @amount; i++) {
getitem @whatItem, @amountItem;
}
end;

OnInit:

		setarray .@listItems[0],501,502,503; //Items
		.@size = getarraysize(.@listItems); //Size Array Items
		setarray .mob_id[0],1002,1113,1399,1159;
		set .size, getarraysize(.mob_id);
		set .random, rand(.size);
		set .amount, 2; // amount of monster spawned
end;
}

I'm not sure if the script I'm editing is working properly or not.
Monster spawn - ok
Item use - ok
Random spawn - not sure
Random item drop - not sure

and i have this error n bug??

111.png.960fa8b3cf81f6371d39544640ba00af.png

  • 0
Posted

 

On 1/10/2020 at 2:43 AM, Disabled LOOLP said:

Completing the script : @BeWan

prontera,154,179,4	script	summoner	100,{

if( countitem(512) > 500){
	delitem 512,500;
	monster "prontera", 0, 0, "Poring", 1005, 1, strnpcinfo(0) + "::OnMobKilled";
	monster "prontera", 0, 0, "Poring", 1115, 1, strnpcinfo(0) + "::OnMobKilled";
	end;
}else{
	mes "sorry you need 500 apple to summon";
}

OnMobKilled:
set @amount, rand(1,5); //quantity of different items
set @whatItem, rand(0,.@size); //Which item was chosen
set @amountItem, rand(1,10); //Quantity of item you will receive

for (i = 0; i < @amount; i++) {
getitem @whatItem, @amountItem;
}
end;

OnInit:
setarray .@listItens[0],500,501,502,503,504,505,506,507; //Itens
.@size = getarraysize(.@listItens); //Size Array Itens
end;
}

 

this script have bug, item random not drop...

  • 0
Posted
prontera,154,179,4	script	summoner	100,{
	if(countitem(512) > 500){
		delitem 512,500;
		monster "prontera", 0, 0, "Poring", 1005, 1, strnpcinfo(0) + "::OnMobKilled";
		monster "prontera", 0, 0, "Poring", 1115, 1, strnpcinfo(0) + "::OnMobKilled";
	} else {
		mes "sorry you need 500 apple to summon";
		close;
	}
	end;

OnMobKilled:
	set .@amount, rand(1,5); //quantity of different items
	set .@whatItem, rand(.size); //Which item was chosen
	set .@amountItem, rand(1,10); //Quantity of item you will receive

	for (.@i = 0; .@i < .@amount; .@i++)
		getitem .@whatItem, .@amountItem;
	end;

OnInit:
	setarray .listItems[0], 500, 501, 502, 503, 504, 505, 506, 507; //Items
	.size = getarraysize(.listItems);
}

There are still a few problems with the script but I don't have time.

If you want the item to look like it dropped.

https://github.com/rathena/rathena/blob/master/doc/script_commands.txt#L4827
 

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