Game logic questions - help please

Riever

L2: Junior Member
Nov 25, 2011
86
4
Dear all,

I started my 1st large map last year, real life got in the way and I had to stop. I'm now picking it up again and have a couple of problems with the logic. Hope someone can help.

The map is a hybrid KOH and CTF and I am having to write a lot of the logic manually as a result. I'm not sure if Valved added any logic for the new Doomsday map (its combined PL and CTF) - has anyone looked into this? I might be able to grab some logic to make my life easier.

There is one neutral flag which the teams fight over to get back to their own holding area. If they drop it it stays neutral so can be grabbed by the other team without any wait.

If a team gets the flag to their hold zone then a KOH clock starts. It stops if the other team removes the flag from this zone.

There is an end round whereby the team who gets their KOH clock to zero 1st has to take the flag to a final capture point - I had to add this as I could not get the CF and KOH logic to mesh any other way. The game currently stalemates if they fail to do so in a set time. (I don't like this but can't work out how else to mesh the two logics)

There are 3 rounds per game and the hold zone moves around the map depending on the teams score. Two zones exist throughout the game and a 3rd appears if a team gets 2 captures.

Only one zone per team is active at a time.

The main timer is TF_logic_koth
TF_gamerule has the Hud set to CTF HUD

My problems.

1. I have a short delay at the start of the round to allow medics to work on their uber charge. Im using team_round _timer to announce 'Mission begins in 10 seconds' via the OnSetupStart output. Thing is the announcement also plays if the server is set to wait for players. So you get a waiting for players clock at 30 seconds and the announcement 'Mission begins in 10 seconds' - which is daft. How do I stop the announcement playing during the waiting for players section.

2. I have a couple of wondering ghosts. These scare the players and I want them to drop the intel if they are scared. I thought I could use func_flag_alert and the outputs OnTriggered to force the fag to drop - but you cannot parent func_flag_alert to a truck. Is there a way to do this? I only want the intel to drop if the intel carrier is scared.

3. Can someone point me at a better way of ending the round if the main game timer expires other than stalemate - I'd like to switch to sudden death but it refuses to work, possibly as I'm having to do a lot of manual logic. How should you set sudden death in a normal map?

4. The 3rd capture point is a 1950's style flying saucer which will hover over the map. This however should cast a shadow and does not. It's a set of func_brush's parented with a point_template. As it only appears if one of the teams has succeeded in two captures and since the lighting is set during render time I've no idae how to get it to cast a shadow. Is this even possible?

Thanks in hope.

J.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
1. Are you manually playing the announcement? I thought the timer did it by itself, and the game withheld such things from occurring during waitingforplayers. I can't remember at the moment what the workaround for waitingforplayers was, I'll post again if I do.

2. You should be able to parent a func_flag_alert, but if they went and broke that then there is another solution.

Make a filter_activator_name
name: filter_carrier
filter name: carrier

Make a trigger_multiple the same size as your trigger_stun, and parent it to the stuff.
Set the filter key to filter_carrier and add the output:
OnStartTouch > [name of flag] > ForceDrop

On the flag add the following outputs:
Output|Target|Input|Parameter
OnPickup|!activator|AddOutput|targetname carrier
OnDrop|carrier|AddOutput|targetname notcarrier
OnCapture|carrier|AddOutput|targetname notcarrier


3. Stalemate vs sudden death is controlled by the server. You can't specify which is used.

4. The only brushes that cast dynamic shadows are func_physbox (and func_physbox_multiplayer). So you'd need to use those, and then mess around with constraints and freezing them in the air. Depending on the height though, the shadows may not reach anyway.
 

Riever

L2: Junior Member
Nov 25, 2011
86
4
Hi,

Thank you for this, it's really useful.

1 Yes I am playing the announcement manually. I can't remember why I turned the auto announcements off, may be they were conflicting with the actual objectives, I didn't know that the waiting for players part would trigger them. Any help with the workaround would be great. the only one I have come up with is to fire a separate timer on the game start which acts as the delay and then fire the spawn door unlocks etc off that.

