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

Lua [Movement] Snow

ligus

New Member
Joined
Apr 26, 2010
Messages
253
Reaction score
0
Hey, I have problem with snow. When someone stepin on any snow tile then script creates tile
You see snow.
Someone must have walked here recently

but this tile doesn't decayBackTo snow...

Lua:
<movevent type="StepIn" itemid="670" event="script" value="snow.lua"/>
<movevent type="StepIn" itemid="6580" event="script" value="snow.lua"/>
<movevent type="StepIn" itemid="6581" event="script" value="snow.lua"/>	
<movevent type="StepIn" itemid="6582" event="script" value="snow.lua"/>	
<movevent type="StepIn" itemid="6583" event="script" value="snow.lua"/>
<movevent type="StepIn" itemid="6584" event="script" value="snow.lua"/>
<movevent type="StepIn" itemid="6585" event="script" value="snow.lua"/>
<movevent type="StepIn" itemid="6586" event="script" value="snow.lua"/>
<movevent type="StepIn" itemid="6587" event="script" value="snow.lua"/>	
<movevent type="StepIn" itemid="6588" event="script" value="snow.lua"/>
<movevent type="StepIn" itemid="6589" event="script" value="snow.lua"/>	
<movevent type="StepIn" itemid="6590" event="script" value="snow.lua"/>	
<movevent type="StepIn" itemid="6591" event="script" value="snow.lua"/>
<movevent type="StepIn" itemid="6592" event="script" value="snow.lua"/>	
<movevent type="StepIn" itemid="6593" event="script" value="snow.lua"/>


snow.lua
Lua:
TILE_SNOW = 670
TILE_FOOTPRINT_I = 6594
TILE_FOOTPRINT_II = 6598

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(isPlayerGhost(cid)) then
		return true
	end

	if(item.itemid == TILE_SNOW) then
		doTransformItem(item.uid, TILE_FOOTPRINT_I)
		doDecayItem(item.uid)
	elseif(item.itemid == TILE_FOOTPRINT_I) then
		doTransformItem(item.uid, TILE_FOOTPRINT_II)
		doDecayItem(item.uid)
	else
		doTransformItem(item.uid, TILE_FOOTPRINT_I)
	end

	return true
end


And i have a lot of tiles
Code:
You see snow.
ItemID: [6594].
DecayTo: [670].

items.xml
Lua:
<item id="6594" name="snow">
	<attribute key="description" value="Someone must have walked here recently." />
	<attribute key="decayTo" value="670" />
	<attribute key="duration" value="30" />
</item>

But it doesn't decay to snow (id 670) :( whats wrong?
 
First of all i haven't tested this script but it should work because tfs made it.

make a backup of your recently movements.xml(snow titles) and snow.lua since i dont want to be blamed.

movements.xml
PHP:
<movevent type="StepOut" itemid="670" event="script" value="snow.lua"/>
<movevent type="StepOut" fromid="6580" toid="6593" event="script" value="snow.lua"/>

snow.lua
Lua:
function onStepOut(cid, item, position, fromPosition)
	if isPlayerGhost(cid) == TRUE then
		return TRUE
	end

	addEvent(transformBack, 10000, {oldItemID = item.itemid, _position = position})
	if item.itemid == 670 then
		doTransformItem(item.uid, 6594)
	else
		doTransformItem(item.uid, item.itemid + 15)
	end
	return TRUE
end

function transformBack(parameters)
	parameters._position.stackpos = 0
	doTransformItem(getThingfromPos(parameters._position).uid, parameters.oldItemID)
	return TRUE
end

ps: add me rep if i helped you :)
Regards, Efren.
 
Your script works almost perefect, thanks! repped

but I have another problem
in script:
Code:
doTransformItem(item.uid, 6594)

and if someone stepin on this tile it should transform to 6598

i tried to do:

Code:
function onStepOut(cid, item, position, fromPosition)
        if isPlayerGhost(cid) == TRUE then
                return TRUE
        end

        addEvent(transformBack, 30000, {oldItemID = item.itemid, _position = position})
        if item.itemid == 670 then
                doTransformItem(item.uid, 6594)
        else
                doTransformItem(item.uid, item.itemid + 15)
        end
		
[COLOR="Red"][B]        if item.uid == 6594 then
           doTransformItem(item.uid, 6598)[/B][/COLOR]
        end
		
        return TRUE
end

function transformBack(parameters)
        parameters._position.stackpos = 0
        doTransformItem(getThingfromPos(parameters._position).uid, parameters.oldItemID)
        return TRUE
end
but it doesnt work
why?
 
Sorry for the delay.

snow.lua
Lua:
function onStepOut(cid, item, position, fromPosition)
	if isPlayerGhost(cid) == TRUE then
		return TRUE
	end

	addEvent(transformBack, 10000, {oldItemID = item.itemid, _position = position})
	if item.itemid == 670 then
	    doTransformItem(item.uid, 6594)
	else
            doTransformItem(item.uid, item.itemid + 15)
	
	elseif item.itemid == 6594 then
            doTransformItem(item.uid, 6598)
	end
        return TRUE
end

function transformBack(parameters)
	parameters._position.stackpos = 0
	doTransformItem(getThingfromPos(parameters._position).uid, parameters.oldItemID)
	return TRUE
end

I haven't tasted it but i think it should work.

Regards, Efren.
 
Back
Top