Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 06-30-2009, 07:24 PM   #21
DudeWheresMyMedic
 
DudeWheresMyMedic's Avatar
 
Join Date: Jan 2009
Posts Rated Helpful 0 Times
Hmm, LoL, well the quad dmg worked but ddin't need to be on the trogger to work auto started with quad rockets.
DudeWheresMyMedic is offline   Reply With Quote


Old 06-30-2009, 07:38 PM   #22
Crazycarl
D&A Member
Wiki Team
Fortress Forever Staff
 
Crazycarl's Avatar
 
Join Date: Apr 2007
Posts Rated Helpful 31 Times
Yeah, that script will enable quad for everyone as soon as the trigger is touched, and then never turn it off.
Crazycarl is offline   Reply With Quote


Old 06-30-2009, 07:46 PM   #23
DudeWheresMyMedic
 
DudeWheresMyMedic's Avatar
 
Join Date: Jan 2009
Posts Rated Helpful 0 Times
Oh ok.
DudeWheresMyMedic is offline   Reply With Quote


Old 06-30-2009, 08:25 PM   #24
Crazycarl
D&A Member
Wiki Team
Fortress Forever Staff
 
Crazycarl's Avatar
 
Join Date: Apr 2007
Posts Rated Helpful 31 Times
Try this instead.
Code:
DAMAGE_BONUS = 4 -- Multiplies the player's damage by DAMAGE_BONUS when in the zone. 1 = Normal damage, 4 = Quad damage
QUAD = Collection() --A list of every player in the quad zone

-----------------------------------------------------------------------------
-- Damage event - Add Quad Damage
-----------------------------------------------------------------------------
function player_ondamage( player, damageInfo )
 
	-- Entity that is attacking
	local attacker = damageInfo:GetAttacker()
 
	-- If no attacker do nothing
	if not attacker then return end
 
	-- If attacker is a player
	if IsPlayer(attacker) then
	
		local playerAttacker = CastToPlayer(attacker)
	
		-- If player is damaging self do nothing
		if player:GetId() == playerAttacker:GetId() then return end

		--Only for those touching the trigger
		for quadplayer in QUAD.items do
			quadplayer = CastToPlayer(quadplayer)
			if playerAttacker:GetId() == quadplayer:GetId() then
		
				--only if you own the point
				if playerAttacker:GetTeamId() == command_points[1].defending_team then
					-- If all conditions are true, increase player's damage to 400% - Quad Damage
					damageInfo:SetDamage(damageInfo:GetDamage() * DAMAGE_BONUS)
				end
			end
		end
	end
end
 
-- Fully resupply's the player's ammo
function fullresupply( player )
	
	player:AddAmmo( Ammo.kNails, 300 )
	player:AddAmmo( Ammo.kShells, 300 )
	player:AddAmmo( Ammo.kRockets, 300 )
	player:AddAmmo( Ammo.kCells, 300 )	
end

quadarea = trigger_ff_script:new({ })
 
-- This is called periodically (every 0.1 seconds or so)  when the player is inside the quadarea trigger.
function quadarea:ontrigger( trigger_entity )
	if ( IsPlayer( trigger_entity ) ) then
		local player = CastToPlayer( trigger_entity )
		
		-- Resupply's the player
		fullresupply( player)		
	end
end

function quadarea:ontouch( touch_entity )
	if IsPlayer( touch_entity ) then
		local player = CastToPlayer( touch_entity )
		
		-- Add this player to the collection
		QUAD:AddItem( player )

	end
end

function quadarea:onendtouch( touch_entity )
	if IsPlayer( touch_entity ) then
		local player = CastToPlayer( touch_entity )
		
		-- Add this player to the collection
		QUAD:RemoveItem( player )

	end
end
Crazycarl is offline   Reply With Quote


Old 06-30-2009, 08:34 PM   #25
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Quote:
Originally Posted by Dr.Satan View Post
Ok...I didn't have time to test this, but this should be what your looking for:

Place this in your maps .lua
http://privatepaste.com/e61RxYBu3Y

Then on the top of the hill or whatever area you want, you just have to create a new trigger and name it "quadarea"