2. Great! Will give this a go.

3. So setting OnMapSpawn -> gamerules -> SetStalemateOnTimelimit = 1 can be overridden?
That might be a problem, standard sudden death does not work very well on my map. I can't use func_capturezone in the hold points since these increment the team score on cap automatically and I want to do this after the teams clock hits zero. So I'm using func_flag_alert to start the KOH timers. There's a hidden func_capturezone below this so that the hud works but players cant get to it. To end a round - and increment the number of captures - I've added a final push where the team who zeros their clock takes the intel to another place (I couldn't figure out how to just increment the number of captures manually). This last zone is a func_capture zone but it's only active when one team's clock hits zero. If the server is set to sudden death and this happens before the last point is active then there is no way for either team to win. The capture point won't be active for them to capture.

I'm currently working on an idea where a team with the lowest clock is rewarded by a time reduction if no-one wins, perhaps making this a big reduction if they have zeroed their clock but not made the final capture. I've no idea how this will work on a server set for sudden_death and I guess I may have to wait and see how much of a problem sudden death is on play tests?

4. Hmmm this sounds messy for an esthetic item like a shadow. I'm also wondering if such a large set of brushes (Will probably end up a proper model) will tank the frame rates. Might just end up with 'hey it's a flying saucer - flying saucers don't create shadows 'cos they are not of this world.' A kludge but at least one that won't kill fps. Any thoughts?

Once again thank you for such helpful advice.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
SetStalemateOnTimelimit is not what you think it is, I believe. When that is enabled, it causes the round to end when the server's map rotation time (mp_timelimit) is up. So stuff like 5CP maps that reset to 10 minutes round time won't go on literally forever. It has no bearing on the whether stalemate or sudden death occurs, like I said, that's a server preference.

...I can't wrap my head around your game mode for further advice. I'll try again in the morning. Probably too tired.
 

Riever

L2: Junior Member
Nov 25, 2011
86
4
!activator not implemented?

HI Boojum,

Unfortunatly I have hit a snag in using the !activator entity in TF2 as suggested in your post on the ghosts. The idea works fine without the filter and the player drops the intel. However I obviously need it with the filter, and this does not work. A developer 2 trace shows the following on intel pickup

(172.07) output: (item_teamflag,captureflag_Neutral) -> (!activator ,AddOutput)(carrier)
(172.07) output: (item_teamflag,captureflag_Neutral) -> (Intel_Red_Pickup_branch,Test)()
(172.07) output: (item_teamflag,captureflag_Neutral) -> (blu_score,GetValue,0.2)()
Invalid entity search name !activator
unhandled input: (AddOutput) -> (!activator ), from (item_teamflag,captureflag_Neutral); target entity not found

And on intel drop

(112.26) output: (item_teamflag,captureflag_Neutral) -> (carrier,AddOutput)(notcarrier)
(112.26) output: (item_teamflag,captureflag_Neutral) -> (Captureflag_drop_flag,GetValue)()
(112.26) output: (item_teamflag,captureflag_Neutral) -> (Captureflag_pickup_flag,GetValue)()
unhandled input: (AddOutput) -> (carrier), from (item_teamflag,captureflag_Neutral); target entity not found

It looks like !activator is not implemented in tf2? Or am I missing something blindingly obvious?

Hope you or someone else can help.
 

Riever

L2: Junior Member
Nov 25, 2011
86
4
Hi,

Oops! Yes I did (I copied from your post to make sure I didn't misstype and didn't spot these)

Sadly I still have problems. Developer 2 is showing this on pickup.

(71.01) output: (item_teamflag,captureflag_Neutral) -> (!activator,AddOutput)(targetname carrier)
(71.01) output: (item_teamflag,captureflag_Neutral) -> (blu_score,GetValue,0.2)()
(71.01) output: (item_teamflag,captureflag_Neutral) -> (Intel_Red_Pickup_branch,Test)()
(71.01) input captureflag_Neutral: captureflag_Neutral.AddOutput(targetname carrier)
(71.01) output: (logic_branch,Intel_Red_Pickup_branch) -> (Red_Koth_count_sub_flag,SetValueNoFire)(0)
(71.01) input carrier: Intel_Red_Pickup_branch.Test()
(71.01) output: (logic_branch,Intel_Red_Pickup_branch) -> (zz_red_koth_timer,Pause)()
(71.01) input Intel_Red_Pickup_branch: Red_Koth_count_sub_flag.SetValueNoFire(0)
(71.01) input Intel_Red_Pickup_branch: zz_red_koth_timer.Pause()
(71.22) input carrier: blu_score.GetValue()
(71.22) output: (item_teamflag,carrier) -> (Spawn_Saucer_Check,InValue)()
(71.22) output: (item_teamflag,carrier) -> (Cap_Setup_blu_counter,SetValueNoFire)()
(71.22) output: (item_teamflag,carrier) -> (Intel_pickup_announcements_blu,InValue)()

It looks like the intel is being renamed, rather than the player - should it?

If I disconnect the filter on the ghost trigger I get this in the trace when the ghost touches the player

(155.47) output: (trigger_multiple,Red_ghost_drop_intel_zone) -> (captureflag_Neutral,ForceDrop)()
unhandled input: (ForceDrop) -> (captureflag_Neutral), from (trigger_multiple,Red_ghost_drop_intel_zone); target entity not found

and if I add an output on_trigger-> carrier->forcedrop then the player does drop the intel.

Thing is I thought that the intel gets ignored whlie it's carried - doesn't trigger anything - and thus the filter is picking up the player id and not the name of the intel

Sorry I'm confused.

Would it work if I parented a trigger to the intel so that this named the !activator (player) rather than naming the intel, or have I missed the obvious again?

Huge thanks in advance.
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
Would it work if I parented a trigger to the intel so that this named the !activator (player) rather than naming the intel, or have I missed the obvious again?
Yes. I guess I forgot that !activator doesn't work properly with the intel. You'll have to parent a trigger to it instead for naming the player. Just make sure you disable the trigger on pickup, and enable it on drop/capture. Everything else should work ok once you move the "carrier" naming input off the intel.

(side note: did you see I replied to your other thread too? You haven't said anything there.)
 

Riever

L2: Junior Member
Nov 25, 2011
86
4
Many thanks I'll look into this.

Do you know if a parented item dies if you kill the parent? I kill and respawn the intel into the team's hold zones so it automatically returns there rather than the start point. The ideal for me would be if the trigger on the intel does not die when I kill the intel but becomes an orphan and then reparents itself automatically when the intel respawns.

(side note: did you see I replied to your other thread too? You haven't said anything there.)

Sorry, No I have not had a chance, and having seen the reply I wish I had done so as it's very detailed and ideal for the problem. Will probably take me a while to work though so I understand it. So thank you for all your work on both threads.
 
Last edited:

Riever

L2: Junior Member
Nov 25, 2011
86
4
Hi Boojum,

Pleased to say the ghosts now make players drop the intel, so thank you for all the advice. It would be nice if I could prevent them from picking it up whilst scared but at present I'm unsure how to do so.

I initially thought about changing the trigger so that it had !activator->addoutput->targetname scarred ontouch but then got stuck how to reset this. A timer would not work since multiple players could be scarred at the same time. Do you know if delays on entities are stacked? If they are then I could use

!activator->addoutput->targetname scarred ontouch 0 delay
!activator->addoutput->targetname notcarrier ontouch 5sec delay

So player1 gets scarred, drops the intel, gets named as scarred for 5 seconds then player2 gets scared, named as scared and also has a 5 second delay (which would run concurrently with player1's)

If, as I suspect, any delays are reset each time a trigger is, erm, triggered, then it won't

Hmmm, not sure I've explained this very well..
 

A Boojum Snark

Toraipoddodezain Mazahabado
aa
Nov 2, 2007
4,775
7,669
You should be able to just add a delay to the notcarrier output, but that won't actually stop them from picking it up. But the end result will be the same in that they pick it up (the flag is not, and can not, be filtered) and then immediately drop it if they are still within the trigger.