slaw
Software Developer
Its combination, action + movement. :}
movements/scripts/fireworks rocket.lua
1. Replace data\actions\scripts\other\fireworksrocket.lua with this:
How it works?
You place firework (Id: 6576) on FIRE FIELD, and it will automatically start timer, and after 5 seconds boom
You can also simply USE it. It will also work !
2. Create new file, movements/script/fireworksrocket.lua
movements.lua
global.lua/function.lua
There is also needed this function to work: (Place in global.lua, or function.lua if 0.3)
http://otland.net/f163/doremoveitemfrompos-18703/#post189330
Btw. Happy new year!:thumbup:
movements/scripts/fireworks rocket.lua
1. Replace data\actions\scripts\other\fireworksrocket.lua with this:
How it works?
You place firework (Id: 6576) on FIRE FIELD, and it will automatically start timer, and after 5 seconds boom
You can also simply USE it. It will also work !
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
if fromPosition.x ~= CONTAINER_POSITION then
fireWorkRocketBoom(fromPosition)
else
doSendMagicEffect(fromPosition, CONST_ME_HITBYFIRE)
doSendMagicEffect(fromPosition, CONST_ME_EXPLOSIONAREA)
doCreatureSay(cid, "Ouch! Rather place it on the ground next time.", TALKTYPE_ORANGE_1)
doCreatureAddHealth(cid, -10)
end
doRemoveItem(cid, item.uid, 1)
return TRUE
end
2. Create new file, movements/script/fireworksrocket.lua
Code:
--by slaw
--Config
local timeToBoom = 5
local fireFields = {1487, 1488, 1489, 1492, 1493, 1494}
function fireWorkTimer(seconds, pos, itemid)
local tmp = getTileItemById(pos, itemid)
if tmp.uid == FALSE then
return FALSE
end
if seconds == 0 then
fireWorkRocketBoom(pos)
doRemoveItemFromPos(pos, itemid)
return TRUE
end
doSendAnimatedText(pos, seconds, 150)
seconds = seconds - 1
addEvent(fireWorkTimer, 1000, seconds, pos, itemid)
end
function onAddItem(moveitem, tileitem, pos)
pos.stackpos = STACKPOS_TOP_FIELD
if isInArray(fireFields, getThingFromPos(pos).itemid) == TRUE then
fireWorkTimer(timeToBoom, pos, moveitem.itemid)
end
return TRUE
end
movements.lua
Code:
<!-- FIREROCKET by slawkens -->
<movevent event="AddItem" itemid="6576" script="fireworks.lua" />
global.lua/function.lua
Code:
function fireWorkRocketBoom(fromPosition)
local tmpPos = {}
local i = 4
while(i >= 1) do
tmpPos = {x=fromPosition.x - i, y=fromPosition.y - i, z=fromPosition.z, stackpos=0}
if isSightClear(fromPosition, tmpPos, FALSE) == TRUE then
if(hasProperty(getThingFromPos(tmpPos).uid, CONST_PROP_BLOCKINGANDNOTMOVEABLE) ~= TRUE) then
doSendDistanceShoot(fromPosition, tmpPos, 3)
addEvent(doSendMagicEffect, 350, tmpPos, math.random(CONST_ME_FIREWORK_YELLOW, CONST_ME_FIREWORK_BLUE))
break
end
end
i = i - 1
end
end
There is also needed this function to work: (Place in global.lua, or function.lua if 0.3)
http://otland.net/f163/doremoveitemfrompos-18703/#post189330
Btw. Happy new year!:thumbup:
Last edited: