Hi,
originally I’ve tried to increase the “round_timelimit” by 30 sec. if the dynamite has been planted within the last 30 sec. of regular playtime.
Unfortunately it’s only possible to increase “round_timelimit” (exactly the cvar “timelimit”) by 1 minute steps.
And unfortunately the operations (like “abort_if_greater_than”) seem not to work with the “cvar”-actions.
So I’ve added a “func_timer”-entity with “start_on” activated. Every 60 sec. this timer triggers a “target_script_trigger”-entity.
The “target_script_trigger”-event that is been called “inc”-rements a globalaccum by -1.
This globalaccum has been initialized with “round_timelimit” + 1 (because the timer triggers the script trigger right after the spawn of the map).
I’ve added the “dynamited”-event to the “trigger_objective_info”-entity.
If the dynamite is planted (exactly: armed) this event checks if the globalaccum is greater than 1 (means more than 1 minute to play).
If not the timelimit (remaining time) is “inc”-reased by 1 minute.
Script:
// **************************************************
// General
//
// Map:
// concept_time_1.map
//
// Description:
// Concept map time extension.
//
// Discussion
// http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=4140
//
// TEAMDEFINITION
// AXIS = red = 0
// ALLIED = blue = 1
// **************************************************
// **************************************************
// Accums
// accum 1 = No. of completed Allied objectives
// globalaccum 1 = time left
// **************************************************
// **************************************************
// Game rules
game_manager
{
spawn
{
// accum 1 = No. of completed AXIS objectives
accum 1 set 0
// globalaccum 1 = time left
// (round_timelimit + 1) at the beginning
globalaccum 1 set 3
// game rules
// low values for testing purposes
wm_axis_respawntime 5
wm_allied_respawntime 5
wm_set_round_timelimit 2
// ALLIED Objectives:
// 1: Primary: Destroy the func_explosive
wm_number_of_objectives 1
// No. of Primary objectives ((objective-no.) (Team>))
// func_explosive
wm_set_main_objective 1 0
wm_set_main_objective 1 1
// wm_objective_status (objective-no.) (team) (status (0=neutral 1=complete 2=failed))
// func_explosive's
wm_objective_status 1 0 0
wm_objective_status 1 1 0
// Winner if timelimit is hit
wm_setwinner 0
wait 1000
}
// ******************** checkgames ********************
trigger ALLIED_checkgame
{
accum 1 inc 1
accum 1 abort_if_not_equal 1
wm_setwinner 1
wm_endround
}
// ******************** end checkgames ********************
}
// **************************************************
// **************************************************
// ALLIED OBJECTIVES
// DESTROY: func_explosive
scr_ALLIED_KLOTZ
{
spawn
{
wait 200
constructible_class 3
}
death
{
wm_objective_status 1 0 2
wm_objective_status 1 1 1
wm_announce "Allied have blown up the func_explosive"
trigger game_manager ALLIED_checkgame
}
}
// **************************************************
// **************************************************
scr_ALLIED_KLOTZ_TOI
{
spawn
{
}
dynamited
{
globalaccum 1 abort_if_greater_than 1
cvar timelimit inc "1"
wm_announce "Additional 1 minute"
}
}
// **************************************************
// **************************************************
scr_SCRIPT_TRIGGER
{
spawn
{
}
trigger time
{
// timer fires every 60 sec.
globalaccum 1 inc -1
}
}
// **************************************************
Entities:
// ...
// entity 24
{
"classname" "func_explosive"
"spawnflags" "4"
"scriptname" "scr_ALLIED_KLOTZ"
"targetname" "ALLIED_KLOTZ"
// brush 0
{
( 48 24 -232 ) ( -24 24 -232 ) ( -24 -32 -232 ) castle_wall/castle_c09_2 128 64 0 0.500000 0.500000 0 0 0
( -32 -32 -144 ) ( -32 24 -144 ) ( 40 24 -144 ) castle_wall/castle_c09_2 128 64 0 0.500000 0.500000 0 0 0
( -32 -24 -88 ) ( 40 -24 -88 ) ( 40 -24 -144 ) castle_wall/castle_c09_2 128 16 0 0.500000 0.500000 0 0 0
( 24 -32 -88 ) ( 24 24 -88 ) ( 24 24 -144 ) castle_wall/castle_c09_2 -64 16 0 0.500000 0.500000 0 0 0
( 48 24 -88 ) ( -24 24 -88 ) ( -24 24 -144 ) castle_wall/castle_c09_2 128 16 0 0.500000 0.500000 0 0 0
( -24 24 -88 ) ( -24 -32 -88 ) ( -24 -32 -144 ) castle_wall/castle_c09_2 -64 16 0 0.500000 0.500000 0 0 0
}
// brush 1
{
( 8 24 -136 ) ( -8 24 -136 ) ( -8 -24 -136 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( -8 -24 -120 ) ( -8 24 -120 ) ( 8 24 -120 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( -8 -8 -120 ) ( 8 -8 -120 ) ( 8 -8 -136 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 8 -24 -120 ) ( 8 24 -120 ) ( 8 24 -136 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 8 8 -120 ) ( -8 8 -120 ) ( -8 8 -136 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( -8 24 -120 ) ( -8 -24 -120 ) ( -8 -24 -136 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
}
}
// entity 25
{
"target" "ALLIED_KLOTZ"
"classname" "trigger_objective_info"
"spawnflags" "1"
"targetname" "ALLIED_KLOTZ_TOI"
"scriptname" "scr_ALLIED_KLOTZ_TOI"
"track" "Allied func_explosive!"
// brush 0
{
( -64 160 -136 ) ( -64 -864 -136 ) ( -64 -864 -240 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 72 64 -136 ) ( -48 64 -136 ) ( -48 64 -240 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 64 -96 -136 ) ( 64 928 -136 ) ( 64 928 -240 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( -136 -64 -136 ) ( -16 -64 -136 ) ( -16 -64 -240 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( -56 -864 -112 ) ( -56 160 -112 ) ( 64 160 -112 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
( 64 160 -240 ) ( -56 160 -240 ) ( -56 -864 -240 ) common/trigger 0 0 0 0.500000 0.500000 0 7 0
}
// brush 1
{
( -8 64 -88 ) ( -8 -64 -88 ) ( -8 -64 -104 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 8 8 -88 ) ( -8 8 -88 ) ( -8 8 -104 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 8 -64 -88 ) ( 8 64 -88 ) ( 8 64 -104 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 0 -8 -88 ) ( 16 -8 -88 ) ( 16 -8 -104 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( -8 -64 -88 ) ( -8 64 -88 ) ( 8 64 -88 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
( 8 64 -104 ) ( -8 64 -104 ) ( -8 -64 -104 ) common/origin 0 0 0 0.500000 0.500000 0 15 0
}
}
// ...
// entity 28
{
"target" "SCRIPT_TRIGGER"
"wait" "60"
"spawnflags" "1"
"origin" "0 0 -64"
"classname" "func_timer"
}
// entity 29
{
"target" "time"
"scriptname" "scr_SCRIPT_TRIGGER"
"targetname" "SCRIPT_TRIGGER"
"origin" "0 0 64"
"classname" "target_script_trigger"
}