Hi,tfs 1.2 so i need script if player is on specific tile you cant push him if hes on that tile (it would be good if you could go trough him too if its possible)
data/events/scripts/player.lua
look for Player:onMoveCreature
function and above the last return true
in the function scope put:local blockedIds = {106, 405} --106 = grass id, 405 = wooden floor id
if table.contains(blockedIds, fromPosition:getTile():getId()) then
return false
end
function Player:onMoveCreature(creature, fromPosition, toPosition)
local blockedIds = {106, 405} --106 = grass id, 405 = wooden floor id
if table.contains(blockedIds...
Hi,tfs 1.2 so i need script if player is on specific tile you cant push him if hes on that tile (it would be good if you could go trough him too if its possible)
data/events/scripts/player.lua
look for Player:onMoveCreature
function and above the last return true
in the function scope put:local blockedIds = {106, 405} --106 = grass id, 405 = wooden floor id
if table.contains(blockedIds, fromPosition:getTile():getId()) then
return false
end
function Player:onMoveCreature(creature, fromPosition, toPosition)
local blockedIds = {106, 405} --106 = grass id, 405 = wooden floor id
if table.contains(blockedIds, fromPosition:getTile():getId()) then
return false
end
return true
end
data/events/events.xml
and look for <event class="Player" method="onMoveCreature" enabled="1"/>
and be sure that enabled
value is 1
.Will test itHi,
This code will block Player be pushed when above the tile ID 106 and 405.
Indata/events/scripts/player.lua
look forPlayer:onMoveCreature
function and above the lastreturn true
in the function scope put:
LUA:local blockedIds = {106, 405} --106 = grass id, 405 = wooden floor id if table.contains(blockedIds, fromPosition:getTile():getId()) then return false end
Now go toLUA:function Player:onMoveCreature(creature, fromPosition, toPosition) local blockedIds = {106, 405} --106 = grass id, 405 = wooden floor id if table.contains(blockedIds, fromPosition:getTile():getId()) then return false end return true end
data/events/events.xml
and look for<event class="Player" method="onMoveCreature" enabled="1"/>
and be sure thatenabled
value is1
.
bumperror
![]()
Gyazo
gyazo.com