• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua [HELP]doSteerCreature

Exedion

Active Member
Joined
Jun 11, 2007
Messages
629
Reaction score
30
it good for and how I can use the doSteerCreature?
I have understood that is used to make walking a creature to a particular location
 
I think it shoulddo a auto walk ye.
Code:
bool Game::steerCreature(Creature* creature, const Position& position, uint16_t maxNodes/* = 1000*/)
{
	FindPathParams fpp;
	fpp.maxClosedNodes = maxNodes;

	fpp.fullPathSearch = true;
	fpp.maxSearchDist = -1;
	fpp.minTargetDist = 0;
	fpp.maxTargetDist = 1;

	std::list<Direction> dirList;
	if(!getPathToEx(creature, position, dirList, fpp))
		return false;

	creature->startAutoWalk(dirList);
	return true;
}

Example(I think not tested)
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local position = {x= toPosition.x, y = toPosition.y+4,z=toPosition.z}
	
	if not doSteerCreature(cid,position) then
		return doPlayerSendCancel(cid,getCreatureName(monsters).." can't go there.")
	end
		
	
	return true
end
 
Last edited:
Yeah you right. :thumbup:

It working exacly the same as you click on position and player is going to set position.


Thanks.
 
I think it shoulddo a auto walk ye.
Code:
bool Game::steerCreature(Creature* creature, const Position& position, uint16_t maxNodes/* = 1000*/)
{
	FindPathParams fpp;
	fpp.maxClosedNodes = maxNodes;

	fpp.fullPathSearch = true;
	fpp.maxSearchDist = -1;
	fpp.minTargetDist = 0;
	fpp.maxTargetDist = 1;

	std::list<Direction> dirList;
	if(!getPathToEx(creature, position, dirList, fpp))
		return false;

	creature->startAutoWalk(dirList);
	return true;
}

Example(I think not tested)
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local position = {x= toPosition.x, y = toPosition.y+4,z=toPosition.z}
	
	if not doSteerCreature(cid,position) then
		return doPlayerSendCancel(cid,getCreatureName(monsters).." can't go there.")
	end
		
	
	return true
end

thanks men! one more question... this work with summons?
 

Similar threads

Back
Top