Jump to content
  • 0

Spawn NPC + Random mob + request item


kasim03

Question


  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  03/27/17
  • Last Seen:  

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

Link to comment
Share on other sites

11 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  398
  • Reputation:   246
  • Joined:  07/04/19
  • Last Seen:  

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;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  233
  • Reputation:   49
  • Joined:  12/20/18
  • Last Seen:  

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;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  398
  • Reputation:   246
  • Joined:  07/04/19
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  233
  • Reputation:   49
  • Joined:  12/20/18
  • Last Seen:  

1 minute ago, BeWan said:

sorry my bad. lol

You did it correct, I just presented some improvements :)
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  19
  • Topics Per Day:  0.01
  • Content Count:  398
  • Reputation:   246
  • Joined:  07/04/19
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  03/27/17
  • Last Seen:  

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.

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.01
  • Content Count:  233
  • Reputation:   49
  • Joined:  12/20/18
  • Last Seen:  

 
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]
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  03/27/17
  • Last Seen:  

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

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  105
  • Topics Per Day:  0.02
  • Content Count:  446
  • Reputation:   229
  • Joined:  03/20/12
  • Last Seen:  

1 hour ago, kasim03 said:

.@listItems

Change to  .listitems

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  4
  • Topics Per Day:  0.00
  • Content Count:  14
  • Reputation:   0
  • Joined:  03/27/17
  • Last Seen:  

 

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

Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  33
  • Topics Per Day:  0.01
  • Content Count:  1268
  • Reputation:   381
  • Joined:  02/03/12
  • Last Seen:  

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
 

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