Script question (flag spawn capture)


(TNR360) #1

Ok lets say I have 2 flags.

Axis start holding both flags (done, easy)

Allies capture first flag. (done, easy)

*Allies capture second flag

Thats where I’m stuck, when allies get the second flag I want game to check time remaining. if allies have the 2 flags captured I don’t want them to win until the Round ends.


(DerSaidin) #2

When they’re both captured change wm_setwinner.

Don’t do a wm_endround as part of the capture script.


(TNR360) #3

So by just using set winner it will not end the round?

If I defaulted all objectives to axis then that means they will win if allies do not hold both objectives?


(Nail) #4

Please don’t flame if this is wrong, just say it’s wrong
This is purely guesswork, but I’ve been trying to understand a lot of how things work just by reading questions and answers in these forums, I haven’t tried any of this as I wanted to see if I could even understand the terminology, but here’s my guess (sorry to intrude on your thread)

if you remove the wm_endround from where it is (my thinking says after 2nd capture) and use wm_setwinner <*allies> making sure it reverts if 2nd flag is recaptured by axis and use wm_endround <*whatever time> after capture part ???

sorry, more of a question for the guys who know, than an answer to your question, and I do apologize (wouldn’t mind someone pm me what I got wrong tho)

  • no idea how to write it correctly

(TNR360) #5

hey no problem

I am a total noob to scripting and this is my first attempt to write one on my own… that meaning Im trying to copy as little as possible


(Nail) #6

didn’t mean you for the flame part, ppl get a little snide at times (as my deleted posts will attest, sorry again guys, I get animated at times :shock: )
but I would like to know if I was close


(TNR360) #7

Ok by using trigger check objective status it makes allies winner

does this mean it stops checking?

or should it keep checking the objective status to see if there was a change?

is it possible?


(Nail) #8

I know WAY less than you about this stuff, like I said, mine was more of a question for the talented people who actually know, than an answer to your question, I just thought I could piggy-back my question on yours, if you think it interferes, I’m sure my comments could be removed


(TNR360) #9

chill man I could use anything to learn right now :slight_smile:

your question does not bother me at all and it shouldn’t bother anyone else

my question is also directed towards others

no worries


(Ifurita) #10

Not entirely sure what you want to do? Is the allied win condition that they hold both flags when time runs out? if so, just use an accum that increments by 1 when captured by Allied and inc -1 when captured by axis. When the game time ends, it checks if accum = 2 therefore allied win else axis win.


(TNR360) #11

sounds easy enough

and what I want to do…

It’s a territory capture based map for a mod.


(Ifurita) #12

Look for an old conversion that I did called breakout_et_b1. In that one, each side had to destroy a main objective and be in control of 3 of 4 flags. The script in there should be easy enough to follow.


(Erls) #13

I wanna make sure I understand your question… You want to know how to program the script so after the allies capture both flag the game does not end until time runs out, however when that happens allies win? If thats correct, what about:

Create a third flag, however make it in a unreachable spot, guaranteeing that the flag will never be captured. When the map ends, set it where the winning team is the one which controls the most flags, meaning the allies will win if they control 2/3 flags.

I might be off, just a possible easy solution.


(TNR360) #14

I cant seem to find beta 1 of breakout

I played it before though … very nice map


(Ifurita) #15

Here’s what I think the script would look like – working from a very shoddy memory, haven’t done any scripting in more than 2 years.

This would just (for one flag) increment a counter (globalaccum 1) by 1 every time the allies capture a flag and decrement it by 1 whenever the axis capture a flag, and then call a subroutine to adjust the wm_setwinner if the number of flags under allied control is the right number.


//Objective counter and game win check scripts

	trigger winstatus  //Completion of Allied objectives
        {
                GLOBALACCUM 1 ABORT_IF_EQUAL 0
                WM_SETWINNER 1
     	}

and the following is a fairly standard forward spawn script with my changes added in CAPS


forward_spawn
{
	spawn
	{
		wait 200
		accum 0 set 0 // Who has the flag: 0-Axis, 1-Allied
	}

	trigger axis_capture
	{

		accum 0 abort_if_equal 0
		accum 0 set 0

                                GLOBALACCUM 1 INC -1
                                TRIGGER GAME_MANAGER WINSTATUS

		// Change the objective state internally, so UI can update, etc.
		// Axis takes control of forward flag

		// Some kind of UI pop-up to alert players
		wm_announce	"Axis capture the Forward spawn!"

		wm_objective_status	8 1 2
		wm_objective_status	8 0 1

		alertentity forwardflag_wobj

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "rommel_axis_bunker_reclaimed"

		wm_teamvoiceannounce 1 "rommel_allies_bunker_reclaimed"
		// *---------------------------------------------------------------------------------*
	}

	trigger allied_capture
	{

		accum 0 abort_if_equal 1
		accum 0 set 1

                                GLOBALACCUM 1 INC 1
                                TRIGGER GAME_MANAGER WINSTATUS

		// Change the objective state internally, so UI can update, etc.
		// Allied takes control of forward flag

		// Some kind of UI pop-up to alert players
		wm_announce	"Allies capture the Forward spawn!"

		wm_objective_status	8 1 1
		wm_objective_status	8 0 2

		alertentity forwardflag_wobj

		// *----------------------------------- vo ------------------------------------------*
		wm_teamvoiceannounce 0 "rommel_axis_bunker_captured"

		wm_teamvoiceannounce 1 "rommel_allies_bunker_captured"
		// *---------------------------------------------------------------------------------*
	}

}