Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 01-11-2011, 06:48 AM   #1
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
Return Gren2 after it expires

I was wondering if anyone knew how to return a player's gren2 after the one he throws or holds on to expires? I know there's _throwgren2, but what if the player doesn't throw? Also, what if the player doesn't throw immediately after priming? You wouldn't be able to time it properly. This is in an effort to combat spam by limiting the player to only one live grenade at a time.
Bridget is offline   Reply With Quote


Old 01-12-2011, 01:38 AM   #2
Crazycarl
D&A Member
Wiki Team
Fortress Forever Staff
 
Crazycarl's Avatar
 
Join Date: Apr 2007
Posts Rated Helpful 31 Times
Does player_onprimegren2( player_id ) work? I'm not sure if it's available in the current version.

onexplode() might work, too.
Crazycarl is offline   Reply With Quote


Old 01-12-2011, 02:21 AM   #3
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.
Code:
function player_onprimegren2( player_id )
	--ConsoleToAll( "[script] gren2 primed" )
	local player = GetPlayer(player_id)
end
Pretty sure player_onprimegren2 has been in for a few patches. Might just need to make a schedule that will give the player a secondary gren after 4 seconds. Could also put a player:GetAmmoCount( Ammo.kGren2 ) check in the scheduled function to make sure you never add a gren2 to a player that has a gren2, but that function is only in 2.42 and I haven't tested it with grens I don't think.

There's also this, but after thinking about it, you'd need a GetOwner() function, which isn't implemented. I'll add that and it'll be in 2.42.
Code:
catch_all = trigger_ff_script:new({})

function catch_all:onexplode( explode_entity )
	if explode_entity:GetClassName() == "ff_grenade_concussion" then
		-- need explode_entity:GetOwner() to get the player that threw the gren so we can call AddAmmo()
	end
	return EVENT_ALLOWED
end
(catch_all is a trigger_ff_script that covers the whole map with the Everything flag checked)
__________________
#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 10:58 AM.


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