Alrighty, so first of all, I urge you to check your targetname
and scriptname
fields for consistency again. They are supposed to be single string and in the files you shared it’s still targetname: blue spawn
for example, while it’s supposed to be targetname: blue_spawn
.
Anyway, let’s get into it. I tried to load the map in-game which prompted a setautospawn
error. This is related to the following two script lines:
setautospawn "capture_spawn" 1
setautospawn "capture_spawn" 0
setautospawn
is aimed at the description
key rather than the target
key in the entity.
Compare this to Siwa Oasis, where the game_manager sets the following two lines:
setautospawn "Old City" 1
setautospawn "Old City" 0
This corresponds to this:
====================================================
Another thing is to use consistent naming schemes, which I also recommended in my last post.
Your flag entity has wildly different names, while the Oasis flag has the same base name ‘oldcity’ and only further specifies with the suffix ‘flag’ and ‘spawn’.
It’s good practice to have
targetname
and
scriptname
be identical to help with clarity of the script, so you can understand what’s going on more easily.
====================================================
You then correctly target
the neutral_spawn
entities, which are all the relevant spawn entities. The team_WOLF_objective
(few images above), however, specifies default_axis
. That is alright, but it needs to be reflected by the spawn entities. So for all team_CTF_redspawn
entities with targetname: neutral_spawn
you need to specify the startactive
spawnflag as seen in the following image:
====================================================
For the scripting part, I would strongly suggest to try and use more concise routines.
This is the script you provided, let’s go through it and try to understand it.
new_spawn
{
spawn
{
accum 0 set 0
}
trigger allied_capture
{
accum 0 abort_if_equal 1
trigger new_spawn bunker_flagblue
trigger new_spawn setallies
}
trigger setallies
{
accum 0 abort_if_equal 1
accum 0 set 1
alertentity spawn
alertentity neutral_spawn
setautospawn "2nd_axis_spawn" 0
}
trigger axis_capture
{
accum 0 abort_if_equal 0
trigger new_spawn bunker_flagred
trigger new_spawn setaxis
}
trigger setaxis
{
accum 0 abort_if_equal 0
accum set 0
alertentity spawn
alertentity neutral_spawn
}
trigger blue_flagblue
{
wm_announce "allied capture the spawn"
}
trigger bunker_flagred
{
wm_announce "axis capture the spawn"
}
trigger kill
{
remove
}
trigger gone
{
accum 0 abort_if_equal 1
alertentity spawn
alertentity neutral_spawn
setautospawn "capture_apawn" 0
setautospawn "capture_spawn" 1
}
}
The spawn routine specifies things at map start when the entity spawns. On map start, however, all accums are initiated with a default value of 0, so the routine below currently is redundant and can be removed entirely. I do understand that it is helpful for clarity of the script, so it also doesn’t hurt if you keep it in.
spawn
{
accum 0 set 0
}
The routine trigger allied_capture
specifies what you want to happen when Allies capture the flag.
trigger allied_capture
{
accum 0 abort_if_equal 1
trigger new_spawn bunker_flagblue
trigger new_spawn setallies
}
accum 0 abort_if_equal 1
is fine. It aborts the execution of this routine if an Allied player touches the flag, while it is already Allied. The next lines reference to other script routines. The first one is a simple announcement:
trigger blue_flagblue
{
wm_announce "allied capture the spawn"
}
In my eyes this makes the setup unnecessarily complicated, because the announcement can easily be put into the previous routine.
The second one is a bit more complex so let’s go through it.
trigger setallies
{
accum 0 abort_if_equal 1
accum 0 set 1
alertentity spawn
alertentity neutral_spawn
setautospawn "2nd_axis_spawn" 0
}
accum 0 abort_if_equal 1
is not strictly necessary here, because that line is only executed if that requirement is already given. In the previous routine you already have that line, so it’s redundant here.
accum 0 set 1
tells the script that the flag is held by the Allies. That is good that you put it there. The game now alerts the team_WOLF_objective
. By doing so it switches its state from Axis to Allied.
The game also alerts all spawn entities with targetname: neutral_spawn
. By doing so, the state of each spawn entity is switched. That is why it is important to have the spawnflag startactive
set for Axis spawns. All active spawns are switched off and all inactive spawns are switched on by the alertentity line. In other words, Axis spawns get disabled, Allied spawns get enabled.
The script then sets the fallback autospawn for Axis. In this case 2nd_axis_spawn
, which does not exist! It’s called axis spawn
as seen in the image below.
The routine trigger axis_capture
does the same thing, just for the Axis instead of Allies. The only difference here is that you don’t set a fallback spawn for the Allies. I don’t know if that’s intentional or not.
With the adjustments, the new script routine for that entity is the following:
new_spawn
{
spawn
{
accum 0 set 0 // tells the script the flag is owned by Axis
}
trigger allied_capture
{
accum 0 abort_if_equal 1 //tells the game to stop here if the flag is already Allied.
accum 0 set 1 //tells the game that the flag is now Allied.
wm_announce "allied capture the spawn" //announcement moved here from other subroutine.
alertentity spawn //tells the game to switch the state of the WOLF objective.
alertentity neutral_spawn // tells the game to switch the state of the targeted spawn entities.
setautospawn "axis spawn" 0 //FIXED! tells the game which spawn the Axis should use now.
}
trigger axis_capture
{
accum 0 abort_if_equal 0 //tells the game to stop here if the flag is already Axis.
accum 0 set 0 //tells the game that the flag is now Axis.
wm_announce "axis capture the spawn" //announcement moved here from other subroutine.
alertentity spawn //tells the game to switch the state of the WOLF objective.
alertentity neutral_spawn // tells the game to switch the state of the targeted spawn entities.
setautospawn "allied spawn" 1 //ADDED! tells the game which spawn the Allies should use now.
}
trigger gone //UNRELATED TO FLAG; LEAVE FOR LATER
{
accum 0 abort_if_equal 1
alertentity spawn
alertentity neutral_spawn
setautospawn "capture_apawn" 0 //TYPO!
setautospawn "capture_spawn" 1
remove //moved here from other subroutine
}
}
I’d suggest to leave the wall out for now, because there are other things in there that need fixing. Report back once you got the flag spawn working and we can have a look.
Last but not least, again: targetname
and scriptname
need to be single string! Replace the space in the targetname
of the following entities with an underscore ‘_’