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

MoveEvent Sliding on ice or w/e you want...

Xagul

deathzot.net
Joined
Jun 30, 2008
Messages
1,294
Solutions
3
Reaction score
1,037
Requested by Sportacus. This script will cause you to slide uncontrollably in the direction you are currently moving when you hit a tile of your choice (in this case ice). While sliding you may not control your characters movement until you collide with an object/creature or move onto a tile that is not configured as a slid-able tile. Script is provided as-is... I do not have time to re check this thread from day to day. It has been tested on 0.4. Enjoy! :)

filename.lua
Lua:
local slideTileIds = {671, 6683, 6684, 6685, 6686, 7200, 7236, 7237}
local hasteSubId = 8300

local condition = createConditionObject(CONDITION_HASTE)
setConditionParam(condition, CONDITION_PARAM_TICKS, -1)
setConditionParam(condition, CONDITION_PARAM_SUBID, hasteSubId)
setConditionFormula(condition, -1, 1500, -1, 1500)

local function doCreatureSlide(cid, direction)
	if(not isCreature(cid)) then return true end
	
	local slidePos = getPositionByDirection(getCreaturePosition(cid), direction, 1)
	slidePos.stackpos = STACKPOS_TOP_CREATURE
	local groundPos = getCreaturePosition(cid)
	groundPos.stackpos = STACKPOS_GROUND
	
	if(queryTileAddThing(cid, slidePos, 0, false) == RETURNVALUE_NOERROR and getThingFromPos(slidePos).itemid <= 0 and isInArray(slideTileIds, getThingFromPos(groundPos, false).itemid)) then
		doTeleportThing(cid, slidePos, true)
		addEvent(doCreatureSlide, 100, cid, direction)
	else
		doCreatureSetNoMove(cid, false)
		doRemoveCondition(cid, CONDITION_HASTE, hasteSubId)
	end
	return true
end

function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
	if(not getCreatureNoMove(cid)) then
		doCreatureSetNoMove(cid, true)
		doAddCondition(cid, condition)
		addEvent(doCreatureSlide, 100, cid, getDirectionTo(fromPosition, toPosition))
	end
	return true
end

movements.xml
XML:
<movevent type="StepIn" itemid="671;6683;6684;6685;6686;7200;7236;7237" event="script" value="filename.lua"/>
 
i thought about this idea either veryyyyy longggg agooo
inspirated by pokemon :3
very nice rep++

but it does now slide on ice on every ice tile right?
Wouldn't be better that only a ice tile with X actionid does give slide effect?
since i liked the idea but i don't want to happen it everywhere just on some places with puzzles and shit
does this also works on creatures?
 
120px-Mahagonia.png
 
Yea I think ^ thats what they wanted it for. Regardless, yes atm it works on creatures or players or npcs. Also if you want it to work on a specific action id only you can always change the .xml part from itemid to actionid, however unless changed in the script itself it will still only check the tile type not the action id :)
 
np thats easy to edit however it would look very funny if there is a following sliding demon behind you XD
 
Back
Top