Scrappy Coco
Member
- Joined
- Dec 27, 2014
- Messages
- 95
- Reaction score
- 17
Hi Otland today I bring you the event FireStorm for those unfamiliar with the event here a video of the demonstration
We begin installing the library.
data/firestorm_event.lua
http://pastebin.com/AdCw0gT9
continue with Creaturescripts/scripts
Creaturescripts.xml
Add this in your login
Continue with Globalevents/scripts
Globalevents.xml
the last Movements/scripts
Movements. xml
Note that in the library He comes his configuaracion in English and Spanish anything do not hesitate to consult in this post.
That would all hope they serve and feel free to comment accept comments good and bad and worse .
Perhaps also soon release Capture The Flag and Zombie Event for tfs 1.2
Special Thanks :
@GodSuimty - (Blacktibia editing, video capture and testing )
Printer(take as a basis an event he did for TFS 1.0)
data/firestorm_event.lua
http://pastebin.com/AdCw0gT9
continue with Creaturescripts/scripts
Code:
dofile('data/firestorm_event.lua')
function onPrepareDeath(player, killer)
local winner = 0
if player:getStorageValue(fsJoinStorage) >= 1 then
Game.setStorageValue(fsJoinedCountGlobalStorage, Game.getStorageValue(fsJoinedCountGlobalStorage)-1)
player:teleportTo(player:getTown():getTemplePosition())
player:setStorageValue(fsJoinStorage, 0)
player:addHealth(player:getMaxHealth())
if Game.getStorageValue(fsJoinedCountGlobalStorage) <= 1 then --Event ended, someone won!
local pla, play = nil, Game.getPlayers()
for i = 1, #play do
pla = play[i]
if pla:getStorageValue(fsJoinStorage) == 1 then
winner = pla:getId()
break
end
end
winner = Player(winner)
if winner then
winner:teleportTo(winner:getTown():getTemplePosition())
winner:addHealth(winner:getMaxHealth())
local trophy = winner:addItem(fsTrophy, 1)
if trophy then
trophy:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, '['.. winner:getName() ..'] has won the firestorm Event.')
end
Game.broadcastMessage(string.format('%s is the winner of firestorm Event', winner:getName()), MESSAGE_STATUS_WARNING)
end
resetfsVariables()
end
return false
end
return true
end
Creaturescripts.xml
Code:
<!-- firestorm -->
<event type="prepareDeath" name="fire_event" script="xxxx.lua"/>
Add this in your login
Code:
player:registerEvent("fire_event")
Continue with Globalevents/scripts
Code:
dofile('data/firestorm_event.lua')
function onThink(interval, lastExecution, thinkInterval)
resetfsVariables()
if Game.getStorageValue(fsStartedGlobalStorage) < 1 then
local teleport = doCreateItem(11796,1,fsCreateTeleportPosition)
if teleport then
doSetItemActionId(teleport, 5499)
doSendMagicEffect(fsCreateTeleportPosition, CONST_ME_TELEPORT)
end
local r_tp = Tile(fsCreateTeleportPosition):getItemById(11796)
addEvent(function() r_tp:remove() getTileItemById(fsCreateTeleportPosition, 11796) end, 60 * 1000)
addEvent(function() doSendMagicEffect(fsCreateTeleportPosition, CONST_ME_TELEPORT) end, 60 * 1000)
end
Game.setStorageValue(fsStartedGlobalStorage,1)
print('firestorm Event has started & waiting for players to join! Min: '.. fsMinPlayers ..'/'.. fsMaxPlayers ..'.')
Game.broadcastMessage('The firestorm Event has started! You have '.. fsWaitMinutes ..' minutes to join!', MESSAGE_STATUS_WARNING)
addEvent(startfirestorm, fsWaitMinutes * 60 * 1000)
return true
end
Globalevents.xml
Code:
<!-- FireStorm-->
<globalevent name="firestorm_event" interval="72000000" script="xxxx.lua"/>
You can edit this part to run it according to your need
interval="72000000"
interval="72000000"
the last Movements/scripts
Code:
dofile('data/firestorm_event.lua')
function onStepIn(creature, item, position, fromPosition)
local player = creature:getPlayer()
if Game.getStorageValue(fsStartedGlobalStorage) == 2 then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Firestorm Event has already started.')
player:teleportTo(fromPosition, true)
return false
end
if Game.getStorageValue(fsStartedGlobalStorage) == 0 then
player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Firestorm Event has not started yet.')
player:teleportTo(fromPosition, true)
return false
end
if Game.getStorageValue(fsJoinedCountGlobalStorage) >= fsMaxPlayers then
player:teleportTo(fromPosition, true)
player:sendTextMessage(MESSAGE_INFO_DESCR, 'The Firestorm Event is already full! ['.. Game.getStorageValue(fsJoinedCountGlobalStorage) ..'/'.. fsMaxPlayers ..']')
return false
end
player:teleportTo(fsWaitingRoomPos)
Game.setStorageValue(fsJoinedCountGlobalStorage, Game.getStorageValue(fsJoinedCountGlobalStorage) + 1)
Game.broadcastMessage(string.format('%s has joined the Firestorm Event! [%s/'.. fsMaxPlayers ..'].', player:getName(), Game.getStorageValue(fsJoinedCountGlobalStorage)), MESSAGE_STATUS_WARNING)
player:setStorageValue(fsJoinStorage, 1)
return true
end
Movements. xml
Code:
<!-- firestorm -->
<movevent event="StepIn" actionid="5499" script="xxxx.lua"/>
doSendDistanceShoot(fsArenaFromPosition, randfire, 4)
That part of the library is because as you can see in the video shoot fire statues assimilate is optional but that can change the coordinates
" doSendDistanceShoot(From , to, 4) "
Note that in the library He comes his configuaracion in English and Spanish anything do not hesitate to consult in this post.
That would all hope they serve and feel free to comment accept comments good and bad and worse .
Perhaps also soon release Capture The Flag and Zombie Event for tfs 1.2
Special Thanks :
@GodSuimty - (Blacktibia editing, video capture and testing )
Printer(take as a basis an event he did for TFS 1.0)