Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 05-31-2010, 09:16 PM   #1
moosh
WhenNailGrenWillOut?
Beta Tester
 
moosh's Avatar
 
Join Date: May 2009
Gametype: mp_prematch
Affiliations: [:)] - Frag Happy, babe|
Posts Rated Helpful 29 Times
Removing concs

Basically what I want to do is that in the map medics and scouts spawn with no concs and when they cap a flag I want them to not gain any concs.

I know nothing about lua so I could use some help.
__________________
[[ ff_hotfudge - bhop_theonlyone ]]
"As the the new year approaches I await for it like an case of explosive fecalomania otherwise know as diareha or the massive shits. I am gripping the sides of the toilet as my stomach produces the first hollow thud out of the anus of the year to come." DarkeN_HellspawN
moosh is offline   Reply With Quote


Old 05-31-2010, 09:58 PM   #2
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.
Remove concs on spawn:
Code:
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 ) 

   if player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic then
      player:RemoveAmmo( Ammo.kGren2, 4 )
   end
end
Hmm.. for the not giving concs on cap... try this:
Code:
local basecap:oncapture_base = basecap:oncapture
function basecap:oncapture(player, item)
	basecap:oncapture_base( player, item )
	
	if player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic then player:RemoveAmmo( Ammo.kGren2, 4 ) end
end
I haven't tested either of them, but hopefully they work. The second one is particularly experimental because the "traditional" method of doing it would be to overwrite basecap:ontrigger which is not a good idea.
__________________
#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.; 05-31-2010 at 10:04 PM.
squeek. is offline   Reply With Quote


Old 06-01-2010, 06:03 PM   #3
moosh
WhenNailGrenWillOut?
Beta Tester
 
moosh's Avatar
 
Join Date: May 2009
Gametype: mp_prematch
Affiliations: [:)] - Frag Happy, babe|
Posts Rated Helpful 29 Times
It gives me a lua error on this line.

Code:
local basecap:oncapture_base = basecap:oncapture
It says unexpected symbol near ':'.
__________________
[[ ff_hotfudge - bhop_theonlyone ]]
"As the the new year approaches I await for it like an case of explosive fecalomania otherwise know as diareha or the massive shits. I am gripping the sides of the toilet as my stomach produces the first hollow thud out of the anus of the year to come." DarkeN_HellspawN
moosh is offline   Reply With Quote


Old 06-01-2010, 09:09 PM   #4
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.
Yeah I'm not sure that method will work after all...

Hm.
__________________
#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-01-2010, 10:00 PM   #5
moosh
WhenNailGrenWillOut?
Beta Tester
 
moosh's Avatar
 
Join Date: May 2009
Gametype: mp_prematch
Affiliations: [:)] - Frag Happy, babe|
Posts Rated Helpful 29 Times
Maybe I can do something with triggers? For example scout caps the flag,gets the nades and the trigger takes them away. I would need a specific trigger that would only work for medics and scouts though.
__________________
[[ ff_hotfudge - bhop_theonlyone ]]
"As the the new year approaches I await for it like an case of explosive fecalomania otherwise know as diareha or the massive shits. I am gripping the sides of the toilet as my stomach produces the first hollow thud out of the anus of the year to come." DarkeN_HellspawN

Last edited by moosh; 06-01-2010 at 10:00 PM.
moosh is offline   Reply With Quote


Old 06-01-2010, 10:27 PM   #6
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
ya, I was gonna suggest that. Just put a trigger around the cap trigger and when the player stops touching it remove conc's
__________________
(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 06-02-2010, 01:24 AM   #7
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
Nevermind, I thought you only wanted no concs on Medics or Scouts when they captured. Considering you want no concs at all, that trigger would be fine.

Code:
conc_remover = trigger_ff_script:new({})

function conc_remover:ontrigger(allowed_entity)
	if IsPlayer(allowed_entity) then
		local player = CastToPlayer(allowed_entity)
		if player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic then
			player:RemoveAmmo(Ammo.kGren2, 4)
		end
	end
end

Last edited by Bridget; 06-02-2010 at 01:28 AM.
Bridget is offline   Reply With Quote


Old 06-02-2010, 08:03 PM   #8
moosh
WhenNailGrenWillOut?
Beta Tester
 
moosh's Avatar
 
Join Date: May 2009
Gametype: mp_prematch
Affiliations: [:)] - Frag Happy, babe|
Posts Rated Helpful 29 Times
Quote:
Originally Posted by Bridget View Post
Nevermind, I thought you only wanted no concs on Medics or Scouts when they captured. Considering you want no concs at all, that trigger would be fine.

