therrax
Member
- Joined
- Jul 12, 2012
- Messages
- 262
- Solutions
- 1
- Reaction score
- 11
Hi
Information: TFS 1.0
When a player wins the event, he gets a reward cup. I wish for winning got some other item, for example item id 6527
That is script:
Information: TFS 1.0
When a player wins the event, he gets a reward cup. I wish for winning got some other item, for example item id 6527
That is script:
Code:
--zombie variables
ze_Zombie_Name = "Zombie" --Zombie Name
zombie_spawn_interval = 5 --how many seconds until a new zombie spawns
ze_zombie_count = 0 --dont touch
ze_max_zombies = 20 --max zombies in the arena?
--players variables
ze_join_storage = 1000 --player join storage
ze_min_players = 2 --min players needed when time runout
ze_max_players = 15 --max players to join
ze_trophy = 7369 --trophy id
ze_trophy_desc = "has won the Zombie Event." --winner description on the trophy
--other variables
ze_wait_minutes = 1 --when event has opened, how long until it starts?
ze_started = false --dont touch
ze_waiting_room_pos = {x = 585, y = 879, z = 10} --middle of waiting room
ze_zombie_arena = {x = 656, y = 909, z = 10} --when even start where should player be teleported in the zombie arena?
ze_Arena_fromPosition = {x = 634, y = 892, z = 10} --pos of top left corner
ze_Arena_toPosition = {x = 678, y = 927, z = 10} --pos of bottom right corner
ze_middle_zombie_arena = {x = 654, y = 913, z = 10} --Middle pos of the arena
ze_joined_count = 0 --dont touch
ze_waiting_room_radius_x = 20 --depends how big the waiting room is 20sqm to x
ze_waiting_room_radius_y = 20 --depends how big the waiting room is 20sqm to y
ze_zombie_arena_radius_x = 50 --Depends how big the zombie arena is 50sqm to x
ze_zombie_arena_radius_y = 50 --Depends how big the zombie arena is 50sqm to y
function startZombie()
local specs = Game.getSpectators(ze_waiting_room_pos, false, true, 0, ze_waiting_room_radius_x, 0, ze_waiting_room_radius_y)
if ze_joined_count >= ze_min_players then
for i = 1, #specs do
specs[i]:teleportTo(ze_zombie_arena, true)
end
broadcastMessage("Zombie Event has started, good luck to all participant.", MESSAGE_STATUS_WARNING)
ze_started = started
doStartZombieEvasion()
else
for i = 1, #specs do
specs[i]:teleportTo(specs[i]:getTown():getTemplePosition(), false)
specs[i]:setStorageValue(ze_join_storage, 0)
end
resetVariables()
broadcastMessage("Zombie Event failed to start, because of to little players joined the event!", MESSAGE_STATUS_WARNING)
end
end
function doSummonZombie()
if ze_zombie_count < ze_max_zombies then
local zomb = Game.createMonster(ze_Zombie_Name, {x = math.random(ze_Arena_fromPosition.x, ze_Arena_toPosition.x), y = math.random(ze_Arena_fromPosition.y, ze_Arena_toPosition.y), z = math.random(ze_Arena_fromPosition.z, ze_Arena_toPosition.z)})
if zomb == false then
Game.createMonster(ze_Zombie_Name, {x = math.random(ze_Arena_fromPosition.x, ze_Arena_toPosition.x), y = math.random(ze_Arena_fromPosition.y, ze_Arena_toPosition.y), z = math.random(ze_Arena_fromPosition.z, ze_Arena_toPosition.z)})
end
ze_zombie_count = ze_zombie_count + 1
end
end
function doStartZombieEvasion()
if ze_started == started then
doSummonZombie()
addEvent(doStartZombieEvasion, 5 * 1000)
end
end
function resetVariables()
ze_started = false
ze_joined_count = 0
ze_zombie_count = 0
end
function doClearZombieArena()
local specs = Game.getSpectators(ze_middle_zombie_arena, false, false, 0, ze_zombie_arena_radius_x, 0, ze_zombie_arena_radius_y)
for i = 1, #specs do
if specs[i]:getName() == ze_Zombie_Name then
specs[i]:remove()
end
end
end