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

selfGoToPosition, rem corpse

Dominik ms

Member
Joined
Jan 20, 2010
Messages
424
Reaction score
6
1.hello, is possible this script for monster and players?? Look like this:

PHP:
function onUse(cid, item, fromPosition, itemEx, toPos)
pos = {x=getCreaturePosition(cid).x +3, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}
selfGoToPosition(cid, pos)

2. How to remove corpse for my summons?? If my summon is dying then dont have corpse
 
maybe something like this:
Code:
for i = 1, #position do
	doMoveCreature(cid, getCreatureLookDirection(cid))
end
 
2. How to remove corpse for my summons?? If my summon is dying then dont have corpse
creaturescripts.xml
LUA:
<event type="preparedeath"  name="NoCorpse" event="script" value="nocorpse.lua"/>

nocorpse.lua
LUA:
function onPrepareDeath(cid, deathList)
    if isMonster(cid) and isPlayer(getCreatureMaster(cid)) then
        doSendMagicEffect(getCreaturePosition(cid), 37) 
        doRemoveCreature(cid)
    end
return true
end

wait,, i think the summoning needs a registerevent, since theyr'a lot there must be a fast way to do it
 
For the autowalk function its possible but the max distance would be 12sqm without hard editing to the a* path finding. You can find references in the lua npc autowalk function.
 
Cybershot
This work only if my summon was killed by player not other monster.
Creaturescript not work if killer is monster.

Syntax
12sqm is great for me!! But i dont know how To cut and use this code.
 
For the death thing use Cykos script and also go into sources (spells.cpp line 1332) or look for
bool InstantSpell::SummonMonster(const InstantSpell* spell, Creature* creature, const std::string& param)
And replace that whole function with this.

Code:
bool InstantSpell::SummonMonster(const InstantSpell* spell, Creature* creature, const std::string& param)
{
	Player* player = creature->getPlayer();
	if(!player)
		return false;

	MonsterType* mType = g_monsters.getMonsterType(param);
	if(!mType)
	{
		player->sendCancelMessage(RET_NOTPOSSIBLE);
		g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
		return false;
	}

	int32_t manaCost = (int32_t)(mType->manaCost * g_config.getDouble(ConfigManager::RATE_MONSTER_MANA));
	if(!player->hasFlag(PlayerFlag_CanSummonAll))
	{
		if(player->getSkull() == SKULL_BLACK)
		{
			player->sendCancelMessage(RET_NOTPOSSIBLE);
			g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
			return false;
		}

		if(!mType->isSummonable)
		{
			player->sendCancelMessage(RET_NOTPOSSIBLE);
			g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
			return false;
		}

		if(player->getMana() < manaCost)
		{
			player->sendCancelMessage(RET_NOTENOUGHMANA);
			g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
			return false;
		}

		if((int32_t)player->getSummonCount() >= g_config.getNumber(ConfigManager::MAX_PLAYER_SUMMONS))
		{
			player->sendCancel("You cannot summon more creatures.");
			g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
			return false;
		}
	}

	ReturnValue ret = g_game.placeSummon(creature, param);
	if(ret == RET_NOERROR)
	{
		spell->postSpell(player, (uint32_t)manaCost, (uint32_t)spell->getSoulCost());
		g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_WRAPS_BLUE);
		creature->registerCreatureEvent("NoCorpse");
		return true;
	}

	player->sendCancelMessage(ret);
	g_game.addMagicEffect(player->getPosition(), MAGIC_EFFECT_POFF);
	return false;
}

Tell me if that compiles
 
Last edited:
walk function its possible even from Lua, i ve made it in Lua for poke move function in PA.

small showoff :x

Code:
                    if (walkEvents[pid] == WALKING) then
                        return true
                    end

                    walkEvents[pid] = WALKING
                    doWalk(pid, toPosition, nil, 500, false)
 
Nahruto
PHP:
[17/06/2010 20:44:27] Description: 
[17/06/2010 20:44:27] data/actions/scripts/test.lua:5: attempt to index global 'walkEvents' (a nil value)
[17/06/2010 20:44:27] stack traceback:
[17/06/2010 20:44:27] 	data/actions/scripts/test.lua:5: in function <data/actions/scripts/test.lua:1>


Syntax
PHP:
  In static member function `static bool InstantSpell::SummonMonster(const InstantSpell*, Creature*, const std::string&)': 
1376 \source\0.3.6pl1\spells.cpp 'const class InstantSpell' has no member named 'postSpell' 
1379 \source\0.3.6pl1\spells.cpp expected `;' before "return" 
source\0.3.6pl1 \dev-cpp\Makefile.win [Build Error]  [obj-console//spells.o] Error 1
 
Last edited:
walk function its possible even from Lua, i ve made it in Lua for poke move function in PA.

small showoff :x

Code:
                    if (walkEvents[pid] == WALKING) then
                        return true
                    end

                    walkEvents[pid] = WALKING
                    doWalk(pid, toPosition, nil, 500, false)

That gives me an idea of how you made the fly system ^_^.
 
Back
Top