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

Helmet of the deep, update 8.6 (Solved)

LucasFerraz

Systems Analyst
Joined
Jun 10, 2010
Messages
2,858
Reaction score
96
Location
Brazil
I have this script of Helmet of the deep.
Now only when you eat Coconut Shrimp Bake you have +300 speed for 6 hours.
Can someone show me how?

XML:
	<movevent type="StepIn" itemid="5405" event="script" value="water.lua" />
	<movevent type="StepIn" itemid="5406" event="script" value="water.lua" />
	<movevent type="StepIn" itemid="5407" event="script" value="water.lua" />
	<movevent type="StepIn" itemid="5408" event="script" value="water.lua" />
	<movevent type="StepIn" itemid="5409" event="script" value="water.lua" />
	<movevent type="StepIn" itemid="5410" event="script" value="water.lua" />
Lua:
local condition = createConditionObject(CONDITION_DROWN)
setConditionParam(condition, CONDITION_PARAM_PERIODICDAMAGE, -50)
setConditionParam(condition, CONDITION_PARAM_TICKS, -3)
setConditionParam(condition, CONDITION_PARAM_TICKINTERVAL, 2000)

function onStepIn(cid, item, pos)
	if isPlayer(cid) == TRUE then
		doAddCondition(cid, condition)
	end
end

function onStepOut(cid, item, pos)
	doRemoveCondition(cid, CONDITION_DROWN)
end
 
What happens to the helmet if you walk out of the water, the speed bonus should go away!?
What happens if you take off the helmet, and give it to someone else?

Is the bonus only for the player who has eaten the dish or it's bound to the helmet, since Cip added a new ID for it, 12541?
 
Yes, it's complicated now. How to make this script?
Maybe if player eat Coconut Shrimp Bake he receive storate and helmet will work only if have storage?
storage ends in 6 hours??
It's very hard, is possible to make it like real tibia?
 
You basically have to eat the coconut shrimp bake to use the helmet, it will give you a storage.

Code:
onEquip -> HAS Storage -> Transforms to NEW ID & works.
onEquip -> NO Storage -> Doesn't transform & doesn't work.
onDeEquip -> Transforms Back to Old ID

PS: Storage only lasts 6 hours? ^_^

Not hard to make, if Cykotitan doesn't help, I will.
 
You basically have to eat the coconut shrimp bake to use the helmet, it will give you a storage.

Code:
onEquip -> HAS Storage -> Transforms to NEW ID & works.
onEquip -> NO Storage -> Doesn't transform & doesn't work.
onDeEquip -> Transforms Back to Old ID

PS: Storage only lasts 6 hours? ^_^

Not hard to make, if Cykotitan doesn't help, I will.
The problem is adding the speed, supressDrown and absorbPercentDrown to the player but hopefully 0.4's callFunction will do the job.
 
items.xml
XML:
-
	<item id="5461" article="a" name="helmet of the deep">
		<attribute key="weight" value="21000"/>
		<attribute key="armor" value="2"/>
		<attribute key="slotType" value="head"/>
		<attribute key="suppressDrown" value="1"/>
		<attribute key="absorbPercentDrown" value="100"/>
		<attribute key="stopduration" value="1"/>
	</item>
XML:
-
	<item id="12540" article="a" name="coconut shrimp bake">
		<attribute key="description" value="It looks as if it was sealed with milky goodness."/>
		<attribute key="weight" value="2000"/>
	</item>
	<item id="12541" article="a" name="helmet of the deep">
		<attribute key="weight" value="21000"/>
		<attribute key="armor" value="2"/>
		<attribute key="slotType" value="head"/>
		<attribute key="suppressDrown" value="1"/>
		<attribute key="speed" value="600"/>
		<attribute key="absorbPercentDrown" value="100"/>
		<attribute key="decayTo" value="5461"/>
		<attribute key="duration" value="21600"/>
		<attribute key="showduration" value="1"/>
		<attribute key="transformDeEquipTo" value="5461"/>
	</item>
