ok i hope so thx anywayThey are set to always face south by default, and then once a player is on screen they will face towards their target.
To change this, requires source edits.
yo well its not the npc its the godamn monster looking to the walls like retarded monsters ^^If you are talking about NPC you don't need any source edit.
Reply if its NPC and ill post the script!
yo well its not the npc its the godamn monster looking to the walls like retarded monsters ^^
local monsters = {
{position = {x = 100, y = 100, z = 7}, dir = SOUTH},
{position = {x = 101, y = 100, z = 7}, dir = NORTH},
{position = {x = 102, y = 100, z = 7}, dir = WEST},
{position = {x = 103, y = 100, z = 7}, dir = EAST}
}
function onStartup()
for _, mob in ipairs(monsters) do
local tile = Tile(mob.position)
if tile then
local creature = tile:getTopCreature()
if creature then
creature:setDirection(mob.dir)
end
end
end
return true
end
local monsters = {
{position = {x = 100, y = 100, z = 7}, dir = SOUTH},
{position = {x = 101, y = 100, z = 7}, dir = NORTH},
{position = {x = 102, y = 100, z = 7}, dir = WEST},
{position = {x = 103, y = 100, z = 7}, dir = EAST}
}
function onStartup()
for _, mob in ipairs(monsters) do
local monster = getTopCreature(mob.position)
if monster.uid > 0 then
doCreatureSetLookDirection(monster.uid, mob.dir)
end
end
return true
end
i will try them thx alot, but one question where do i have to put like monster id or the name of the monster? or i do only need to put the pos of the area?You could change the direction of monsters on startup.
I assume you want to change the direction of the monsters in your "spawn room".
Here's how to do it with TFS 1.x:
Code:local monsters = { {position = {x = 100, y = 100, z = 7}, dir = SOUTH}, {position = {x = 101, y = 100, z = 7}, dir = NORTH}, {position = {x = 102, y = 100, z = 7}, dir = WEST}, {position = {x = 103, y = 100, z = 7}, dir = EAST} } function onStartup() for _, mob in ipairs(monsters) do local tile = Tile(mob.position) if tile then local creature = tile:getTopCreature() if creature then creature:setDirection(mob.dir) end end end return true end
I haven't used the older versions of TFS for a while, but you can try this for 0.3.x.
Code:local monsters = { {position = {x = 100, y = 100, z = 7}, dir = SOUTH}, {position = {x = 101, y = 100, z = 7}, dir = NORTH}, {position = {x = 102, y = 100, z = 7}, dir = WEST}, {position = {x = 103, y = 100, z = 7}, dir = EAST} } function onStartup() for _, mob in ipairs(monsters) do local monster = getTopCreature(mob.position) if monster.uid > 0 then setCreatureLookDir(monster.uid, mob.dir) end end return true end
where do i insert it, is it globalevent?If you have the monsters spawned in your map editor you just have to set the position and which direction it should look at.
i get errorsYes, in globalevents/scripts/name.lua.
<globalevent type="startup" name="Name" script="name.lua"/>
[06/02/2015 17:35:01] [Error - GlobalEvent Interface]
[06/02/2015 17:35:01] data/globalevents/scripts/name.lua:onStartup
[06/02/2015 17:35:01] Description:
[06/02/2015 17:35:01] data/globalevents/scripts/name.lua:8: attempt to call global 'Tile' (a nil value)
[06/02/2015 17:35:01] stack traceback:
[06/02/2015 17:35:01] data/globalevents/scripts/name.lua:8: in function <data/globalevents/scripts/name.lua:6>
tried both i get same errorUse the one for 0.3 (the second one).
[06/02/2015 17:43:39] [Error - GlobalEvent Interface]
[06/02/2015 17:43:39] data/globalevents/scripts/name.lua:onStartup
[06/02/2015 17:43:39] Description:
[06/02/2015 17:43:39] data/globalevents/scripts/name.lua:12: attempt to call global 'setCreatureLookDir' (a nil value)
[06/02/2015 17:43:39] stack traceback:
[06/02/2015 17:43:39] data/globalevents/scripts/name.lua:12: in function <data/globalevents/scripts/name.lua:8>
where do i put that in? login.lua?doCreatureSetLookDirection
You can find the TFS 0.3.6 functions in doc/LUA_FUNCTIONS and in luascript.cpp.
works perfeckt thx for your help repp <3Change setCreatureLookDir to doCreatureSetLookDirection.