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

[Movement Scripts]

Trixon

New Member
Joined
Nov 9, 2008
Messages
39
Reaction score
0
Hi, I'm using TFS 0.3 Beta 1 and it seams when ever I make a custom movement script it doesn't work. However I get no errors in the console and when I post the code here on forums people will give me better code or even say the code is fine and it should work. Is there some kind of bug that could be preventing my codes from working without showing any errors?

Here's an example of something I have;
poi_druid_fire.lua
PHP:
local config = {
       local vocs = {2, 6, 10},
       local words = "Sweet I aint dead!",
       local health = 10000,
       local mana = 10000,
       local uid = 3505
}

function onStepIn(cid, item, position, fromPosition)
	if item.uid == config.uid then 
            if isInArray(config.vocs, getPlayerVocation(cid)) == TRUE then
		doCreatureSay(cid, config.words, TALKTYPE_YELL)
     	    else
		doPlayerAddHealth(cid, -config.health)
		doPlayerAddMana(cid, -config.mana)
            end
        end
end

Movements.xml;
Code:
	<movement event="StepIn" itemid="1506" uniqueid="3506" script="poi_druid_fire.lua"/>
 
I posted in your other topic, although I just noticed that in your movements.xml it says '<movement' it is supposed to say '<movevent'.
 
man i'm so dumb =/ one day maybe i'll get used to all this stuff lol
thanks for your help i'm gonna go test it all out now
 
I got another movement script giving me trouble...

PHP:
local text = "You have not discovered my secret yet! Keep looking!"
local text2 = "Prepare to die!"
local place = {x=33150, y=32847, z=5} --Where they will be teleported to if they have quest
local place2 = {x=33145, y=32870, z=7} --Where they will be teleported to if they dont have quest
function onStepIn(cid, item, position, fromPosition)
 
questStatus = getPlayerStorageValue(cid, 6502)
 
	if item.uid == 6561 and questStatus = 1 then
		doTeleportThing(cid, place)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text2)
	else
		doTeleportThing(cid, place2)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
	end
end

Error;
Code:
[09/12/2008 13:35:37] Warning: [Event::loadScript] Can not load script. data/movements/scripts/soulruby tp.lua
[09/12/2008 13:35:37] data/movements/scripts/soulruby tp.lua:9: 'then' expected near '='
 
I got another movement script giving me trouble...

PHP:
local text = "You have not discovered my secret yet! Keep looking!"
local text2 = "Prepare to die!"
local place = {x=33150, y=32847, z=5} --Where they will be teleported to if they have quest
local place2 = {x=33145, y=32870, z=7} --Where they will be teleported to if they dont have quest
function onStepIn(cid, item, position, fromPosition)
 
questStatus = getPlayerStorageValue(cid, 6502)
 
	if item.uid == 6561 and questStatus = 1 then
		doTeleportThing(cid, place)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text2)
	else
		doTeleportThing(cid, place2)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
	end
end

Error;
Code:
[09/12/2008 13:35:37] Warning: [Event::loadScript] Can not load script. data/movements/scripts/soulruby tp.lua
[09/12/2008 13:35:37] data/movements/scripts/soulruby tp.lua:9: 'then' expected near '='

you forgot another "=" at questStatus "==" 1

here is the fix

Code:
local text = "You have not discovered my secret yet! Keep looking!"
local text2 = "Prepare to die!"
local place = {x=33150, y=32847, z=5} --Where they will be teleported to if they have quest
local place2 = {x=33145, y=32870, z=7} --Where they will be teleported to if they dont have quest
function onStepIn(cid, item, position, fromPosition)
 
questStatus = getPlayerStorageValue(cid, 6502)
 
    if item.uid == 6561 and questStatus == 1 then
        doTeleportThing(cid, place,TRUE)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text2)
    else
        doTeleportThing(cid, place2,TRUE)
        doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
    end
end
 
1 Last problem I'm having and then I'll let you all get back to your day lol. As you can tell I'm trying to script poi quest, I have 1 movement script for every seal throne. when you step on the throne it should make a player storage value = 1, then i got code for the tp north of the room, that should check all 7 storage values and if they all = 1 then it will tp you to the next room. It doesn't seam to work, but when i step on the thrones it tells me the right text so I don't know where the error is.

Example Throne Code;
PHP:
local text = "You absorbed some of Pumin's Power"
local place = {x=32785, y=32275, z=15} --Where they will be teleported to if they have quest

function onStepIn(cid, item, position, fromPosition)
	if isPlayer(cid) == 1 then
		questStatus = getPlayerStorageValue(cid, 6514)
 

		if item.uid == 3544 then
			questStatus = 1
			setPlayerStorageValue(cid, 6514, 1)			
			doTeleportThing(cid, place)
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
		end
	end
end

Then this is the tp code;
PHP:
local text = "You have not yet stepped on all the thrones."
local text2 = "Collect your rewards."
local place = {x=32826, y=32252, z=10} --Where they will be teleported to if they have quest
local place2 = {x=32824, y=32242, z=12} --Where they will be teleported to if they dont have quest
function onStepIn(cid, item, position, fromPosition)
 
hellhound = getPlayerStorageValue(cid, 3540)
juggernaut = getPlayerStorageValue(cid, 3541)
undead = getPlayerStorageValue(cid, 3542)
plaguesmith = getPlayerStorageValue(cid, 3543)
hand = getPlayerStorageValue(cid, 3544)
dark = getPlayerStorageValue(cid, 3545)
phantasm = getPlayerStorageValue(cid, 3546)
 
	if item.uid == 3547 and  hellhound == 1 and  juggernaut == 1 and  undead == 1 and  plaguesmith == 1 and  hand == 1 and  dark == 1 and  phantasm == 1 then
		doTeleportThing(cid, place)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text2)
	else
		doTeleportThing(cid, place2)
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, text)
	end
end
 
Back
Top