script help


(blushing_bride) #1

Ive nearly finished my map, below is the script that i have cobbled together thanks to a few people in this forum (all will be named in the readme). However i do not understand how to end the map. I wish to have an allied vitory if they take the gold to the drop off point else the axis win if a 15 minute time limit expires. It’s as simple as that (or not if scripting makes your head spin like me). I was hoping that someone might be able to explain how these things are done. Thanks in advance

game_manager
{
spawn
{
}
}

dynamitetest
{
spawn
{
wait 200
constructible_class 3
}
death
{
wm_announce “Allies have blown open the Palace Door!”
}
}

construction_script
{
spawn
{
wait 200
constructible_class 2
trigger self startup
}

buildstart final
{
}

built final
{
setstate construction_extra default
setstate construction_mg42 default
setstate construction_materials invisible

// Some kind of UI pop-up to alert players
wm_announce “Allied team has built the MG!”
}

decayed final
{
trigger self startup
}

death
{
trigger self startup
// Some kind of UI pop-up to alert players
wm_announce “Axis team has destroyed the Allied MG!”
}

trigger startup
{
setstate construction_extra invisible
setstate construction_mg42 invisible
setstate construction_materials default
repairmg42 construction_mg42
}
}

// ================================================
// ============ NEUTRAL COMMAND POST ==============
// ================================================
// FROM GOldRush Thx SD!!! prefab by seven 2003

allied_compost_built
{
spawn
{
wait 400
trigger allied_compost_built setup

	constructible_class 2
}

trigger setup
{
	setchargetimefactor 1 soldier 1
	setchargetimefactor 1 lieutenant 1
	setchargetimefactor 1 medic 1
	setchargetimefactor 1 engineer 1
	setchargetimefactor 1 covertops 1
	sethqstatus 1 0
}

buildstart final
{
	setstate allied_compost_built_model underconstruction
	setstate neutral_compost_closed_clip invisible
	setstate neutral_compost_closed_model invisible
}

built final
{
	setstate allied_compost_built_model default
	setstate neutral_compost_closed_clip invisible
	setstate neutral_compost_closed_model invisible

	trigger allied_compost_built_model enable_allied_features

	enablespeaker allies_compost_sound
}

decayed final
{
	setstate allied_compost_built_model invisible
	setstate neutral_compost_closed_clip default
	setstate neutral_compost_closed_model default
}

death
{
	setstate allied_compost_built_model invisible
	setstate neutral_compost_closed_clip default
	setstate neutral_compost_closed_model default

	trigger allied_compost_built_model disable_allied_features

	disablespeaker allies_compost_sound
}

}

allied_compost_built_model
{
spawn
{
wait 400
setstate allied_compost_built_model invisible
}

trigger enable_allied_features
{
	setchargetimefactor 1 soldier 0.75
	setchargetimefactor 1 lieutenant 0.75
	setchargetimefactor 1 medic 0.75
	setchargetimefactor 1 engineer 0.75
	setchargetimefactor 1 covertops 0.75
	sethqstatus 1 1

	wm_announce	"Allied Command Post constructed. Charge speed increased!"

	// *----------------------------------- vo ------------------------------------------*
	wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"

	wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

	wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
	// *---------------------------------------------------------------------------------*

	wm_objective_status 6 0 2
	wm_objective_status 6 1 1
}

trigger disable_allied_features
{
	setchargetimefactor 1 soldier 1
	setchargetimefactor 1 lieutenant 1
	setchargetimefactor 1 medic 1
	setchargetimefactor 1 engineer 1
	setchargetimefactor 1 covertops 1
	sethqstatus 1 0

	wm_announce	"Axis team has destroyed the Allied Command Post!"

	// *----------------------------------- vo ------------------------------------------*
	wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

	wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

	wm_teamvoiceannounce 0 "axis_hq_compost_construct"

	wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
	// *---------------------------------------------------------------------------------*

	wm_objective_status 6 0 0
	wm_objective_status 6 1 0
}

}

axis_compost_built
{
spawn
{
wait 400
trigger axis_compost_built setup

	constructible_class 2
}

trigger setup
{
	setchargetimefactor 0 soldier 1
	setchargetimefactor 0 lieutenant 1
	setchargetimefactor 0 medic 1
	setchargetimefactor 0 engineer 1
	setchargetimefactor 0 covertops 1
	sethqstatus 0 0
}

buildstart final
{
	setstate axis_compost_built_model underconstruction
	setstate neutral_compost_closed_clip invisible
	setstate neutral_compost_closed_model invisible
}

built final
{
	setstate axis_compost_built_model default
	setstate neutral_compost_closed_clip invisible
	setstate neutral_compost_closed_model invisible

	trigger axis_compost_built_model enable_axis_features

	enablespeaker axis_compost_sound
}

decayed final
{
	setstate axis_compost_built_model invisible
	setstate neutral_compost_closed_clip default
	setstate neutral_compost_closed_model default
}

death
{
	setstate axis_compost_built_model invisible
	setstate neutral_compost_closed_clip default
	setstate neutral_compost_closed_model default

	trigger axis_compost_built_model disable_axis_features

	disablespeaker axis_compost_sound
}

}

axis_compost_built_model
{
spawn
{
wait 400
setstate axis_compost_built_model invisible
}

trigger enable_axis_features
{
	setchargetimefactor 0 soldier 0.75
	setchargetimefactor 0 lieutenant 0.75
	setchargetimefactor 0 medic 0.75
	setchargetimefactor 0 engineer 0.75
	setchargetimefactor 0 covertops 0.75
	sethqstatus 0 1

	wm_announce	"Axis Command Post constructed. Charge speed increased!"

	// *----------------------------------- vo ------------------------------------------*
	wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

	wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

	wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
	// *---------------------------------------------------------------------------------*

	wm_objective_status 7 0 1
	wm_objective_status 7 1 2
}

trigger disable_axis_features
{
	setchargetimefactor 0 soldier 1
	setchargetimefactor 0 lieutenant 1
	setchargetimefactor 0 medic 1
	setchargetimefactor 0 engineer 1
	setchargetimefactor 0 covertops 1
	sethqstatus 0 0

	wm_announce	"Allied team has destroyed the Axis Command Post!"

	// *----------------------------------- vo ------------------------------------------*
	wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

	wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

	wm_teamvoiceannounce 0 "axis_hq_compost_damaged"

	wm_teamvoiceannounce 1 "allies_hq_compost_construct"
	// *---------------------------------------------------------------------------------*

	wm_objective_status 7 0 0
	wm_objective_status 7 1 0
}

}

//Gold

allied_gold
{
spawn
{
wait 200
setstate allied_gold_captured invisible
}
trigger stolen
{
wm_announce “Return the Axis gold to the getaway truck”
wm_announce “The Allies have stolen the Axis gold”
setstate allied_gold_cm_marker invisible
}
trigger returned
{
wm_announce “The Axis have retrieved the gold”
wm_announce “Gold returned! Protect the gold”
setstate allied_gold_cm_marker default
}
trigger captured
{
wm_announce “The Allies have secured the Axis gold”
setstate allied_gold_red invisible
setstate allied_gold_captured default
}
}
allied_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity
{
death
{
trigger game_manager obj1
}
}


(hummer) #2

Take a good look at the goldrush script.

Inside is a function:

trigger allies_win
	{
		wm_setwinner	1
		wm_announce "Allied team escaped with the Gold Crates!"

		wm_objective_status 5 0 2
		wm_objective_status 5 1 1

		wait 1500
		wm_endround
	}

The keys here are wm_setwinner and wm_endround.

wm_setwinner determines who will win the game when the game is over. 1 is allied, 0 is axis.

When wm_endround is executed, the game actually ends. So, depending on what wm_setwinner is set to when wm_endround is executed will determine who wins the game.

However, you need something call this function / trigger somewhere. So, in the death portion of trigger_flag_only script, you have something like:

trigger game_manager obj1

You should instead have trigger gamemanager allies_win. Just make sure to include the allies_win trigger in the game_manager portion of the script :slight_smile:


(blushing_bride) #3

thanks for the reply. Sorry to say i still don’t get it. I have two goldrush scripts and they are both different so im not sure which one to look at. Even if i did i don’t find them helpful simply because i do not understand any of the concepts/logic concerning scripting. They may as well be written in a foriegn language. Anyway sorry for the rant i just wanted to establish how utterly confused i am. So going on what you said my script now looks like this (as you can tell i dropped in the things you mentioned by guessing where they should go). If the allies secure the gold they win, if time runs out they still win. I’ve clearly done something wrong but i have no idea what?

game_manager
trigger allies_win
{
wm_setwinner 1
wm_announce “Allied team escaped with the Gold Crates!”

wm_objective_status 5 0 2
wm_objective_status 5 1 1

wait 1500
wm_endround
}

{
spawn
{
}
}

dynamitetest
{
spawn
{
wait 200
constructible_class 3
}
death
{
wm_announce “Allies have blown open the Palace Door!”
}
}

construction_script
{
spawn
{
wait 200
constructible_class 2
trigger self startup
}

buildstart final
{
}

built final
{
setstate construction_extra default
setstate construction_mg42 default
setstate construction_materials invisible

// Some kind of UI pop-up to alert players
wm_announce “Allied team has built the MG!”
}

decayed final
{
trigger self startup
}

death
{
trigger self startup
// Some kind of UI pop-up to alert players
wm_announce “Axis team has destroyed the Allied MG!”
}

trigger startup
{
setstate construction_extra invisible
setstate construction_mg42 invisible
setstate construction_materials default
repairmg42 construction_mg42
}
}

// ================================================
// ============ NEUTRAL COMMAND POST ==============
// ================================================
// FROM GOldRush Thx SD!!! prefab by seven 2003

allied_compost_built
{
spawn
{
wait 400
trigger allied_compost_built setup

	constructible_class 2
}

trigger setup
{
	setchargetimefactor 1 soldier 1
	setchargetimefactor 1 lieutenant 1
	setchargetimefactor 1 medic 1
	setchargetimefactor 1 engineer 1
	setchargetimefactor 1 covertops 1
	sethqstatus 1 0
}

buildstart final
{
	setstate allied_compost_built_model underconstruction
	setstate neutral_compost_closed_clip invisible
	setstate neutral_compost_closed_model invisible
}

built final
{
	setstate allied_compost_built_model default
	setstate neutral_compost_closed_clip invisible
	setstate neutral_compost_closed_model invisible

	trigger allied_compost_built_model enable_allied_features

	enablespeaker allies_compost_sound
}

decayed final
{
	setstate allied_compost_built_model invisible
	setstate neutral_compost_closed_clip default
	setstate neutral_compost_closed_model default
}

death
{
	setstate allied_compost_built_model invisible
	setstate neutral_compost_closed_clip default
	setstate neutral_compost_closed_model default

	trigger allied_compost_built_model disable_allied_features

	disablespeaker allies_compost_sound
}

}

allied_compost_built_model
{
spawn
{
wait 400
setstate allied_compost_built_model invisible
}

trigger enable_allied_features
{
	setchargetimefactor 1 soldier 0.75
	setchargetimefactor 1 lieutenant 0.75
	setchargetimefactor 1 medic 0.75
	setchargetimefactor 1 engineer 0.75
	setchargetimefactor 1 covertops 0.75
	sethqstatus 1 1

	wm_announce	"Allied Command Post constructed. Charge speed increased!"

	// *----------------------------------- vo ------------------------------------------*
	wm_teamvoiceannounce 0 "axis_hq_compost_constructed_allies"

	wm_teamvoiceannounce 1 "allies_hq_compost_constructed"

	wm_removeteamvoiceannounce 1 "allies_hq_compost_construct"
	// *---------------------------------------------------------------------------------*

	wm_objective_status 6 0 2
	wm_objective_status 6 1 1
}

trigger disable_allied_features
{
	setchargetimefactor 1 soldier 1
	setchargetimefactor 1 lieutenant 1
	setchargetimefactor 1 medic 1
	setchargetimefactor 1 engineer 1
	setchargetimefactor 1 covertops 1
	sethqstatus 1 0

	wm_announce	"Axis team has destroyed the Allied Command Post!"

	// *----------------------------------- vo ------------------------------------------*
	wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

	wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

	wm_teamvoiceannounce 0 "axis_hq_compost_construct"

	wm_teamvoiceannounce 1 "allies_hq_compost_damaged"
	// *---------------------------------------------------------------------------------*

	wm_objective_status 6 0 0
	wm_objective_status 6 1 0
}

}

