Fortress Forever

Go Back   Fortress Forever > Editing > Mapping > Lua

Reply
 
Thread Tools Display Modes
Old 03-07-2010, 02:48 AM   #1
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
Teamspawns won't work.

I have a collection which I will store players names in as the game progresses. I have two spawns for each team. One spawn is a regular spawn and the other is a special spawn. They work so that if you're in the collection, you spawn in the special spawn. If you're not in the collection, you default to the regular spawn. Here's the code:

Code:
acollection = Collection()

regularspawn = info_ff_teamspawn:New({})
specialspawn = info_ff_teamspawn:New({})

function regularspawn:validspawn(spawn, player)
	if(acollection:HasItem(player)) then
		return false
	end
	return true
end

function specialspawn:validspawn(spawn, player)
	if(acollection:HasItem(player)) then
		return true
	end
	return false
end
Now, there's a problem with that. Whenever I join my map, it will automatically drop me at a random spawn. Sometimes it drops me at spawns that are named regularspawn and sometimes it drops me at specialspawns, despite not being in the collection. It seems to completely ignore the code. I can pepper the functions with ConsoleToAll('...') for debugging, but every spawn, I don't get any message in my console. Any clue why? Am I typing something incorrectly? I am legitimately stumped.
Bridget is offline   Reply With Quote


Old 03-07-2010, 03:41 AM   #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.
1) new({}) might need to be lowercase.
2) You need to add the functions as "members" of the spawns.
3) Name the variable that holds the function "validspawn"

I forget exactly how to reference a function, but it might be something like this:
Code:
specialspawn = info_ff_teamspawn:new({ validspawn = specialspawn:validspawn })
This is how spawns are usually done:
Code:
spawn_thing = info_ff_teamspawn:new({ validspawn = function(self,player)
	if condition then
		return true
	end
	return false
end })
__________________
#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.; 03-07-2010 at 03:43 AM.
squeek. is offline   Reply With Quote


Old 03-07-2010, 03:05 PM   #3
Bridget
Banned
 
Bridget's Avatar
 
Join Date: Sep 2008
Class/Position: Soldier
Gametype: AVD
Affiliations: TALOS
Posts Rated Helpful 5 Times
I tried both referencing (it requires parenthesizes) and the following. The spawns are correctly named in Valve Hammer, yet the game completely ignores the coding for spawns and places the player at random. I don't get any ConsoleToAll returns.
Code:
SpecialSpawn = info_ff_teamspawn:new({ validspawn = function(self, player)
	ConsoleToAll('SpecialSpawn call')
	if(acollection:HasItem(player)) then
		return true
	end
	return false
end })
Bridget is offline   Reply With Quote


Old 03-07-2010, 07:47 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.
Try moving it up to the top of the lua or something. Sometimes certain lua errors don't report in the console but will nullify any code below them.
__________________
#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)
 

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:50 AM.


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