Jump to content
  • 0

monster spawn on a map


laonglaing

Question


  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  35
  • Reputation:   0
  • Joined:  06/12/16
  • Last Seen:  

is it possible to dynamically control wether the mobs in a map will spawn or not? my goal is to stop the mobs/monster spawn in a map at certain time within the day.
I can't find any solution/functions to do this, might need to update the source itself? 
 

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  236
  • Reputation:   87
  • Joined:  06/30/18
  • Last Seen:  

It is possible, but you have to write the respawn logic yourself. Here is an untested example:
 

-	script	DYNAMIC_MOB_SPAWN	-1,{
	OnInit:
		.mob_id = 1002;
		.mob_amount = 10;
		.mob_map$ = "prontera";
		.mob_start_coords_x = 150;
		.mob_start_coords_y = 150;
		.mob_end_coords_x = 160;
		.mob_end_coords_y = 160;

		.no_spawn_start_hour = 16;
		.no_spawn_end_hour = 18;

		if(callsub("S_No_Respawn_Hour")) {
			.@curr_mob_amount = .mob_amount - $dead_mobs_amount;

			if(.@curr_mob_amount) {
				callsub("S_Spawn_Mobs", .@curr_mob_amount);
			}

			.no_respawn = 1;
			end;
		}

		$dead_mobs_amount = 0;
		callsub("S_Spawn_Mobs", .mob_amount);
	end;

	OnMobDead:
		if(.no_respawn) {
			$dead_mobs_amount++;
			end;
		}

		callsub("S_Spawn_Mobs", 1);
	end;

	OnHour00:
	OnHour01:
	OnHour02:
	OnHour03:
	OnHour04:
	OnHour05:
	OnHour06:
	OnHour07:
	OnHour08:
	OnHour09:
	OnHour10:
	OnHour11:
	OnHour12:
	OnHour13:
	OnHour14:
	OnHour15:
	OnHour16:
	OnHour17:
	OnHour18:
	OnHour19:
	OnHour20:
	OnHour21:
	OnHour22:
	OnHour23:
		if(callsub("S_No_Respawn_Hour")) {
			.no_respawn = 1;
			end;
		}

		.no_respawn = 0;
		if(!$dead_mobs_amount) end;

		callsub("S_Spawn_Mobs", $dead_mobs_amount);
		$dead_mobs_amount = 0;
	end;

	S_Spawn_Mobs:
		areamonster(.mob_map$, .mob_start_coords_x, .mob_start_coords_y, , .mob_end_coords_x, .mob_end_coords_y, "--ja--", .mob_id, getarg(0), "DYNAMIC_MOB_SPAWN::OnMobDead");
		return;

	S_No_Respawn_Hour:
		.@curr_hour = gettime(DT_HOUR);
		if(.@curr_hour >= .no_spawn_start_hour && .@curr_hour < .no_spawn_end_hour) {
			return 1;
		}

		return 0;
}

 

Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  12
  • Topics Per Day:  0.00
  • Content Count:  35
  • Reputation:   0
  • Joined:  06/12/16
  • Last Seen:  

1 hour ago, Winterfox said:

It is possible, but you have to write the respawn logic yourself. Here is an untested example:
 

-	script	DYNAMIC_MOB_SPAWN	-1,{
	OnInit:
		.mob_id = 1002;
		.mob_amount = 10;
		.mob_map$ = "prontera";
		.mob_start_coords_x = 150;
		.mob_start_coords_y = 150;
		.mob_end_coords_x = 160;
		.mob_end_coords_y = 160;

		.no_spawn_start_hour = 16;
		.no_spawn_end_hour = 18;

		if(callsub("S_No_Respawn_Hour")) {
			.@curr_mob_amount = .mob_amount - $dead_mobs_amount;

			if(.@curr_mob_amount) {
				callsub("S_Spawn_Mobs", .@curr_mob_amount);
			}

			.no_respawn = 1;
			end;
		}

		$dead_mobs_amount = 0;
		callsub("S_Spawn_Mobs", .mob_amount);
	end;

	OnMobDead:
		if(.no_respawn) {
			$dead_mobs_amount++;
			end;
		}

		callsub("S_Spawn_Mobs", 1);
	end;

	OnHour00:
	OnHour01:
	OnHour02:
	OnHour03:
	OnHour04:
	OnHour05:
	OnHour06:
	OnHour07:
	OnHour08:
	OnHour09:
	OnHour10:
	OnHour11:
	OnHour12:
	OnHour13:
	OnHour14:
	OnHour15:
	OnHour16:
	OnHour17:
	OnHour18:
	OnHour19:
	OnHour20:
	OnHour21:
	OnHour22:
	OnHour23:
		if(callsub("S_No_Respawn_Hour")) {
			.no_respawn = 1;
			end;
		}

		.no_respawn = 0;
		if(!$dead_mobs_amount) end;

		callsub("S_Spawn_Mobs", $dead_mobs_amount);
		$dead_mobs_amount = 0;
	end;

	S_Spawn_Mobs:
		areamonster(.mob_map$, .mob_start_coords_x, .mob_start_coords_y, , .mob_end_coords_x, .mob_end_coords_y, "--ja--", .mob_id, getarg(0), "DYNAMIC_MOB_SPAWN::OnMobDead");
		return;

	S_No_Respawn_Hour:
		.@curr_hour = gettime(DT_HOUR);
		if(.@curr_hour >= .no_spawn_start_hour && .@curr_hour < .no_spawn_end_hour) {
			return 1;
		}

		return 0;
}

 

thank you for this @Winterfox! will try and test this. gonna update this thread for the outcome.

 

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