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

Box + water = floating box [Lua or C++]

andu

Sold 649 scripts, 25 maps and 9 events!
Joined
Aug 7, 2009
Messages
969
Solutions
17
Reaction score
354
GitHub
olrios
Twitch
olrios
Now it works like that:
if you move NORMAL_BOX into water then it disappears (it drowns).

But I want to make it work like that:
If you move NORMAL_BOX into water then it transforms to FLOATING_BOX. And viceversa, if you move FLOATING_BOX from water to beach or any walking ground then it transforms to NORMAL_BOX.

How to make it?

1576509715786.png
 
Last edited:
maybe I'm wrong but isn't water just a movement script?
I was looking here. No successs.
Seems water is in items.xml with:
Code:
attribute key="type" value="trashholder"
Same with all grounds like lava, swamp etc. Looks like there's function in sources what controls it.
If you have an idea how to do it in lua only give me a tip.
 
data/events/scripts/player.lua
local grounds = {} -- water
local newItem = {
-- [boxId] = inWaterId,
}
Player:OnMoveItem

if toPosition.x ~= CONTAINER_POSITION then
if isInArray(grounds, Tile(toPosition):getGround():getId()) then
-- item:transformTo(newItem[item:getId()])
end
end

since box in water isn't a container, you're likely to lose its contents when using transformTo (unless you use some xml/otb hack to prevent it)
 
Back
Top