Code:
conc_remover = trigger_ff_script:new({})

function conc_remover:ontrigger(allowed_entity)
	if IsPlayer(allowed_entity) then
		local player = CastToPlayer(allowed_entity)
		if player:GetClass() == Player.kScout or player:GetClass() == Player.kMedic then
			player:RemoveAmmo(Ammo.kGren2, 4)
		end
	end
end
Thanks Bridget, it works great .
__________________
[[ ff_hotfudge - bhop_theonlyone ]]
"As the the new year approaches I await for it like an case of explosive fecalomania otherwise know as diareha or the massive shits. I am gripping the sides of the toilet as my stomach produces the first hollow thud out of the anus of the year to come." DarkeN_HellspawN
moosh is offline   Reply With Quote


Old 06-03-2010, 01:28 AM   #9
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
Note OnTrigger() constantly gets called when they're inside the trigger brush. I figured it would be better than OnTouch() or OnEndTouch() because people could still throw a conc outside of the brush while being inside of it, leave the brush, have their concs disappear, but get a boost off the dropped one.
Bridget is offline   Reply With Quote


Old 06-04-2010, 02:21 AM   #10
Dexter
internet user
Fortress Forever Staff
 
Dexter's Avatar
 
Join Date: Jun 2007
Posts Rated Helpful 42 Times
why not just remove all grenade2 on caps? screw spamming them anyway

Code:
yourmap_cap = basecap:new ( {
gren2 = 0,
})

red_cap = yourmap_cap:new( { team = Team.kRed, item = {"blue_flag","yellow_flag","green_flag"}})
   
blue_cap = bases_cap:new({team = Team.kBlue, item = {"red_flag","yellow_flag","green_flag"}})

Last edited by Dexter; 06-04-2010 at 02:21 AM. Reason: whitespace wooohonk
Dexter is offline   Reply With Quote


Old 06-05-2010, 02:02 AM   #11
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:
Originally Posted by Bridget View Post
Note OnTrigger() constantly gets called when they're inside the trigger brush. I figured it would be better than OnTouch() or OnEndTouch() because people could still throw a conc outside of the brush while being inside of it, leave the brush, have their concs disappear, but get a boost off the dropped one.
yeah, I was thinking OnEndTouch() would be better. Simple fix for what your saying would be another brush with a no conc zone, but either way works tbh.
__________________
(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 06-05-2010, 03:26 AM   #12
cjeshjoir™
1-800-UNAGIPOWA
 
cjeshjoir™'s Avatar
 
Join Date: Nov 2009
Location: California, USA
Gametype: AvD, Spirit of TFC
Affiliations: ™.AvD
Posts Rated Helpful 0 Times
Send a message via AIM to cjeshjoir™ Send a message via Skype™ to cjeshjoir™
Somewhere in the LUA controls where and when players get grenades, right?

Why not override that instead of making a trigger?
__________________

" In my opinion the testing team isn't really made for or of public players, it's made for competative players... " ¹ -Scuzzy (post# 462713)

Last edited by cjeshjoir™; 06-05-2010 at 03:26 AM.
cjeshjoir™ is offline   Reply With Quote


Old 06-05-2010, 03:27 AM   #13
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:
Originally Posted by cjeshjoir View Post
Somewhere in the LUA controls where and when players get grenades, right?

Why not override that instead of making a trigger?
b/c it's done in like a million seperate places and you would have to code 10x more to counter it than just making the trigger.
__________________
(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 06-05-2010, 06:33 AM   #14
Dexter
internet user
Fortress Forever Staff
 
Dexter's Avatar
 
Join Date: Jun 2007
Posts Rated Helpful 42 Times
Quote:
Originally Posted by Dr.Satan View Post
b/c it's done in like a million seperate places and you would have to code 10x more to counter it than just making the trigger.
ya. spawn, bags, caps etc. you would have to check player class too and it'd run on every entity so it'd end up being way more overhead
Dexter 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 09:33 PM.


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