actions.xml
XML:
<action itemid="12540" event="script" value="csb.lua"/>
csb.lua
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if os.time() < getCreatureStorage(cid, 25) then
		return doCreatureSay(cid, 'You are already under the effect of this dish.', TALKTYPE_ORANGE_1, false, cid)
	end

	local v = getPlayerSlotItem(cid, CONST_SLOT_HEAD)
	if v.itemid == 5461 then
		local p = getThingPos(cid)
		p.stackpos = 0
		p = getThingfromPos(p).itemid
		if isInArray({5405, 5406, 5407, 5408, 5409, 5410, 5743, 5744, 5764, 9671, 9672, 9673}, p) then
			doCreatureSetStorage(cid, 25, os.time() + 120)
			doTransformItem(v.uid, 12541)
			doCreatureSay(cid, 'Yum.', TALKTYPE_ORANGE_1, false, cid)
			doRemoveItem(item.uid)
			return true
		end
	end

	return doCreatureSay(cid, 'You should only eat this dish when wearing a helmet of the deep and walking underwater.', TALKTYPE_ORANGE_1, false, cid)
end
movements.xml
XML:
-
	<movevent type="Equip" itemid="5461" slot="head" event="script" value="drowning.lua"/>
	<movevent type="DeEquip" itemid="5461" slot="head" event="function" value="onDeEquipItem"/>
	<movevent type="Equip" itemid="12541" slot="head" event="script" value="drowning.lua"/>
	<movevent type="DeEquip" itemid="12541" slot="head" event="function" value="onDeEquipItem"/>

	<movevent type="StepIn" fromid="5405" toid="5410" event="script" value="drowning.lua"/>
	<movevent type="StepOut" fromid="5405" toid="5410" event="script" value="drowning.lua"/>
	<movevent type="StepIn" fromid="5743" toid="5744" event="script" value="drowning.lua"/>
	<movevent type="StepOut" fromid="5743" toid="5744" event="script" value="drowning.lua"/>
	<movevent type="StepIn" itemid="5764" event="script" value="drowning.lua"/>
	<movevent type="StepOut" itemid="5764" event="script" value="drowning.lua"/>
	<movevent type="StepIn" fromid="9671" toid="9673" event="script" value="drowning.lua"/>
	<movevent type="StepOut" fromid="9671" toid="9673" event="script" value="drowning.lua"/>
drowning.lua:
Lua:
local condition = createConditionObject(CONDITION_DROWN)
setConditionParam(condition, CONDITION_PARAM_PERIODICDAMAGE, -20)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition, CONDITION_PARAM_TICKINTERVAL, 5000)

local t = {5405, 5406, 5407, 5408, 5409, 5410, 5743, 5744, 5764, 9671, 9672, 9673}

function onStepIn(cid)
	if isPlayer(cid) then
		if not getPlayerFlagValue(cid, PLAYERFLAG_CANNOTBEATTACKED) then
			doAddCondition(cid, condition)
		end
		local v = getPlayerSlotItem(cid, CONST_SLOT_HEAD)
		if v.itemid == 5461 then
			local s = getCreatureStorage(cid, 25)
			if os.time() < s then
				doTransformItem(v.uid, 12541)
				doItemSetAttribute(v.uid, 'duration', (s - os.time()) * 1000)
				doDecayItem(v.uid)
			end
		end
	end
end

function onStepOut(cid, item, position, lastPosition, fromPosition, toPosition)
	if isPlayer(cid) and (toPosition.x == 0 or not isInArray(t, getThingfromPos(toPosition).itemid)) then
		doRemoveCondition(cid, CONDITION_DROWN)
		local v = getPlayerSlotItem(cid, CONST_SLOT_HEAD)
		if v.itemid == 12541 then
			doTransformItem(v.uid, 5461)
		end
	end
end

function onEquip(cid, item, slot, boolean)
	if slot == CONST_SLOT_HEAD then
		local s = getCreatureStorage(cid, 25)
		if os.time() < s then
			local p = getThingPos(cid)
			p.stackpos = 0
			if isInArray(t, getThingfromPos(p).itemid) then
				if item.itemid == 5461 then
					doTransformItem(item.uid, 12541)
				end
				doItemSetAttribute(item.uid, 'duration', (s - os.time()) * 1000)
				doDecayItem(item.uid)
			end
		elseif item.itemid == 12541 then
			doTransformItem(item.uid, 5461)
		end
	end
	return callFunction(cid, item.uid, slot, boolean)
end
To prevent crashes, open player.cpp, remove this & compile:
[cpp]//
if(!g_moveEvents->onPlayerEquip(const_cast<Player*>(this), const_cast<Item*>(item), (slots_t)index, true))
return RET_CANNOTBEDRESSED;[/cpp]
 
Last edited:
Error
[cpp]
cannot find -lcryptopp
C:\Documents and Settings\LucasOlzon\Desktop\Sources 8.6\dev-cpp\Makefile.win [Build Error] [TheForgottenServer.exe] Error 1 [/cpp]

and do not create the .exe
 
Back
Top