forgottenserver icon indicating copy to clipboard operation
forgottenserver copied to clipboard

fluidcontainer/trashholding mechanic

Open emil92b opened this issue 3 years ago • 1 comments

Desired functionality

  1. create a vial filled with any fluid type, example /i vial, 2
  2. use the vial with lava target tile

what should happen is the vial should empty and effect should be displayed on target tile, in this case "fire"

so need a way to check for trashholder type and effect

<item fromid="598" toid="601" name="lava"> <attribute key="type" value="trashholder"/> <attribute key="effect" value="fire"/> <attribute key="allowpickupable" value="1"/> </item>

https://github.com/otland/forgottenserver/blob/master/data/actions/scripts/other/fluids.lua

emil92b avatar Feb 18 '22 21:02 emil92b

leaving this code here for later, cba do a pr atm

first need to check if itemType is trahsholder and that it has effect (todo)

here is how to get the effect and empty the vial toPosition:sendMagicEffect(targetItemType:getMagicEffect()) item:transform(item.itemid, FLUID_NONE)

luascript.cpp registerMethod("ItemType", "getMagicEffect", LuaScriptInterface::luaItemTypeGetMagicEffect);

int LuaScriptInterface::luaItemTypeGetMagicEffect(lua_State* L) { // itemType:getMagicEffect() const ItemType* itemType = getUserdata<const ItemType>(L, 1); if (itemType) { lua_pushnumber(L, itemType->magicEffect); } else { lua_pushnil(L); } return 1; }

luascript.h static int luaItemTypeGetMagicEffect(lua_State* L);

emil92b avatar Jun 26 '22 06:06 emil92b