axis_compost_built
{
spawn
{
wait 400
trigger axis_compost_built setup

	constructible_class 2
}

trigger setup
{
	setchargetimefactor 0 soldier 1
	setchargetimefactor 0 lieutenant 1
	setchargetimefactor 0 medic 1
	setchargetimefactor 0 engineer 1
	setchargetimefactor 0 covertops 1
	sethqstatus 0 0
}

buildstart final
{
	setstate axis_compost_built_model underconstruction
	setstate neutral_compost_closed_clip invisible
	setstate neutral_compost_closed_model invisible
}

built final
{
	setstate axis_compost_built_model default
	setstate neutral_compost_closed_clip invisible
	setstate neutral_compost_closed_model invisible

	trigger axis_compost_built_model enable_axis_features

	enablespeaker axis_compost_sound
}

decayed final
{
	setstate axis_compost_built_model invisible
	setstate neutral_compost_closed_clip default
	setstate neutral_compost_closed_model default
}

death
{
	setstate axis_compost_built_model invisible
	setstate neutral_compost_closed_clip default
	setstate neutral_compost_closed_model default

	trigger axis_compost_built_model disable_axis_features

	disablespeaker axis_compost_sound
}

}

axis_compost_built_model
{
spawn
{
wait 400
setstate axis_compost_built_model invisible
}

trigger enable_axis_features
{
	setchargetimefactor 0 soldier 0.75
	setchargetimefactor 0 lieutenant 0.75
	setchargetimefactor 0 medic 0.75
	setchargetimefactor 0 engineer 0.75
	setchargetimefactor 0 covertops 0.75
	sethqstatus 0 1

	wm_announce	"Axis Command Post constructed. Charge speed increased!"

	// *----------------------------------- vo ------------------------------------------*
	wm_teamvoiceannounce 0 "axis_hq_compost_constructed"

	wm_teamvoiceannounce 1 "allies_hq_compost_constructed_axis"

	wm_removeteamvoiceannounce 0 "axis_hq_compost_construct"
	// *---------------------------------------------------------------------------------*

	wm_objective_status 7 0 1
	wm_objective_status 7 1 2
}

trigger disable_axis_features
{
	setchargetimefactor 0 soldier 1
	setchargetimefactor 0 lieutenant 1
	setchargetimefactor 0 medic 1
	setchargetimefactor 0 engineer 1
	setchargetimefactor 0 covertops 1
	sethqstatus 0 0

	wm_announce	"Allied team has destroyed the Axis Command Post!"

	// *----------------------------------- vo ------------------------------------------*
	wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

	wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

	wm_teamvoiceannounce 0 "axis_hq_compost_damaged"

	wm_teamvoiceannounce 1 "allies_hq_compost_construct"
	// *---------------------------------------------------------------------------------*

	wm_objective_status 7 0 0
	wm_objective_status 7 1 0
}

}

//Gold

allied_gold
{
spawn
{
wait 200
setstate allied_gold_captured invisible
}
trigger stolen
{
wm_announce “Return the Axis gold to the getaway truck”
wm_announce “The Allies have stolen the Axis gold”
setstate allied_gold_cm_marker invisible
}
trigger returned
{
wm_announce “The Axis have retrieved the gold”
wm_announce “Gold returned! Protect the gold”
setstate allied_gold_cm_marker default
}
trigger captured
{
wm_announce “The Allies have secured the Axis gold”
setstate allied_gold_red invisible
setstate allied_gold_captured default
}
}
allied_objectives //enter this as the scriptname value for the single trigger_flagonly_multiples entity
{
death
{
trigger game_manager allies_win

}
}


(chavo_one) #4

