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

Need help with script.

Tempesto

Member
Joined
Feb 12, 2018
Messages
79
Reaction score
6
Location
Ruining your servers.
Okay, thank you. Sorry about the posting issue. This doesn't give me an error, but in-game, I still can't get it to work. I think it should be working. I had another script I inputted correctly too and that script doesn't work either and there's no error because its done properly. Can someone tell me why any new lua scripts I add to my server don't work? What kind of bug is it and how do I fix it? It's like my server isn't receiving any new items in its folders properly.

Lua:
function onUse(player, item) if
            item.itemid == 1442 then
           return true
           end
doCreateMonster('Demon',{x=462,y=191,z=7})
end


I have this in actions.xml:
XML:
<action itemid="1442" script="other/soldier.lua" />

I have an actionid 1442 for the statue on the map as well. Because I'm not certain what to do.
 
Last edited:
Solution
You just want to create a Demon in that position {x=462,y=191,z=7}?
try this, create a new file called statue.lua inside action scripts
Lua:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
   local pos = Position(462, 191, 7)
   local monster = Game.createMonster("Demon", pos)
   if monster then
       pos:sendMagicEffect(CONST_ME_POFF)
       player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A Demon has been summoned, run.")
       player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
   end
   return true
end

and add this to actions.xml
Code:
<action actionid="1442" script="statue.lua" />
You just want to create a Demon in that position {x=462,y=191,z=7}?
try this, create a new file called statue.lua inside action scripts
Lua:
function onUse(player, item, fromPosition, itemEx, toPosition, isHotkey)
   local pos = Position(462, 191, 7)
   local monster = Game.createMonster("Demon", pos)
   if monster then
       pos:sendMagicEffect(CONST_ME_POFF)
       player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "A Demon has been summoned, run.")
       player:getPosition():sendMagicEffect(CONST_ME_TELEPORT)
   end
   return true
end

and add this to actions.xml
Code:
<action actionid="1442" script="statue.lua" />
 
Solution
Thanks mate! Truly appreciated. That worked! :p. Do you know any guides you could share with me so I can learn to script that way? I seem to be trying some outdated way of lua scripting.
I guess you are looking for this
otland/forgottenserver
as example I used two metatables called Position and Player
Have a nice reading.
 
Back
Top