Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 01-10-2011, 12:08 AM   #1
GambiT
Fortress Forever Staff
 
GambiT's Avatar
 
Join Date: Mar 2007
Location: Baton Rouge
Class/Position: Spy
Affiliations: -=DoM=-
Posts Rated Helpful 0 Times
conc_map LUA...

i have a concmap that i lost the lua to when my comp crashed a while back. can somebody please help me?

blue team - scout, medic - invincible(so red team can't hurt them[quad?])
red team - demo, pyro, solly and engi - quad

i have trigger brushes for constant resupply named "resupplyzone", is this needed or is there a way to constantly check and resupply without a trigger?(i'm fucking ignorant when it comes to lua's....)

take away secondary nades on red team

custom locs, i think i can add these to it.

theme i'm going with:
__________________
-------------------------------FF_Rock2(WIP)------------------------------
---------------------------FF_RedGiant(Released)-------------------------
--------------------------FF_Fragzone_G(Released)------------------------
--------------------------FF_Civibash_G(Released)------------------------
-------------------FF_Conc_G1(WIP)--------------------
-------------------FF_Hollow_G(WIP)---------------------
GambiT is offline   Reply With Quote


Old 01-10-2011, 04:40 AM   #2
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
I hope I did the logic right for the damage bit. I foresee a fuck-up.

BASE

Code:
IncludeScript("base_teamplay")

function startup()

	SetTeamName(Team.kBlue, "Team Conc")
	SetTeamName(Team.kRed, "Team Quad")
	
	SetPlayerLimit(Team.kYellow, -1)
	SetPlayerLimit(Team.kGreen, -1)
	SetPlayerLimit(Team.kRed, 0)
	SetPlayerLimit(Team.kBlue, 0)
	
  	local team = GetTeam(Team.kRed)
	team:SetClassLimit(Player.kScout, 0)
	team:SetClassLimit(Player.kSniper, -1)
	team:SetClassLimit(Player.kSoldier, -1)
	team:SetClassLimit(Player.kDemoman, -1)
	team:SetClassLimit(Player.kMedic, 0)
	team:SetClassLimit(Player.kHwguy, -1)
	team:SetClassLimit(Player.kPyro, -1)
	team:SetClassLimit(Player.kSpy, -1)
	team:SetClassLimit(Player.kEngineer, -1)
	team:SetClassLimit(Player.kCivilian, -1)
	
	team = GetTeam(Team.kRed)
	team:SetClassLimit(Player.kScout, -1)
	team:SetClassLimit(Player.kSniper, -1)
	team:SetClassLimit(Player.kSoldier, 0)
	team:SetClassLimit(Player.kDemoman, 0)
	team:SetClassLimit(Player.kMedic, -1)
	team:SetClassLimit(Player.kHwguy, -1)
	team:SetClassLimit(Player.kPyro, 0)
	team:SetClassLimit(Player.kSpy, -1)
	team:SetClassLimit(Player.kEngineer, 0)
	team:SetClassLimit(Player.kCivilian, -1)	
	
end

function player_ondamage(this, damageinfo)

	if not damageinfo then return end
	
	local player = CastToPlayer(this)
	local attacker = damageinfo:GetAttacker()
	
	damageinfo:SetDamage(0)
	
	if IsPlayer(attacker) then
		attacker = CastToPlayer(attacker)
		
		if attacker:GetTeamId() ~= player:GetTeamId() then
			damageinfo:SetDamageForce(Vector(0,0,0))	
		else
			local DamageForce = damageinfo:GetDamageForce()
			damageinfo:SetDamageForce(Vector(DamageForce.x * 4,DamageForce.y * 4,DamageForce.z * 4))	
		end	
		
	end
end

function player_spawn(this)

	local player = CastToPlayer(this)
	if player:GetTeamId() == Team.kRed then
		player:RemoveAmmo(Ammo.kGren2, 4)
	end
	return true
	
end
You have three ways to deal with resupply. Do you want it to constantly resupply them when they're in the resupply brush? Then use ontrigger:

Code:
resupplyzone = trigger_ff_script:new({})

function resupplyzone:ontrigger(trigger_entity)

	if IsPlayer(trigger_entity) then
		local player = CastToPlayer(trigger_entity)
		if player:GetClass() == Player.kMedic or player:GetClass() == Player.kScout then
			player:GiveAmmo(Ammo.kGren1, 0)
			player:GiveAmmo(Ammo.kGren2, 0)
		else
			player:GiveAmmo(Ammo.kRockets, 0)
			player:GiveAmmo(Ammo.kGrenades, 0)
			player:GiveAmmo(Ammo.kCells, 0)
			player:GiveAmmo(Ammo.kGren1, 0)
			player:GiveAmmo(Ammo.kGren2, 0)
		end
		ApplyToPlayer(player, {AT.kReloadClips})
	end
	
end
If you want it to only resupply them the first time they touch the brush, change:

Code:
function resupplyzone:ontrigger(trigger_entity)
to:

Code:
function resupplyzone:ontouch(trigger_entity)
As for a global function that handles resupply, I haven't done this in a while, but you could try this:

Code:
function ResupplyLoop()

	local b_team = Collection()
	b_team:GetByFilter({ CF.kPlayers, CF.kTeamBlue })
	
	local r_team = Collection()
	r_team:GetByFilter({ CF.kPlayers, CF.kTeamRed })
	
	for temp in b_team.items do
		local player = CastToPlayer(temp)
		if player then
			player:GiveAmmo(Ammo.kGren1, 0)
			player:GiveAmmo(Ammo.kGren2, 0)
		end
	end
	
	for temp in r_team.items do
		local player = CastToPlayer(temp)
		if player then
			player:GiveAmmo(Ammo.kRockets, 0)
			player:GiveAmmo(Ammo.kGrenades, 0)
			player:GiveAmmo(Ammo.kCells, 0)
			player:GiveAmmo(Ammo.kGren1, 0)
			player:GiveAmmo(Ammo.kGren2, 0)
		end
	end
	
	ApplyToAll({AT.kReloadClips})

end
The only problem is that might be very resource intensive. To keep this loop going, add this to startup():

Code:
AddScheduleRepeating("ResupplyLoop", 1, ResupplyLoop)
Inform me of inevitable errors.
Bridget 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 10:25 AM.


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