This should give them quad and resupply them periodically. But I might have missed something too (it's really early still)
That'll actually give everyone in the map quad damage if anyone is in the trigger.

Try this:
Code:
DAMAGE_BONUS = 4 -- Multiplies the player's damage by DAMAGE_BONUS when in the zone. 1 = Normal damage, 4 = Quad damage
RESUPPLY_IN_ZONE = true -- turns resupplying on/off
RESUPPLY_DELAY = 10 -- time between resupplies (if resupplying is on)
RELOAD_CLIPS = true -- periodically reloads all weapons when in the zone if set to true

quad_collection = Collection(); -- stores all players that have quad

-----------------------------------------------------------------------------
-- Damage event - Add Quad Damage
-----------------------------------------------------------------------------
function player_ondamage( player, damageinfo )
	
	if not damageinfo then return end
	
	-- Entity that is attacking
	local attacker = damageinfo:GetAttacker()

	-- If no attacker do nothing
	if not attacker then return end

	-- If attacker is a player
	if IsPlayer(attacker) then
		local playerAttacker = CastToPlayer(attacker)
		
		-- If player is damaging self do nothing
		if player:GetId() == playerAttacker:GetId() then return end
		
		-- If the attacker isn't on the quad area do nothing
		if not quad_collection:HasItem( playerAttacker ) then return end

		-- if on the defending team
		if playerAttacker:GetTeamId() == command_points[1].defending_team then
			-- If all conditions are true, increase player's damage to 400% - Quad Damage
			damageInfo:SetDamage(damageinfo:GetDamage() * DAMAGE_BONUS)
		end
    end	
	
end

-- Fully resupply's the player's ammo
function fullresupply( player )
	-- if on the defending team
	if player:GetTeamId() == command_points[1].defending_team then
		player:AddAmmo( Ammo.kNails, 300 )
		player:AddAmmo( Ammo.kShells, 300 )
		player:AddAmmo( Ammo.kRockets, 300 )
		player:AddAmmo( Ammo.kCells, 300 )
	end	
end

-- Fully reload all weapons of a player
function fullreload( player )
	-- if on the defending team
	if player:GetTeamId() == command_points[1].defending_team then
		ApplyToPlayer( player, { AT.kReloadClips } )
	end
end

-----------------------------------------------------------------------------
-- Quad area
-- The area where the player is supposed to be holding
-----------------------------------------------------------------------------

quadarea = trigger_ff_script:new({ })

-- on touch, give quad
function quadarea:ontouch( trigger_entity )
	if ( IsPlayer( trigger_entity ) ) then
		local player = CastToPlayer( trigger_entity )
		
		-- add to the quad collection
		quad_collection:AddItem( player )
		-- if resupplying is on, add schedule
		if RESUPPLY_IN_ZONE then
			AddSchedule("resupply_zone-"..player:GetId(), RESUPPLY_DELAY fullresupply, player)
		end
		if RELOAD_CLIPS then
			AddSchedule("reload_zone-"..player:GetId(), 5, fullreload, player)
		end
	end
end

-- on endtouch, remove quad
function quadarea:onendtouch( trigger_entity )
	if ( IsPlayer( trigger_entity ) ) then
		local player = CastToPlayer( trigger_entity )
		
		-- remove from the quad collection
		zone_collection:RemoveItem( player )
		-- if resupplying is on, add schedule
		if RESUPPLY_IN_ZONE then
			RemoveSchedule("resupply_zone-"..player:GetId())
		end
		if RELOAD_CLIPS then
			RemoveSchedule("reload_zone-"..player:GetId())
		end
	end
end

-- when no one is in the zone, clear the collection
function quadarea:oninactive( )
	-- remove everyone from the quad collection
	zone_collection:RemoveAllItems()
end
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington

Last edited by squeek.; 06-30-2009 at 09:00 PM.
squeek. is offline   Reply With Quote


Old 06-30-2009, 08:35 PM   #26
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Ha! Too many luas!
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 06-30-2009, 08:50 PM   #27
Crazycarl
D&A Member
Wiki Team
Fortress Forever Staff
 
Crazycarl's Avatar
 
Join Date: Apr 2007
Posts Rated Helpful 31 Times
We're awesome

Use squeek's, it's probably better.
Crazycarl is offline   Reply With Quote


Old 06-30-2009, 08:59 PM   #28
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Edited mine to include your check to only allow defending team to deal quad damage/get resupplied/get reloaded.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington

Last edited by squeek.; 06-30-2009 at 09:00 PM.
squeek. is offline   Reply With Quote


Old 06-30-2009, 10:00 PM   #29
DudeWheresMyMedic
 
DudeWheresMyMedic's Avatar
 
Join Date: Jan 2009
Posts Rated Helpful 0 Times
Thanks, I'll Try that and I'll get back to you.
DudeWheresMyMedic is offline   Reply With Quote


Old 06-30-2009, 10:11 PM   #30
DudeWheresMyMedic
 
DudeWheresMyMedic's Avatar
 
Join Date: Jan 2009
Posts Rated Helpful 0 Times
Okay, I added your .LUA code and when I gone in to test the map that error came up where all 4 team colors come up and can't pick any classes.
DudeWheresMyMedic is offline   Reply With Quote


Old 06-30-2009, 10:12 PM   #31
Elmo
Gets tickled by FF
Fortress Forever Staff
 
Elmo's Avatar
 
Join Date: Jun 2007
Location: UK
Class/Position: Med Solly HW
Gametype: Any/CTF
Posts Rated Helpful 41 Times
certainly cant complain that they aren't helping
__________________
Support FF:
Done: ff_monkey
Done: ff_bases
Done: ff_warpath
Forever Doing: ff_medieval (beta#99999999)
Elmo is offline   Reply With Quote


Old 06-30-2009, 10:16 PM   #32
DudeWheresMyMedic
 
DudeWheresMyMedic's Avatar
 
Join Date: Jan 2009
Posts Rated Helpful 0 Times
I'm grateful, of their help, without them this map wouldn't go anywhere.

Last edited by Elmo; 06-30-2009 at 10:42 PM.
DudeWheresMyMedic is offline   Reply With Quote


Old 06-30-2009, 11:49 PM   #33
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Open your console and look for any [SCRIPT] errors. Paste any you see in here.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Old 07-01-2009, 03:13 AM   #34
DudeWheresMyMedic
 
DudeWheresMyMedic's Avatar
 
Join Date: Jan 2009
Posts Rated Helpful 0 Times
[SCRIPT] Attempting to start up the entity system...
[SCRIPT] Entity system initialization successful.
[SCRIPT] Loading Lua File: maps/includes/base.lua
[SCRIPT] Successfully loaded maps/includes/base.lua
[SCRIPT] Loading Lua File: maps\koth_classic.lua
Error loading maps\koth_classic.lua: [string "maps\koth_classic.lua"]:224: '<eof>' expected near 'end'
[EntSys] Entity System Helper Spawned
Executing listen server config file
SENTENCEG_Init: precached scripts/sentences.txt
SENTENCEG_Init: precached scripts/sentences_common.txt
SV_StartSound: npc/headcrab/headcrab_burning_loop2.wav not precached (0)
SV_StartSound: ambient/fire/fire_small_loop2.wav not precached (0)
SV_StartSound: npc/headcrab/headcrab_burning_loop2.wav not precached (0)
SV_StartSound: ambient/fire/fire_small_loop2.wav not precached (0)
SV_StartSound: npc/headcrab/headcrab_burning_loop2.wav not precached (0)
SV_StartSound: ambient/fire/fire_small_loop2.wav not precached (0)
Attempted to create unknown entity type info_tfdetect!
Can't init info_tfdetect
couldn't exec listenserver.cfg
couldn't exec koth_classic.cfg
Section [Scenes]: 1096 resources total 17.54 KB, 0.84 % of limit (2.10 MB)
-------------- Omni-bot Init ----------------
Omni-bot Loading: LoadLibrary Failed with Error: The specified module could not be found.
Omni-bot Loading: Looking for omni-bot\omnibot_ff.dll,
Omni-bot Loading: LoadLibrary Failed with Error: The specified module could not be found.
Omni-bot Loading: Looking for .\omni-bot\omnibot_ff.dll,
Omni-bot Loading: LoadLibrary Failed with Error: The specified module could not be found.
Omni-bot Loading: Looking for omnibot_ff.dll,
---------------------------------------------
4 player server started
Adding master server 69.28.140.246:27011
Adding master server 68.142.72.250:27011
Client "[TALOS]DudeWheresMyMedic" connected (127.0.0.1:27005).
Connected to 127.0.0.1:27015
[VERSION] Server: 2.3
DudeWheresMyMedic is offline   Reply With Quote


Old 07-01-2009, 04:12 AM   #35
Dr.Satan
Wiki Team
Fortress Forever Staff
 
Dr.Satan's Avatar
 
Join Date: Sep 2007
Location: Greeley, CO
Class/Position: Med / Solly
Gametype: PAYLOAD
Affiliations: DET-
Posts Rated Helpful 19 Times
Quote:
Error loading maps\koth_classic.lua: [string "maps\koth_classic.lua"]:224: '<eof>' expected near 'end'
this...

something about the .lua file isn't being loaded. Post your full lua.file

Also sorry about the .lua earlier, I kinda figured that would happen...but I wasn't 100% sure and couldn't build a test map and jump in cause I had to take off somewhere.
__________________
(Released) conc_school | hellion_classic | ksour_PAYLOAD | mulch_faf
(Beta) alchimy_b1
(Lua) base_payload_2015
(Models) props_trainyard
Support FF:
Dr.Satan is offline   Reply With Quote


Old 07-01-2009, 02:57 PM   #36
Crazycarl
D&A Member
Wiki Team
Fortress Forever Staff
 
Crazycarl's Avatar
 
Join Date: Apr 2007
Posts Rated Helpful 31 Times
Look at line 224. There's something that's not supposed to be there. Maybe an extra 'end'

If you paste the file here we should be able to find it.
Crazycarl is offline   Reply With Quote


Old 07-01-2009, 03:15 PM   #37
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
The few times I've encountered that error, it's because an end existed where it shouldn't or it isn't tabbed right (I'm not sure if whitespace is part of syntax with lua) but, as I said..

Try tabbing the second to last end over once, within function player_ondamage( player, damageinfo )
Bridget is offline   Reply With Quote


Old 07-01-2009, 06:36 PM   #38
DudeWheresMyMedic
 
DudeWheresMyMedic's Avatar
 
Join Date: Jan 2009
Posts Rated Helpful 0 Times
------------------------------------------------
-- ff_agora.lua v0.99b
-- Pon.id
-- Commissioned by =AS=zE for ff_agora
-- Give to DudeWheresMyMedic for ff_DMMedic...
-- Description:
-- ------------
--
-- Last man standing. Team Deathmatch, with dead people being respawned elsewhere until round over
--
--
-- ToDo list:
-- ----------
--
-- Sounds and message on win
------------------------------------------------


---------------------------------
-- Includes
---------------------------------

IncludeScript("base_teamplay");


---------------------------------
-- Global Variables
---------------------------------

TEAM_POINTS_PER_WIN = 10
BLUE_TEAM_NAME = "Blue Solly"
RED_TEAM_NAME = "Red Solly"


---------------------------------
-- Functions
---------------------------------

-- Startup. Pretty basic stuff.
function startup()
-- set up team limits (only red & blue)
SetPlayerLimit( Team.kBlue, 0 )
SetPlayerLimit( Team.kRed, 0 )
SetPlayerLimit( Team.kYellow, -1 )
SetPlayerLimit( Team.kGreen, -1 )

SetTeamName( Team.kRed, RED_TEAM_NAME )
SetTeamName( Team.kBlue, BLUE_TEAM_NAME )

-- Blue Team Class limits (only soldier)
local team = GetTeam( Team.kBlue )
team:SetClassLimit( Player.kSoldier, 0 )
team:SetClassLimit( Player.kDemoman, -1 )
team:SetClassLimit( Player.kCivilian, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, -1 )

-- Red Team class limits (same)
team = GetTeam( Team.kRed )
team:SetClassLimit( Player.kSoldier, 0 )
team:SetClassLimit( Player.kDemoman, -1 )
team:SetClassLimit( Player.kCivilian, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, -1 )

AddSchedule("turnoffnormalspawn", 1 , turnoffnormalspawn)
end


-- Everyone to spawn with everything.
function player_spawn( player_entity )
local player = CastToPlayer( player_entity )
player:AddHealth( 400 )
player:AddArmor( 400 )

player:AddAmmo( Ammo.kNails, 400 )
player:AddAmmo( Ammo.kShells, 400 )
player:AddAmmo( Ammo.kRockets, 400 )
player:AddAmmo( Ammo.kCells, 400 )
player:AddAmmo( Ammo.kDetpack, 1 )
player:RemoveAmmo( Ammo.kGren2, 4 )
player:RemoveAmmo( Ammo.kGren1, 4 )
player:AddAmmo( Ammo.kGren1, 2 )
end


-- Calls a function to check if a team has won every time someone dies
function player_killed( killed_entity )
local player = CastToPlayer( killed_entity )
player:Spectate ( SpecMode.kRoaming )
player:SetRespawnable( false )
CheckTeamAliveState( killed_entity)
end


function Spectate( player )
player:Spectate( SpecMode.kRoaming )
end


-- Checks to see if people are still alive. If one team is all dead, declare the other team the winners.
function CheckTeamAliveState(killed_player)
ConsoleToAll( "CheckTeamAliveState" )

local blue = Collection()
local red = Collection()

-- Filter players online into seperate teams. Ignore spectators.
blue:GetByFilter({ CF.kPlayers, CF.kTeamBlue })
red:GetByFilter({ CF.kPlayers, CF.kTeamRed })

-- If either team has no players, then exit. Just one person running about shouldn't get boxed up.
if (blue:Count() == 0) or (red:Count() == 0) then
AddSchedule("respawnall", 1 , respawnall)
end


local bAlive = 0
local rAlive = 0

-- Check all blue team players to see who is still alive
for temp in blue.items do
local player = CastToPlayer( temp )
if player:IsAlive() then
bAlive = bAlive + 1
end
end

-- Same for red
for temp in red.items do
local player = CastToPlayer( temp )
if player:IsAlive() then
rAlive = rAlive + 1
end
end

-- checks to see if either team is all dead. If so, declare other team the winner, and start new round. If not, set the killed player to spectate
if (bAlive >= 1) and (rAlive == 0) then
BroadCastMessage(BLUE_TEAM_NAME .. " win!")
local team = GetTeam (Team.kBlue)
team:AddScore(TEAM_POINTS_PER_WIN)
AddSchedule("respawnall", 3 , respawnall)
elseif (rAlive >= 1) and (bAlive == 0) then
BroadCastMessage(RED_TEAM_NAME .. " win!")
local team = GetTeam (Team.kRed)
team:AddScore(TEAM_POINTS_PER_WIN)
AddSchedule("respawnall", 3 , respawnall)
else
return
end
end


-- checks that enemies are damaging, not self or fall damage
function player_ondamage( player, damageinfo )
-- Entity that is attacking
local attacker = damageinfo:GetAttacker()

-- shock is the damage type used for the trigger_hurts in this map. Must be allowed to kill players
if damageinfo:GetDamageType() == Damage.kShock then
return EVENT_ALLOWED
end

-- If no attacker do nothing
if not attacker then
damageinfo:SetDamage(0)
return
end

-- If attacker not a player do nothing
if not IsPlayer(attacker) then
damageinfo:SetDamage(0)
return
end

local playerAttacker = CastToPlayer(attacker)

-- If player is damaging self do nothing
if (player:GetId() == playerAttacker:GetId()) or (player:GetTeamId() == playerAttacker:GetTeamId()) then
damageinfo:SetDamage(0)
return
end
end


-- Respawns all players.
function RespawnEveryone()
ApplyToAll({ AT.kRemovePacks, AT.kRemoveProjectiles, AT.kRespawnPlayers, AT.kRemoveBuildables, AT.kRemoveRagdolls, AT.kStopPrimedGrens, AT.kReloadClips, AT.kAllowRespawn, AT.kReturnDroppedItems })
end


---------------------------------
-- Scheduled functions
---------------------------------


function respawnall()
RespawnEveryone()
end

-----------------------------------------------------------------------------
-- spawn validty checking
-----------------------------------------------------------------------------

-- makes sure the VIP can only spawn in their teams base
normal_spawn = info_ff_teamspawn:new({ validspawn = function(self, player)
return EVENT_ALLOWED
end})

-- Ties the map's spawn entities to the above functions
normalspawn = normal_spawn:new()
end
-----------------------------------------------------------------------------
DAMAGE_BONUS = 4 -- Multiplies the player's damage by DAMAGE_BONUS when in the zone. 1 = Normal damage, 4 = Quad damage
RESUPPLY_IN_ZONE = true -- turns resupplying on/off
RESUPPLY_DELAY = 10 -- time between resupplies (if resupplying is on)
RELOAD_CLIPS = true -- periodically reloads all weapons when in the zone if set to true

quad_collection = Collection(); -- stores all players that have quad

-----------------------------------------------------------------------------
-- Damage event - Add Quad Damage
-----------------------------------------------------------------------------
function player_ondamage( player, damageinfo )

if not damageinfo then return end

-- Entity that is attacking
local attacker = damageinfo:GetAttacker()

-- If no attacker do nothing
if not attacker then return end

-- If attacker is a player
if IsPlayer(attacker) then
local playerAttacker = CastToPlayer(attacker)

-- If player is damaging self do nothing
if player:GetId() == playerAttacker:GetId() then return end

-- If the attacker isn't on the quad area do nothing
if not quad_collection:HasItem( playerAttacker ) then return end

-- if on the defending team
if playerAttacker:GetTeamId() == command_points[1].defending_team then
-- If all conditions are true, increase player's damage to 400% - Quad Damage
damageInfo:SetDamage(damageinfo:GetDamage() * DAMAGE_BONUS)
end
end

end

-- Fully resupply's the player's ammo
function fullresupply( player )
-- if on the defending team
if player:GetTeamId() == command_points[1].defending_team then
player:AddAmmo( Ammo.kNails, 300 )
player:AddAmmo( Ammo.kShells, 300 )
player:AddAmmo( Ammo.kRockets, 300 )
player:AddAmmo( Ammo.kCells, 300 )
end
end

-- Fully reload all weapons of a player
function fullreload( player )
-- if on the defending team
if player:GetTeamId() == command_points[1].defending_team then
ApplyToPlayer( player, { AT.kReloadClips } )
end
end

-----------------------------------------------------------------------------
-- Quad area
-- The area where the player is supposed to be holding
-----------------------------------------------------------------------------

quadarea = trigger_ff_script:new({ })

-- on touch, give quad
function quadareantouch( trigger_entity )
if ( IsPlayer( trigger_entity ) ) then
local player = CastToPlayer( trigger_entity )

-- add to the quad collection
quad_collection:AddItem( player )
-- if resupplying is on, add schedule
if RESUPPLY_IN_ZONE then
AddSchedule("resupply_zone-"..player:GetId(), RESUPPLY_DELAY fullresupply, player)
end
if RELOAD_CLIPS then
AddSchedule("reload_zone-"..player:GetId(), 5, fullreload, player)
end
end
end

-- on endtouch, remove quad
function quadareanendtouch( trigger_entity )
if ( IsPlayer( trigger_entity ) ) then
local player = CastToPlayer( trigger_entity )

-- remove from the quad collection
zone_collection:RemoveItem( player )
-- if resupplying is on, add schedule
if RESUPPLY_IN_ZONE then
RemoveSchedule("resupply_zone-"..player:GetId())
end
if RELOAD_CLIPS then
RemoveSchedule("reload_zone-"..player:GetId())
end
end
end

-- when no one is in the zone, clear the collection
function quadareaninactive( )
-- remove everyone from the quad collection
zone_collection:RemoveAllItems()
end
DudeWheresMyMedic is offline   Reply With Quote


Old 07-01-2009, 07:30 PM   #39
PartialSchism
Keep On Keepin' On
 
PartialSchism's Avatar
 
Join Date: Feb 2008
Location: Mississippi
Class/Position: Offense
Gametype: Fun
Affiliations: I'm bad at FF, and my customs suck
Posts Rated Helpful 0 Times
Send a message via AIM to PartialSchism
Code:
line 224
-- Ties the map's spawn entities to the above functions
normalspawn = normal_spawn:new()
end
I think that end needs to be removed?

Last edited by PartialSchism; 07-01-2009 at 07:31 PM.
PartialSchism is offline   Reply With Quote


Old 07-01-2009, 07:37 PM   #40
squeek.
Stuff Do-er
Lua Team
Wiki Team
Fortress Forever Staff
 
squeek.'s Avatar
 
Join Date: Mar 2007
Location: Northern California
Class/Position: Rallygun Shooter
Gametype: Conc tag (you just wait)
Affiliations: Mustache Brigade
Posts Rated Helpful 352 Times
Send a message via AIM to squeek.
Quote:
Originally Posted by PartialSchism View Post
Code:
line 224
-- Ties the map's spawn entities to the above functions
normalspawn = normal_spawn:new()
end
I think that end needs to be removed?
Yep, that looks like it might be it.
__________________
#FF.Pickup ¤ Fortress-Forever pickups

My Non-official Maps
Released FF_DM_Squeek - FF_2Mesa3_Classic - FF_Siege_Classic
Beta FF_Myth - FF_Redlight_Greenlight

Sick of the people on the internet, always moanin'. They just moan.
- Karl Pilkington
squeek. is offline   Reply With Quote


Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 12:57 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2024, vBulletin Solutions, Inc.