Jump to content
  • 0

Requesting a Random Spawn of X Mobs between Y, W & Z Maps


ItsFree

Question


  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   7
  • Joined:  04/11/15
  • Last Seen:  

Hi, rAthena Community i've a new request :D i dont know if possible but i'll try to explain it the better way i can do....

as i know this is a normal mob spawn...
 

prontera,0,0	monster	Wild Rose	1261,1,7200000,3600000

Ok... what i want for example is that, that "wild rose" spawn between prontera, payon, louyang, morocc, alberta & izlude.... i mean if i set 1, or 2, o 3 mobs they spawn "random" on all those maps... is there a way to do something like that ¿?

If need more info tell me i'll try explain better ^^

Link to comment
Share on other sites

7 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   7
  • Joined:  08/10/17
  • Last Seen:  

14 minutes ago, ItsFree said:

Hi, rAthena Community i've a new request :D i dont know if possible but i'll try to explain it the better way i can do....

as i know this is a normal mob spawn...
 


prontera,0,0	monster	Wild Rose	1261,1,7200000,3600000

Ok... what i want for example is that, that "wild rose" spawn between prontera, payon, louyang, morocc, alberta & izlude.... i mean if i set 1, or 2, o 3 mobs they spawn "random" on all those maps... is there a way to do something like that ¿?

If need more info tell me i'll try explain better ^^

Like this?

https://github.com/rathena/rathena/blob/master/npc/mobs/citycleaners.txt

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   7
  • Joined:  04/11/15
  • Last Seen:  

no >< what i want i set 1 monster but is spawn on different maps, for example that wild rose could spawn on pronter, or payon, or izlude, or aldebaran, etc after wild rose die, the next respawn woul be at random again to one of the maps designed.

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  6
  • Topics Per Day:  0.00
  • Content Count:  75
  • Reputation:   7
  • Joined:  08/10/17
  • Last Seen:  

1 hour ago, ItsFree said:

no >< what i want i set 1 monster but is spawn on different maps, for example that wild rose could spawn on pronter, or payon, or izlude, or aldebaran, etc after wild rose die, the next respawn woul be at random again to one of the maps designed.

This is untested... I don't know if it will work but it should be a good start I think??

function	script	getRandMap	{
//this function is to assign a random map name to a variable
	$randMap == rand(0,4);
	if ($randMap == 0){
		setd $mapName == "prontera";
		return;
	}
	if ($randMap == 1){
		setd $mapName == "payon";
		return;
	}
	if ($randMap == 2){
		setd $mapName == "morroc";
		return;
	}
	if ($randMap == 3){
		setd $mapName == "izlude";
		return;
	}
	if ($randMap == 4){
		setd $mapName == "prt_fild08";
		return;
	}
	else { 
		debugmes "ERROR: Random Map generation failed!";
		end;
	}
}

anyMap,anyX,anyY,anyZ	script	<name_NPC>::monsterEvent	111,{ //this can be floating NPC, i forget how

OnInterIfInitOnce:
	callfunc "getRandMap";
	monster $mapName,0,0,"Event Monster",<insert_mob_id>,1,"monsterEvent::OnRespawnMonster";
	debugmes "DEBUG: EVENT MONSTER SPAWNED SUCCESSFULLY "+$mapName;
	end;
OnRespawnMonster:
	announce strcharinfo(0)+" killed the event monster! Respawning...";
	callfunc "getRandMap";
	monster $mapName,0,0,"Event Monster",<insert_mob_id>,1,"monsterEvent::OnRespawnMonster";
	debugmes "DEBUG: EVENT MONSTER RESPAWNED @"+$mapName;
	end;
}	

*Edit: Obviously there are some things you need to add yourself. Such as the location of the NPC (you can make it floating NPC... no need to click) and the type of monster, the maps you want it to spawn on, etc

Edited by SpiritD
see above
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

You could clean this up quite a bit as well, by using an array of maps

Setarray .maps,"prontera","payon";

monster .maps[rand(getarraysize(.maps))],0,0,"Event Monster",<insert_mob_id>,1,"monsterEvent::OnRespawnMonster";
Edited by Stolao
  • Love 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   7
  • Joined:  04/11/15
  • Last Seen:  

nice i gonna try that from stolao, also i got this... @SpiritD

 

error on function.png

also if can put a "working" example would be helpful kinda slow about understand some stuff...

Edited by ItsFree
Link to comment
Share on other sites

  • 0

  • Group:  Developer
  • Topic Count:  48
  • Topics Per Day:  0.01
  • Content Count:  1443
  • Reputation:   337
  • Joined:  10/17/12
  • Last Seen:  

$randmap == rand(0,4);

Should be

$randmap = rand(0,4);

 

== Is a comparator while = defines

Also $randmap can probably be .@randmap or .randmap since it doesn't need to be a server variable.

  • Upvote 1
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  44
  • Topics Per Day:  0.01
  • Content Count:  121
  • Reputation:   7
  • Joined:  04/11/15
  • Last Seen:  

some problems on consoble about , ; () but i fix them, but script not working... the idea of this npc is to use with "taming monsters" i mean they spawn on those maps random and everything these are the scripts that im using and not working... but 

 

function	script	getRandMap	{
//this function is to assign a random map name to a variable
	.randMap = rand(0,4);
	if (.randMap = 0){
		setd .mapName = "prontera",
		return;
	}
	if (.randMap == 1){
		setd .mapName = "payon",
		return;
	}
	if (.randMap == 2){
		setd .mapName = "morocc",
		return;
	}
	if (.randMap == 3){
		setd .mapName = "izlude",
		return;
	}
	if (.randMap == 4){
		setd .mapName = "prt_fild08",
		return;
	}
	else { 
		debugmes "ERROR: Random Map generation failed!";
		end;
	}
}

 

 

payon,170,91,5	script	Taming Monsters::tamingmonster	111,{ //this can be floating NPC, i forget how

OnInterIfInitOnce:
	callfunc "getRandMap";
	monster .mapName,0,0,"Taming Monster",2845,1,"tamingmonster::OnRespawnMonster";
	debugmes "DEBUG: EVENT MONSTER SPAWNED SUCCESSFULLY "+.mapName;
	end;
OnRespawnMonster:
	announce strcharinfo(0)+" ah Matado al Taming Monster...",
	callfunc ("getRandMap");
	monster .mapName,0,0,"Taming Monster",2845,1,"tamingmonster::OnRespawnMonster";
	debugmes "DEBUG: EVENT MONSTER RESPAWNED @"+.mapName;
	end;
}	

 

on console i only got the debug message about failed each time i click the npc also... how can i make it a floating npc? ^^ Thx!!

 

random map generator error.png

Edited by ItsFree
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...