Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 06-19-2010, 12:30 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
Making players not suicide when changing class?

I would like to have a trigger area where players would not die when changing class. I'd like them to just spawn as the class they've chosen since it's kind of gay dying in spawn just because you want to change your class.
__________________
[[ 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-19-2010, 04:31 PM   #2
Iggy
Heartless Threadkiller
Beta Tester
Forum Moderator
 
Iggy's Avatar
 
Join Date: Apr 2007
Class/Position: D-Solly / O-Medic
Gametype: CTF
Affiliations: [AE] AssEaters
Posts Rated Helpful 42 Times
You could just turn off "Immediate Class Change" in your settings...
__________________
Quote:
Originally Posted by zSilver_Fox
See kids? Only Iggy and FT are good enough to post when high.
Publishers Website My book on BN.com My book on Amazon.com

Friend me on Facebook
Follow me on Twitter
Iggy is offline   Reply With Quote


Old 06-19-2010, 05:28 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
Quote:
Originally Posted by Iggy View Post
You could just turn off "Immediate Class Change" in your settings...
But then I'd have to die to change my class.
What I want to do is not have a death penalty for changing class in your spawnroom.
__________________
[[ 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-19-2010 at 05:29 PM.
moosh is offline   Reply With Quote


Old 06-19-2010, 08:27 PM   #4
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
It can't be done manually with Lua (there's no switchclass() callback) until the development team hardcodes no suicides and instant class switching in spawns. However, ApplyToPlayer() can change people's team and class without a respawn or a suicide. You can make some brushes that change people to specific classes when they touch them. Unfortunately, that means taking up a lot of room in or around your spawn. I tested some of the following code (which probably sucks dick) and it works out if the class you're trying to switch to is enabled for your team with SetClassLimit().

Code:
baseClassChanger = trigger_ff_script:new({switchClass='class_name_here'})

scoutClassChanger = baseClassChanger:new({switchClass='Scout'})
sniperClassChanger = baseClassChanger:new({switchClass='Sniper'})
soldierClassChanger = baseClassChanger:new({switchClass='Soldier'})
demomanClassChanger = baseClassChanger:new({switchClass='Demoman'})
medicClassChanger = baseClassChanger:new({switchClass='Medic'})
hwguyClassChanger = baseClassChanger:new({switchClass='HWGuy'})
pyroClassChanger = baseClassChanger:new({switchClass='Pyro'})
spyClassChanger = baseClassChanger:new({switchClass='Spy'})
engineerClassChanger = baseClassChanger:new({switchClass='Engineer'})
civilianClassChanger = baseClassChanger:new({switchClass='Civilian'})


function baseClassChanger:ontouch(touch_entity)
	if IsPlayer(touch_entity) then
		local player = CastToPlayer(touch_entity)
		if self.switchClass == 'Scout' then
			ApplyToPlayer(player,{AT.kChangeClassScout})
		elseif self.switchClass == 'Sniper' then
			ApplyToPlayer(player,{AT.kChangeClassSniper})
		elseif self.switchClass == 'Soldier' then
			ApplyToPlayer(player,{AT.kChangeClassSoldier})
		elseif self.switchClass == 'Demoman' then
			ApplyToPlayer(player,{AT.kChangeClassDemoman})
		elseif self.switchClass == 'Medic' then
			ApplyToPlayer(player,{AT.kChangeClassMedic})
		elseif self.switchClass == 'HWGuy' then
			ApplyToPlayer(player,{AT.kChangeClassHWGuy})
		elseif self.switchClass == 'Pyro' then
			ApplyToPlayer(player,{AT.kChangeClassPyro})
		elseif self.switchClass == 'Spy' then
			ApplyToPlayer(player,{AT.kChangeClassSpy})
		elseif self.switchClass == 'Engineer' then
			ApplyToPlayer(player,{AT.kChangeClassEngineer})
		elseif self.switchClass == 'Civilian' then
			ApplyToPlayer(player,{AT.kChangeClassCivilian})
		else
			ApplyToPlayer(player,{AT.kChangeClassRandom})
		end
	end
end

Last edited by Bridget; 06-19-2010 at 08:39 PM.
Bridget is offline   Reply With Quote


Old 06-19-2010, 08:29 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
Quote:
Originally Posted by Bridget View Post
It can't be done manually with Lua (there's no switchclass() callback) until the development team hardcodes no suicides and instant class switching in spawns. However, ApplyToPlayer() can change people's team and class without a respawn or a suicide. You can make some brushes that change people to specific classes when they touch them. Unfortunately, that means taking up a lot of room in or around your spawn. I wrote up some code for this, but it doesn't seem to work, and I am too lazy to figure out why.
Oh well. Thanks for trying 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
moosh is offline   Reply With Quote


Old 06-19-2010, 08:40 PM   #6
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
Since edits don't update the thread, look above for (bad) workaround.
Bridget 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 04:11 PM.


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