You need to setup the default winner in the game_manager’s spawn function. Right now your spawn function is empty (which is very odd).

If you look at the goldrush script you would see this:

game_manager
{
	spawn
	{
.
.
.
		// Winner on expiration of round timer (0=Axis, 1=Allies)
		wm_setwinner	0
.
.
.


This makes sure that the axis when if the time runs out.


(blushing_bride) #5

thanks for the reply. I think i must be stupid or something becasue i honestly have no idea what you mean. If i insert that anywhere in my script the map no longer loads. Perhaps if someone could point out a tutorial that explains the concepts of scripting like what { means and // and that kind of thing it might help me to reach some vague understanding of the concepts of scripting rather than trying to guess my way to success. this is very frustrating


(chavo_one) #6

Wow.

Evidently you have no experience whatsoever with any kind of programming or scripting language. That makes things very difficult indeed.

As far as your questions here…
Curly braces are used to create functions.
// are used to designate comments. Anything on a line that begins with // are ignored by the game.

You may want to read this guide. I haven’t read it myself, but Ifurita wrote it with beginners in mind.
http://planetwolfenstein.com/4newbies/Map_Scripting_4_Newbies.pdf


(blushing_bride) #7

Yep i know bugger all. Only been online gaming for a few months, before that i only ever used a pc for playing offline games and typing stuff so nearly everything is new to me. Anyway i started reading the tutorial and it gave me the idea to cut and paste the entire first section of the goldrush script and dump it at the start of mine. this caused an error while loading so i deleted the lines that the error pointed to and now everything seems to work how i want (lucky guess). Now i have all this stuff in my scruipt that may or may not be relevant and i was wondering if any of it could cause problems later on. Once agian thanks in advance

game_manager
{
spawn
{
remapshader “models/mapobjects/tanks_sd/mg42turret” “models/mapobjects/tanks_sd/mg42turret_2”

	remapshaderflush
	
	// Game rules
	wm_axis_respawntime	30
	wm_allied_respawntime	20
	wm_number_of_objectives 7
	wm_set_round_timelimit	30

	// Objectives
	// 1: Destroy the Palace Door
	// 2: Steal the gold

	// Current main objectives for each team (0=Axis, 1=Allies)
	wm_set_main_objective		1	0
	wm_set_main_objective		1	1

	wm_objective_status 1 0 0
	wm_objective_status 1 1 0
	wm_objective_status 2 0 0
	wm_objective_status 2 1 0
	wm_objective_status 3 0 0
	wm_objective_status 3 1 0
	wm_objective_status 4 0 0
	wm_objective_status 4 1 0
	wm_objective_status 5 0 0
	wm_objective_status 5 1 0
	wm_objective_status 6 0 0
	wm_objective_status 6 1 0
	wm_objective_status 7 0 0
	wm_objective_status 7 1 0

	wm_set_main_objective		1	0
	wm_set_main_objective		1	1

	// Stopwatch mode defending team (0=Axis, 1=Allies)
	wm_set_defending_team	0

	// Winner on expiration of round timer (0=Axis, 1=Allies)
	wm_setwinner	0

	accum 4 set 0 // have the Allies stolen the tank?

	// start triggered loops on/off as required (eg: command post radio sounds)
	disablespeaker allies_compost_sound
	disablespeaker axis_compost_sound
	disablespeaker allies_compost_sound_lms
	disablespeaker axis_compost_sound_lms

	wait 2000

	// *----------------------------------- vo ------------------------------------------*
	wm_addteamvoiceannounce 0 "goldrush_axis_tank_steal"
	wm_addteamvoiceannounce 0 "axis_hq_compost_construct"

	wm_addteamvoiceannounce 1 "goldrush_allies_tank_steal"
	wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

	wm_teamvoiceannounce 0 "goldrush_axis_tank_steal"
	wm_teamvoiceannounce 0 "axis_hq_compost_construct"

	wm_teamvoiceannounce 1 "goldrush_allies_tank_steal"
	wm_teamvoiceannounce 1 "allies_hq_compost_construct"
	// *---------------------------------------------------------------------------------*
}