• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

How to make pharaohs respawn?

LilJeezy030

New Member
Joined
Nov 23, 2008
Messages
144
Reaction score
4
Location
The Netherlands
Dear otlanders,

Got a question.. When i try to hunt pharaohs they dont respawn in when iam in the room.

How do i make that they respawn in the room with a player in it? Would be awsome!
 
Source edit

or globalevent:
Check if pharao exists in map (getCreatureByName("Pharao")) and then if it doesnt exist spawn it in pos, if it exist do nothing..
 
you can edit this part of spawn.cpp
[cpp]bool Spawn::findPlayer(const Position& pos)
{
SpectatorVec list;
g_game.getSpectators(list, pos);

Player* tmpPlayer = NULL;
for(SpectatorVec::iterator it = list.begin(); it != list.end(); ++it)
{
if((tmpPlayer = (*it)->getPlayer()) && !tmpPlayer->hasFlag(PlayerFlag_IgnoredByMonsters))
return true;
}

return false;
}[/cpp]
decide if you want to skip player check for pharaohs, or make it check smaller area
 
Or if you want to do it the messy way without editing sources:

Recommended to put globalevent interval to 5 - 15 minutes~
LUA:
-- r1 = Simple spawn if not exist engine. [Znote]

------- CONFIG -------
local monsterName = "Pharao" -- "Monstername"
local MonsterPos = {1000,1000,7} -- {x,y,z} position where it shall spawn
--- Change in globalevents.xml on how often script shall check and spawn monster. if it dosnt exist.
------- /CONFIG ------

function onThink()
	if getCreatureByName(monsterName) == false then
		doCreateMonster(monsterName, MonsterPos)
	end
	return true
end

You should remove the creature from the map before using this script. And write correct x,y,z pos.

rev2: Comes with accurate spawn timer.
Recommended to put global event interval to 10-120 seconds~
LUA:
-- r1 = Simple spawn if not exist engine. [Znote]
-- r2 = accurate spawn timer. Make sure to have lower global interval. [Znote]

------- CONFIG -------
local monsterName = "Pharao" -- "Monstername"
local MonsterPos = {1000,1000,7} -- {x,y,z} position where it shall spawn
local spawnMin = 10 -- 10 min cooldown between monster spawn
local storage = 1000 -- Storage to fix cooldown/spawntime (globalstorage)
--- Change in globalevents.xml on how often script shall check and spawn monster. if it dosnt exist.
------- /CONFIG ------

function onThink()
	if getCreatureByName(monsterName) == false then
		local calculation = spawnMin * 60
		if os.time() >= (getStorage(storage)+calculation) then
			if (getStorage(storage) == 0 then
				return true
			else
				doCreateMonster(monsterName, MonsterPos)
				doSetStorage(storage,os.time())
			end
		else
			if getStorage(storage) > 0 then
				local nextspawn = ((getStorage(storage)+calculation) - os.time())
				addEvent(mspawn,(1000*nextspawn))
				doSetStorage(storage,0)
			end
		end
	end
	return true
end

function mspawn()
	if getStorage(storage) == 0 then
		doCreateMonster(monsterName, MonsterPos)
		doSetStorage(storage,os.time())
	end
	return true
end

If this dont work just use r1. (first script version).
 
Last edited:
Back
Top