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

Solved Problem with movements scripts [TFS 1.0 10.41]

xardas33

New Member
Joined
Jan 28, 2010
Messages
83
Reaction score
0
Hello guys. I have problem with my scripts...
Look at them first:
Movements.xml
Code:
<!-- Tiles with Req -->
   <movement type="StepIn" actionid="61000" script="tiles/PremiumBridge.lua"/>
   <movement type="StepIn" actionid="61001" script="tiles/EntranceBridges.lua"/>

tiles/PremiumBridge.lua
Code:
function onStepIn(cid, item, position, fromPosition)

   if item.actionid == 61000 then
     if isPlayer(cid) then
       if isPremium(cid) == true then
         doTeleportThing(cid, fromPosition)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need premium account to pass this bridge.")
       end
     end
   end
return true
end

tiles/EntranceBridges.lua
Code:
function onStepIn(cid, item, position, fromPosition)

   if item.actionid == 61001 then
     if isPlayer(cid) then
       if getPlayerLevel(cid) < 4 then
         doTeleportThing(cid, fromPosition)
         doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need 4 level to pass this bridge.")
       end
     end
   end
return true
end

So, the problem is when I step on scripted tile, it's pushing me back and send text "The tile seems to be protected against unwanted intruders."
How to fix that?

On TFS 0.3.6 V8.2 all scripts worked good.
 
Last edited:
Change:
<movement type="StepIn" actionid="61000" script="tiles/PremiumBridge.lua"/>
<movement type="StepIn" actionid="61001" script="tiles/EntranceBridges.lua"/>

For:
<movevent event="StepIn" actionid="61000" script="tiles/PremiumBridge.lua"/>
<movevent event="StepIn" actionid="61001" script="tiles/EntranceBridges.lua"/>

Also the Premium bridge script is not working as you want. You want to allow players with premium account pass, so this line should be:
"if isPremium(cid) == false then"
 
You need also convert them to metatables, we have dropped the support for compat.lua

If you are using the ORTS datapack, also it always good to convert your old scripts to meta:


Code:
function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
    if not player then
        return false
    end

    if player:getPremiumDays() == 0 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'You need premium account to pass this bridge.')
        player:teleportTo(fromPosition, true)
        return false
    end
    return true   
end

Code:
function onStepIn(cid, item, position, fromPosition)
    local player = Player(cid)
    if not player then
        return false
    end

    if player:getLevel() < 4 then
        player:sendTextMessage(MESSAGE_INFO_DESCR, 'You need atleast level 4 to pass this bridge.')
        player:teleportTo(fromPosition, true)
        return false
    end
    return true
end
 
There are tiles which are already registered to tiles.lua, which might be executed instead of your script therefore.

Code:
<movevent event="StepIn" itemid="416" script="tiles.lua"/>
<movevent event="StepOut" itemid="417" script="tiles.lua"/>
<movevent event="StepIn" itemid="426" script="tiles.lua"/>
<movevent event="StepOut" itemid="425" script="tiles.lua"/>
<movevent event="StepIn" itemid="446" script="tiles.lua"/>
<movevent event="StepOut" itemid="447" script="tiles.lua"/>
<movevent event="StepIn" itemid="3216" script="tiles.lua"/>
<movevent event="StepOut" itemid="3217" script="tiles.lua"/>
<movevent event="StepIn" itemid="11062" script="tiles.lua"/>
<movevent event="StepOut" itemid="11063" script="tiles.lua"/>
 
Thank you all, i changed all, converted scripts and it doesn't work.... I tried to remove:
Code:
<movevent event="StepIn" itemid="446" script="tiles.lua"/>
<movevent event="StepOut" itemid="447" script="tiles.lua"/>
But it still doesn't work ;/ Same error..
I don't use ORTS.
 
Last edited:
Back
Top