• 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!

[HELP] Summon Creature Distance

mujica

New Member
Joined
Feb 3, 2010
Messages
203
Reaction score
3
Okay I would like to be able to make a creature stand on the same tile as the summoner and if the creature is not on the same tile it gets teleported back onto him. I saw in config "teleportPlayerSummons = true" but i want the range to be like 1sqm or 0sqm so its always on the persons. I know this is possible i just do not have the knowledge to do so. In addition is there a way i can make it so a Players Summon does no harm the summoner? but hurts other players if attacked.

Thanks, Mujica

- - - Updated - - -

Like something along the lines of
IfSummon more than 1SQM Teleport to the player
 
Last edited:
Lua:
function onThink(cid, interval)
	if isCreature(cid) then
		local summons = getCreatureSummons(cid)
		if(summons) then
			for i = 1, #summons do
				if (getDistanceBetween(getCreaturePosition(cid), getCreaturePosition(summons[i])) >= 1) then
					doTeleportThing(summons[i], getCreaturePosition(cid))
					doSendMagicEffect(getCreaturePosition(cid), CONST_ME_TELEPORT)
				end
			end
		end
	end
	return true
end

Don't quite understand the second thing you asked for
 
Im unsure where to put this i tried it as global event and as lib/function. Can you give me some guidance please?
 
Last edited:
it's a creature script, put it in creature scripts, register it as 'think' and make sure you register it on player login (login.lua)
 
Back
Top