Fortress Forever

Fortress Forever (https://forums.fortress-forever.com/index.php)
-   Mapping (https://forums.fortress-forever.com/forumdisplay.php?f=13)
-   -   Multiple Respawns (https://forums.fortress-forever.com/showthread.php?t=20126)

VEXEMP 07-17-2009 12:16 AM

Multiple Respawns help
 
Hello;

I'm working on a remake of K_thegame an escape style map.
I'm having trouble with creating triggerd respawns.

In the original tfc k_thegame,When you join the game you respawn.In a dark room while being inerigated.For about 30 seconds,Then you automaticly respawn into another room.Where the game starts.As you get to another level in the map.Theres a trigger that triggers a new respawn at that point.

I've tryed looking at the LUA file for dustbowl.And used some of the codes.But I just can't figure it out.

Im 90% done with the constrution of the map.But this respawn issue is important.

Any help would be great

EquilibriuM 07-17-2009 01:00 AM

woohoo K-TheGame 12pack you rock man :D

Crazycarl 07-17-2009 05:18 AM

So, should every player who enters the server spawn in the interrigation room, or does this only happen in the first 30 seconds?

Code:

--First you create a type of spawn point.
--The entity must have the same name in Hammer.
initialspawn = info_ff_teamspawn.new({})

--then create the logic to decide who can spawn there
function initialspawn:validspawn(spawn, player)
  --return true here to make the spawn available.
  --or...
  --return false here to make it off-limits.
end

The player will spawn randomly at any info_ff_teamspawn that returns true.

If you want the spawn to enable for the whole server, make a global variable, such as spawn_number = 1. Then test it inside the validspawn() function.

If you want to set valid spawn points for individual players, you will have to make a list of all players who are allowed to spawn there. Then, when a player wants to spawn, cycle through the list to see if they are there.

Dr.Satan 07-17-2009 04:52 PM

are you meaning that you want to spawn at one location first...and then IF you pass a certain point they spawn somewhere else or WHEN they pass a certain point?

If it's when then you can just do it with teleports...and logic_case(s) for multiple resups. If you need an example of that lemme know and I'll whip something up for you

If you mean like IF they pass x point then IF they die or something they spawn somewhere new then I think you would need something like this(click)

* you'll need to make a new brush based trigger at each objective point and name it resup_# starting with 0 and going sequentially up
* then name your trigger_ff_teamspawns spawn_# starting with 0 and going sequentially up

* I pretty much pulled that code outta my ass though so it's untested, but should work. Carl can you check that out and see if it's right? *

VEXEMP 07-17-2009 06:06 PM

So, should every player who enters the server spawn in the interrigation room, or does this only happen in the first 30 seconds?

This only happens in the first 30 seconds.After that the interrigation room respawn is disabled.

In this escape style map theres only 1 team and 1 class.
{team yellow} {class civillian}.

Basicly when 2 player join the map as it starts they automaticly spawn in the interrigation room,Where they cant move.And are interrigated for 30 seconds.
Then a voice says lets get out of here.Then every one automaticly spawns into the dungen room,Where the game starts.Now say a third player joins the game they will now respawn in to the dungen room.

So if a player dies,they will respawn in the dungen room.

As the players get to the next level/cargo bay room,They trigger the next respawns.In the cargo bay room.

And the dungen room respwans gets disabled,Now say a forth player joins the game they will respawn in the cargo bay room.And when a player dies they will now respawn in the cargo bay room.

I believe the spawns would be global.Once a triggerd, at a level there will only be 1 respawns that will work for the hole team.Until the next level respawns are activated.

To break it down the first respawn would use the logic entity with a timmer.
The other respwans would use a trigger.

Heres what the LUA file looks like now.




-- ff_k_thegameb1.lua

-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay");
IncludeScript("base_location");
IncludeScript("base");
-----------------------------------------------------------------------------
-- global overrides
-----------------------------------------------------------------------------









function startup()



-- set up team names
SetTeamName( Team.kBlue, "NONE" )
SetTeamName( Team.kRed, "NONE" )
SetTeamName( Team.kYellow, "NONE" )
SetTeamName( Team.kGreen, "WORKERS" )

-- set up team limits
SetPlayerLimit( Team.kBlue, -1 ) -- NONE.
SetPlayerLimit( Team.kRed, -1 ) -- NONE.
SetPlayerLimit( Team.kYellow, -1 ) -- NONE.
SetPlayerLimit( Team.kGreen, 0 ) -- THE WORKERS HAVE TO ESCAPE.

team = GetTeam( Team.kGreen )
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kSoldier, -1 )
team:SetClassLimit( Player.kDemoman, -1 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, 0 )



end

I just need to know where the code goes.

Thanks for the quick replay Crazycarl and Dr.Satan


[are you meaning that you want to spawn at one location first...and then IF you pass a certain point they spawn somewhere else or WHEN they pass a certain point?]


The respawns are for the hole team Like in dustbowl whe a team captures the flag both teams respwan to the next level.

Inthis map the team respawns in the location where it was triggerd.

Teleport will not work because of the many player would just fuse together.

I believe the original Auther made it this way because of the large area that a player would have to go through every time they died.

To have to start at the beging of the map every time they died would get boreing after a few attempts.

80% of the classis TFC escape maps use the multiple respawns.

Dr.Satan 07-17-2009 07:09 PM

Quote:

Originally Posted by VEXEMP (Post 443825)

Teleport will not work because of the many player would just fuse together.

You can make it happen with teleports and logic_case(s), but it's more entities than you need

For what you want, this should work(click)

* just make a brush based trigger named waypoint anywhere you want to change the spawn points

* name your spawns initialspawn for your first and spawn# going up sequentially, and starting with 1, for all the rest.

Sooo all together your .lua should look like this(click)

again I could be wrong, I tend to miss little shit sometimes on my .lua's, but test it out and see...or wait til Carl jumps back on and I'm sure he'll tell you if I messed up :oops:

* also when copying from privatepaste, make sure you click the copy content button FIRST or you'll get wierd shit going on there.

Crazycarl 07-18-2009 03:11 AM

Only found a few bugs in your code this time, Dr.S. :) I added a schedule for the initial 30 seconds as well as the code to respawn all players. http://privatepaste.com/691PNQIyOc

Dr.Satan 07-18-2009 02:42 PM

lol thanks Carl!

VEXEMP 07-20-2009 07:07 AM

Thanks again for the help.

Ok i tryed all the codes,And they did'nt work.

when i join the map It shows all 4 teams and i cant join any of them.So theres some conflict.This is what happend to me when i first started with the lua file.
About 100 times before i finnaly got it to work lol.

I tryed tweeking the codes.With no luck, I tryed some of the code from the base.lua file,And was able to join the map.But the respawn set up dosent work.

Im still trying to get the hang of this so bare with me.

I created 2 respawns 1 in the intergation room and 1 in the dungen.
I called the first 1 spawn0 and the other spawn1.
Then i created a trigger_ff_script brush over the ff_info_teamspawn.And called it waypoint.And gave it the output to enable the logic_case Then i added a logic_case entity and added in the first line spawn0.Im not sure if thats how its done.Considdering theres no output settings for ff_info_teamspawn entity.

I havent played k_thegame in years.So i got the bsp and tryed it.I was wrong about the triggers activateing the respawns.Buttons are what activate the new respawns.

Except for the first respawn'When you join the game.That works with some trigger and timmer multi_mannager.In the interigation room.The rest are button triggered.

Any way im standing by if youall can come up with a solution.Im stuck until i can figure this out.

Thanks.

Crazycarl 07-21-2009 05:37 AM

When you get the "all 4 teams and you can't spawn" problem, it means there's a lua error. Go into the console. You will have an error message with a line number and everything. Post that here so we can find the problem.

Actually, I just found an error in the Lua I posted. Here's a new version. http://privatepaste.com/9a0BU4YpyB

Don't put the waypoint on top of the spawns, put it at the end of the stage. Don't let any players touch the old waypoint after that stage has been beaten.

Going from a trigger to a button is easy. Where you have
Code:

waypoint = trigger_ff_script:new ({})
function waypoint:ontouch( touch_entity )
        if IsPlayer( touch_entity ) then
                -- change the global spawnnumber
                local num = spawnnumber
                local nextnum = num + 1
                spawnnumber = nextnum
                ApplyToAll({AT.kRespawnPlayers})
        end
end

Change it to:
Code:

waypoint = func_button:new ({})
function waypoint:onIn( )
        -- change the global spawnnumber
        local num = spawnnumber
        local nextnum = num + 1
        spawnnumber = nextnum
        ApplyToAll({AT.kRespawnPlayers})
end

Don't use a logic_case, and don't do anything with the playerspawns except name them. The lua script handles all the logic. In the lua Satan and I put in, there's no "spawn0". Use "initialspawn".

VEXEMP 08-06-2009 02:22 AM

The code worked.
Thanks again.
Now i can finnish this map

VEXEMP 03-29-2010 06:20 PM

Hello.

Ive been testing the map.By my self.As i fiinish the map.All the respawns have worked perfect.

But when i uploaded the map on to the public server.And tested with a few players.The respawns went random.

So i changed a few things.But the outcome is the same.

When 1 player joins.The respawns work fine.If more then 2 players join the respawns go random.

It seems the initialspawn spawn.Is the one causing the problems.

When players join the map.They respawn in a room.Where theres an interigation.For about 62 seconds.Then all players automaticly respawn to the next room.Wich is dungen/holdingroom.Where the game begins.

TRIGGERS: In the interrogation room,I have The ff_script trigger called waypoint.Which is set as disabled.And a Trigger _once.

When a player joins.They trigger the Trigger_once.Which triggers the logic_timmer1.Once the logic_timmer kicks in.It plays the sounds/lights and Enables The ff_script called waypoint.And enables logic_timmer2.

Once logic_timmer2 kickes in.It plays the next effects sounds/lights.
Then All players should respawn to the dungen.Where the respawns are called spawn1.

In the interrogation room.The respawns are called initialspawn.

LOGIC_TIMMER: In the interrogation room I have 2 logic_timmers.
loggic_timmer1 and logic_timmer2.

Also In the interrogation room.I have a playerclip brush.Holding the players from moving.


Again when 1 player joins.Everything works fine.Only when 2 or more players join.Do the respawns go random.

Heres the lua.file


-- ff_k_thegameb2.lua

-----------------------------------------------------------------------------
-- includes
-----------------------------------------------------------------------------
IncludeScript("base_teamplay");
IncludeScript("base_location");
IncludeScript("base_respawnturret")
-----------------------------------------------------------------------------
-- global overrides
-----------------------------------------------------------------------------

function startup()

--62 seconds in the interrogation room!
AddSchedule("breakout", 62, setBreakoutSpawn)


-- set up team names
SetTeamName( Team.kBlue, "NONE" )
SetTeamName( Team.kRed, "NONE" )
SetTeamName( Team.kYellow, "NONE" )
SetTeamName( Team.kGreen, "SPYS" )

-- set up team limits
SetPlayerLimit( Team.kBlue, -1 ) -- NONE.
SetPlayerLimit( Team.kRed, -1 ) -- NONE.
SetPlayerLimit( Team.kYellow, -1 ) -- NONE.
SetPlayerLimit( Team.kGreen, 0 ) -- THE SPYS HAVE TO ESCAPE.

team = GetTeam( Team.kGreen )
team:SetClassLimit( Player.kScout, -1 )
team:SetClassLimit( Player.kSniper, -1 )
team:SetClassLimit( Player.kSoldier, -1 )
team:SetClassLimit( Player.kDemoman, -1 )
team:SetClassLimit( Player.kMedic, -1 )
team:SetClassLimit( Player.kHwguy, -1 )
team:SetClassLimit( Player.kPyro, -1 )
team:SetClassLimit( Player.kSpy, -1 )
team:SetClassLimit( Player.kEngineer, -1 )
team:SetClassLimit( Player.kCivilian, 0 )

end

-- first we need a global variable
spawnnumber = 0

--then you create a type of spawn point.
--The entity must have the same name in Hammer.
initialspawn = info_ff_teamspawn:new({ num = 0 })
spawn1 = initialspawn:new({ num = 1 })
spawn2 = initialspawn:new({ num = 2 })
spawn3 = initialspawn:new({ num = 3 })
spawn4 = initialspawn:new({ num = 4 })
-- keep going sequencially
--spawn# = initialspawn:new({ num = # })

--then create the logic to decide who can spawn there
function initialspawn:validspawn(spawn, player)
local num = self.num
if spawnnumber == num then
return true
else return false
end
end

-- finally we need a trigger to change the global
--Make SURE players can't touch any waypoint they've passed before.
waypoint = trigger_ff_script:new ({})
function waypoint:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
-- change the global spawnnumber
local num = spawnnumber
local nextnum = num + 1
spawnnumber = nextnum
ApplyToAll({AT.kRespawnPlayers})
end
end

-- finally we need a trigger to change the global
--Make SURE players can't touch any waypoint they've passed before.
waypoint2 = trigger_ff_script:new ({})
function waypoint2:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
-- change the global spawnnumber
local num = spawnnumber
local nextnum = num + 1
spawnnumber = nextnum
end
end

-- finally we need a trigger to change the global
--Make SURE players can't touch any waypoint they've passed before.
waypoint3 = trigger_ff_script:new ({})
function waypoint3:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
-- change the global spawnnumber
local num = spawnnumber
local nextnum = num + 1
spawnnumber = nextnum
end
end

-- finally we need a trigger to change the global
--Make SURE players can't touch any waypoint they've passed before.
waypoint4 = trigger_ff_script:new ({})
function waypoint4:ontouch( touch_entity )
if IsPlayer( touch_entity ) then
-- change the global spawnnumber
local num = spawnnumber
local nextnum = num + 1
spawnnumber = nextnum
ApplyToAll({AT.kRespawnPlayers})
end
end


The map is 99% done. Just need to fix this respawn issue.

Thanks.

Crazycarl 03-30-2010 12:19 AM

As I posted in the LAD thread, move the spawn1...spawn4 declarations down, below the validspawn function. I can't understand why it would work by yourself, but not on the server.


All times are GMT. The time now is 04:27 AM.

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