Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 01-15-2012, 10:01 AM   #1
aleXtric
#FF.Pickup Dictator
Beta Tester
 
Join Date: Aug 2011
Location: Detroit
Gametype: ADL
Affiliations: KiNGz .
Posts Rated Helpful 100 Times
Adding concs to asti

i want to add concs to asti for scouts and medics when they spawn. i have no idea how. heres the lua

Quote:

-- ff_asti.lua

-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay")
IncludeScript("base_id")
IncludeScript("base_location")
IncludeScript("base_respawnturret")

-----------------------------------------------------------------------------
-- overrides
-----------------------------------------------------------------------------
POINTS_PER_PERIOD = 5
NUM_PHASES = 3
FLAG_RETURN_TIME = 30


-----------------------------------------------------------------------------
-- locations
-----------------------------------------------------------------------------
location_ospawn = location_info:new({ text = "Attacker Spawn", team = NO_TEAM })
location_alley = location_info:new({ text = "Grenade Alley", team = NO_TEAM })
location_cp1 = location_info:new({ text = "Main Road - CP1", team = NO_TEAM })
location_uproad = location_info:new({ text = "Box Warehouse Road", team = NO_TEAM })
location_sroad = location_info:new({ text = "Asti Plaza Road", team = NO_TEAM })
location_cp2 = location_info:new({ text = "Asti Show Lounge - CP2", team = NO_TEAM })
location_froad = location_info:new({ text = "Grenade Factory Road", team = NO_TEAM })
location_cp3l = location_info:new({ text = "FF Building - Lower", team = NO_TEAM })
location_cp3 = location_info:new({ text = "FF Building - Upper - CP3", team = NO_TEAM })
location_box = location_info:new({ text = "Box Warehouse", team = NO_TEAM })
location_dspawn = location_info:new({ text = "Defense Spawn", team = NO_TEAM })

-----------------------------------------------------------------------------
-- backpacks
-----------------------------------------------------------------------------
astipack = genericbackpack:new({
health = 50,
armor = 50,
grenades = 25,
shells = 50,
nails = 50,
rockets = 25,
cells = 100,
respawntime = 10,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
notallowedmsg = "#FF_NOTALLOWEDPACK",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue, AllowFlags.kRed}
})

function astipack:dropatspawn() return false
end

astigren = genericbackpack:new({
health = 50,
armor = 100,
grenades = 20,
shells = 50,
nails = 75,
rockets = 10,
cells = 100,
gren1 = 2,
gren2 = 1,
respawntime = 30,
model = "models/items/backpack/backpack.mdl",
materializesound = "Item.Materialize",
touchsound = "Backpack.Touch",
notallowedmsg = "#FF_NOTALLOWEDPACK",
touchflags = {AllowFlags.kOnlyPlayers,AllowFlags.kBlue, AllowFlags.kRed}
})
if dispensed >= 1 then
BroadCastMessageToPlayer( player, "Got grenades!" )
local backpack = CastToInfoScript(entity);
if (backpack ~= nil) then
backpack:EmitSound(self.touchsound);
backpack:Respawn(self.respawntime);
end
end

function astigren:dropatspawn() return false
end

-----------------------------------------------------------------------------
-- respawn turrets
-----------------------------------------------------------------------------
turret_a = base_respawnturret:new({ team = Attackers })
turret_d = base_respawnturret:new({ team = Defenders })
aleXtric is offline   Reply With Quote


Old 01-15-2012, 10:49 PM   #2
Crazycarl
D&A Member
Wiki Team
Fortress Forever Staff
 
Crazycarl's Avatar
 
Join Date: Apr 2007
Posts Rated Helpful 31 Times
Add this anywhere, except inside an existing function

Code:
-- Give everyone a full resupply, but strip secondary grenades
function player_spawn( player_entity )
	local player = CastToPlayer( player_entity )

	player:AddHealth( 100 )
	player:AddArmor( 300 )

	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:AddAmmo( Ammo.kManCannon, 1 )

	if player:GetClass() ~= Player.kScout and player:GetClass() ~= Player.kMedic then
                player:RemoveAmmo( Ammo.kGren2, 4 )
        end
	
	if player:GetTeamId() == attackers then
		UpdateObjectiveIcon( player, ATTACKERS_OBJECTIVE_ENTITY )
	elseif player:GetTeamId() == defenders then
		UpdateObjectiveIcon( player, DEFENDERS_OBJECTIVE_ENTITY )
	end
end
Not tested, but that should do it.
__________________
Support FF:

Last edited by Crazycarl; 01-15-2012 at 10:59 PM.
Crazycarl is offline   Reply With Quote


Old 01-17-2012, 12:32 AM   #3
aleXtric
#FF.Pickup Dictator
Beta Tester
 
Join Date: Aug 2011
Location: Detroit
Gametype: ADL
Affiliations: KiNGz .
Posts Rated Helpful 100 Times
that didnt work:/
aleXtric is offline   Reply With Quote


Old 01-17-2012, 12:57 AM   #4
Crazycarl
D&A Member
Wiki Team
Fortress Forever Staff
 
Crazycarl's Avatar
 
Join Date: Apr 2007
Posts Rated Helpful 31 Times
Squeeeeek!
__________________
Support FF:
Crazycarl is offline   Reply With Quote


Old 01-17-2012, 03:29 AM   #5
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.
Time to get fancy!

Add this to any part of the lua (very bottom would work):

Code:
-- save all the functions in a table with the same name as the Lua file
-- so we don't accidentally overwrite any saved functions in other files
local ff_asti_beta = {}

-- save the function in the table
ff_asti_beta.player_spawn = player_spawn

function player_spawn( player )
	-- check to make sure the saved function is actually a function
	if type(ff_asti_beta.player_spawn) == "function" then
		-- call the saved function
		ff_asti_beta.player_spawn( player )
	end
	
	if IsPlayer( player ) then
		local player = CastToPlayer( player )
		if player:GetClass() == Player.kScout then
			player:AddAmmo( Ammo.kGren2, 3 )
		elseif player:GetClass() == Player.kMedic then
			player:AddAmmo( Ammo.kGren2, 2 )
		end
	end
end
This'll give medics 2 concs on spawn and scouts 3 and it doesn't overwrite the base_id player_spawn function, it just adds to it. I tested it and it should be working.
__________________
#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 01-17-2012, 03:30 AM   #6
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.
Crazycarl's solution works just as well, by the way. Don't know what you did wrong. Make sure to reload the map after you upload the new lua (ff_restartround works too).
__________________
#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.; 01-17-2012 at 03:31 AM.
squeek. is offline   Reply With Quote


Reply


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

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 02:49 PM.


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