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

Having touble with summons teleporting

Omen

New Member
Joined
Sep 11, 2008
Messages
70
Reaction score
0
Ive been using the config.lua method of summoning pets to thier owner
Summons
maxPlayerSummons = 1
teleportAllSummons = "yes"
teleportPlayerSummons = "yes"

However this doesnt work when entering teleports or going up and down stairs.

Someone wrote me this script and it did not work at all.

Code:
function onThink(interval, lastExecution)
	for _, cid in ipairs(getPlayersOnline()) do
		for _, pid in ipairs(getCreatureSummons(cid)) do
			local summonPos, playerPos = getThingPos(pid), getThingPos(cid)
			local thisPlayer, thisSummon = {x = summonPos.x + 5, y = summonsPos.y, z = summonPos.z}, {x = playerPos.x - 5, y = playerPos.y, z = playerPos.z}
			if getDistanceBetween(thisPlayer, thisSummon) >= 5 then
				doTeleportThing(pid, playerPos, true)
			end
		end
	end
	return true
end

is there any other method to permanently lock a summon to its owner while going up and down stairs and through teleports?

I understand the difficulty of this request, and I hope someone is out there who can handle it.
 
Data/lib/pet.lua
Lua:
function summonPet(cid, pos)
local petuid = getPlayerPet(cid)
if isCreature(petuid) then
return false
end
if getTilePzInfo(getCreaturePosition(cid)) or getTilePzInfo(pos) or doTileQueryAdd(cid, pos) ~= 1 then
return false
end
local pet = doSummonCreature(PETS.PREFIX..PETS.IDENTIFICATION[getPlayerPetType(cid)].name, pos)
if isCreature(pet) then 
     end
 
Check it out, i think ur problem is where is says "yes" in your config.lua, you should put "true" give that a shot, restart and see where it takes you.

If I'm wrong I'll eat my hat.
 
prepare to eat said hat.

It teleports the summons just fine, provided you move at the speed of a level 8 on mud and dont go farther than 10 squares before it does teleport to you, this doesnt include going up stairs, the summon absolutely refuses to climb a damn set of stairs, ramp, ladder, rope - not only that, but as soon asyou go through the shiny blue portal the summon turns tail and dissa-freakin-pears.
 
Code:
function onThink(interval, lastExecution)
	for _, cid in ipairs(getPlayersOnline()) do
		local pos = getThingPos(cid)
		for _, sid in ipairs(getCreatureSummons(cid)) do
			if getDistanceBetween(pos, getThingPos(sid)) >= 5 then
				doTeleportThing(sid, getClosestFreeTile(cid, pos, true))
			end
		end
	end
	return true
end
However, the summons will still despawn if the teleporter leads to a distant location. You can fix that by removing this part from creature.cpp in the source code:
Code:
		if(!summons.empty())
		{
			std::list<Creature*>::iterator cit;
			std::list<Creature*> despawnList;
			for(cit = summons.begin(); cit != summons.end(); ++cit)
			{
				const Position pos = (*cit)->getPosition();
				if((std::abs(pos.z - newPos.z) > 2) || (std::max(std::abs((
					newPos.x) - pos.x), std::abs((newPos.y - 1) - pos.y)) > 30))
					despawnList.push_back((*cit));
			}

			for(cit = despawnList.begin(); cit != despawnList.end(); ++cit)
				g_game.removeCreature((*cit), true);
		}
 
What if I make it so that if the distance is greater than the distance it takes to delete the summon it just summons another summon?
 
If you are trying to get around a source edit you will have to get a bit creative with this idea. My suggestion (first thought on how to get creative with this) would be to make the summon spell set a storage value. When the summon dies it will remove that storage value from its master. If the summon is removed in any other way the storage value will still be "1" on the master therefore an onThink script could then re-summon the pet for you. Now put that together with cykotitans script and you have somewhat of the same result without the source edit however as cyko stated, it would be easier for you to just go ahead with the source edit.
 
I really dont want to source edit.

Have to change stuff every time a new revision comes around.. na.. id rather get complicated :p
 
Im gonna use this script and change my pet system so that when the player uses the command it sets a global and while that global is true it will summon the pet until the total summon count is 1 :p
 
PHP:
function onThink(interval, lastExecution)
	for i, v in ipairs(getPlayersOnline()) do
local summon1 = getPlayerPet(v)
	if isCreature(summon1) == true then
return true
end
	if isCreature(summon1) == true then
	if getDistanceBetween(getCreaturePosition(summon1), getCreaturePosition(v)) >= 7 then
			doTeleportThing(summon1, getCreaturePosition(v))
end
end
end
return true
end
 
Back
Top