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
movements.xml
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"/>