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

[Request] Help with script...

Allu

Member
Joined
Sep 19, 2008
Messages
30
Reaction score
0
Location
Mexico
Hello, I need help with the swimming effect (the splash).
cuze when I go into the water only the outfit changes.
I was woundering if someone could change/make the script.(like in Tibia)

local outfit =
{
lookType = 267,
lookHead = 0,
lookBody = 0,
lookLegs = 0,
lookFeet = 0,
lookAddons = 0
}

function onStepIn(cid, item, position, fromPosition)
doSetCreatureOutfit(cid, outfit, -1)
end

function onStepOut(cid, item, position, fromPosition)
doRemoveCondition(cid, CONDITION_OUTFIT)
end
 
\data\movements\scripts\swimming
east.lua:
Code:
dofile('data/movements/scripts/swimming/swimlib.lua')

function onStepIn(cid, item, pos)
	return checkSwim(cid, EAST, WEST)
end

north.lua:
Code:
dofile('data/movements/scripts/swimming/swimlib.lua')

function onStepIn(cid, item, pos)
	return checkSwim(cid, NORTH, SOUTH)
end

south.lua:
Code:
dofile('data/movements/scripts/swimming/swimlib.lua')

function onStepIn(cid, item, pos)
	return checkSwim(cid, SOUTH, NORTH)
end

swimlib.lua:
Code:
local conditions =
{
	CONDITION_POISON, CONDITION_FIRE, CONDITION_ENERGY,
	CONDITION_PARALYZE, CONDITION_DRUNK, CONDITION_DROWN,
	CONDITION_FREEZING, CONDITION_DAZZLED, CONDITION_CURSED
}

local outfit = {lookType = 267, lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookTypeEx = 0, lookAddons = 0}

function checkSwim(cid, swimDir, backDir)
	local posNow = getThingPos(cid)

	if(hasCondition(cid, CONDITION_OUTFIT) == TRUE and getCreatureOutfit(cid).lookType == outfit.lookType) then
		doMoveCreature(cid, backDir)
		doRemoveCondition(cid, CONDITION_OUTFIT)
	else
		if(queryTileAddThing(cid, getPosByDir(posNow, swimDir), 4) ~= RETURNVALUE_NOERROR) then
			return FALSE
		end

		-- Remove all bad conditions before swimming
		for i, v in ipairs(conditions) do
			if(hasCondition(cid, v) == TRUE) then
				doRemoveCondition(cid, v)
			end
		end

		doMoveCreature(cid, swimDir)
		doSetCreatureOutfit(cid, outfit, -1)
		doSendMagicEffect(getThingPos(cid), CONST_ME_WATERSPLASH)
	end
	return TRUE
end

west.lua:
Code:
dofile('data/movements/scripts/swimming/swimlib.lua')

function onStepIn(cid, item, pos)
	return checkSwim(cid, WEST, EAST)
end
------------
\data\movements
movements.xml:
Code:
	<!-- Swimming -->
	<movevent event="StepIn" itemid="4828" script="swimming/north.lua"/>
	<movevent event="StepIn" itemid="4829" script="swimming/east.lua"/>
	<movevent event="StepIn" itemid="4830" script="swimming/south.lua"/>
	<movevent event="StepIn" itemid="4831" script="swimming/west.lua"/>

	<movevent event="StepIn" itemid="7943" script="swimming/north.lua"/>
	<movevent event="StepIn" itemid="7944" script="swimming/west.lua"/>
	<movevent event="StepIn" itemid="7945" script="swimming/south.lua"/>
	<movevent event="StepIn" itemid="7946" script="swimming/east.lua"/>
	<movevent event="StepIn" itemid="7947" script="swimming/south.lua"/>
	<movevent event="StepIn" itemid="7948" script="swimming/south.lua"/>
	<movevent event="StepIn" itemid="7949" script="swimming/north.lua"/>
	<movevent event="StepIn" itemid="7950" script="swimming/north.lua"/>
	<movevent event="StepIn" itemid="7951" script="swimming/south.lua"/>
	<movevent event="StepIn" itemid="7952" script="swimming/south.lua"/>
	<movevent event="StepIn" itemid="7953" script="swimming/north.lua"/>
	<movevent event="StepIn" itemid="7954" script="swimming/north.lua"/>
 
Back
Top Bottom