Noob-ism - Scripting and spawn woes


(Charming_Fox) #1

ok MadJack and Ifurita…

i have been reading, and studying more and i can say that i understand parts of a script and can recongnise (kind of) what happens in the different routines and triggers and things… sort of at least.

so i decided to make a test map, for practicing in… using two tutorials, one by sock on these forums about the forward spawn, and one by marko on destructible objectives and ive tried to tie them together but it’s not quite working… would you point me in the right direction? i think its the wobj bit.

i have a simple map with the following entities in it:

red and blue spawns (permanent ‘back’ spawns, away from the flag)
red and blue spawns around the flag with targetnames oldcityspawns

a team_WOLF_checkpoint with the following keys/values:
targetname oldcityflag
scriptname oldcityflag
target oldcityspawns // points to the nearby spawns with the corresponding names yes?
spawnflags 1 // am i right in thinking this makes it default axis?

a team_WOLF_objective witht he following: (I DONT UNDERSTAND THIS ENTITY OR ITS PURPOSE)
targetname old_city_wobj
scriptname old_city_wobj
description Old City
spawnflags 1

a func_explosive
targetname dynawall // dont understand the importance of this key???
scriptname oldcitywall
noise brick
mass 200

a trigger_objective_info
spawnflags 1
objflags 4 //makes dynamite logo appear???
track the thing you must blow up // the hint?

and here is my script in whole, as you cans ee im still cut/pasting too much but at least im trying:


game_manager
{
	spawn
	{
		accum 1 set 0		// State of objective number one
		accum 5 set 0		// Corrent number of Pak 75mm guns destroyed
		accum 6 set 0		// Current number of water pumps built
		accum 7 set 0		// Value used in checking whether or not to announce "Axis have damaged both water pumps!"

		globalaccum 5 set 0
		globalaccum 6 set 0

		// Game rules
		wm_axis_respawntime	30
		wm_allied_respawntime	20
		wm_number_of_objectives 8
		wm_set_round_timelimit	30

		// Objectives
		// 1: Primary1 : Destroy the North gun
		// 2: Primary2 : Destroy the South gun
		// 3: Primary3 : Breach Old City wall
		// 4: Secondary1 : Capture forward spawn point
		// 5: Secondary2 : Drain/flood cave system by repairing/damaging the Oasis pump
		// 6: Secondary3 : Drain/flood cave system by repairing/damaging the Old City pump
		// 7: Allied command post
		// 8: Axis command post

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

		// Objective overview status indicators
		//wm_objective_status <objective> <team (0=Axis, 1=Allies)> <status (0=neutral 1=complete 2=failed)>
		wm_objective_status 1 1 0
		wm_objective_status 1 0 0
		wm_objective_status 2 1 0
		wm_objective_status 2 0 0
		wm_objective_status 3 1 0
		wm_objective_status 3 0 0
		wm_objective_status 4 1 0
		wm_objective_status 4 0 0
		wm_objective_status 5 1 0
		wm_objective_status 5 0 0
		wm_objective_status 6 1 0
		wm_objective_status 6 0 0
		wm_objective_status 7 1 0
		wm_objective_status 7 0 0
		wm_objective_status 8 1 0
		wm_objective_status 8 0 0

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

		// If the round timer expires, the Axis have won, so set the current winning team
		// Set the round winner:  0 == AXIS, 1 == ALLIED
		wm_setwinner 0

		// Set autospawn markers <team (0 = axis, 1 = allies)> <message key of marker>
		// Spawns on siwa:
		// Axis Garrison
		// Allied Camp
		// Old City
		wait 150

		setautospawn "Old City"			1
		setautospawn "Old City"			0

		wait 350

		disablespeaker wp1_sound				// water pump 1
		disablespeaker wp2_sound				// water pump 2
		disablespeaker hose1_sound1				// water outlet 1
		disablespeaker hose1_sound2				// water tunnel 1
		disablespeaker hose2_sound1				// water outlet 2
		disablespeaker hose2_sound2				// water tunnel 2
		disablespeaker allies_compost_sound		// allies command post
		disablespeaker axis_compost_sound		// axis command post
		disablespeaker axis_compost_sound_lms	// axis command post lms

		wait 2000

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

		wm_addteamvoiceannounce 1 "oasis_allies_city_capture"
		wm_addteamvoiceannounce 1 "oasis_allies_pumps_repair"
		wm_addteamvoiceannounce 1 "allies_hq_compost_construct"

		wm_teamvoiceannounce 0 "oasis_axis_city_defend"
		wm_teamvoiceannounce 0 "oasis_axis_pumps_stop"
		wm_teamvoiceannounce 0 "axis_hq_compost_construct"

		wm_teamvoiceannounce 1 "oasis_allies_city_capture"
		wm_teamvoiceannounce 1 "oasis_allies_pumps_repair"
		wm_teamvoiceannounce 1 "allies_hq_compost_construct"
		// *---------------------------------------------------------------------------------*
	}


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

	trigger axis_capture	// Flag has been touched by an Axis player
	{
		accum 0 abort_if_equal 0 // do Axis own flag?

		accum 0 set 0 // Axis own the pole
		wm_announce	"Axis reclaim the Old City!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "oasis_axis_city_defend"

		wm_addteamvoiceannounce 1 "oasis_allies_city_capture"

		wm_teamvoiceannounce 0 "oasis_axis_city_captured"

		wm_teamvoiceannounce 1 "oasis_allies_city_lost"

		wm_removeteamvoiceannounce 0 "oasis_axis_wall_defend"

		wm_removeteamvoiceannounce 1 "oasis_allies_wall_destroy"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 		4 0 1
		wm_objective_status 		4 1 2

		alertentity old_city_wobj
	}

	trigger allied_capture	// Flag has been touched by an allied player
	{
		accum 0 abort_if_equal 1 // do Allies own flag?

		accum 0 set 1 // Allied own the flag
		wm_announce	"Allies capture the Old City!"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "oasis_axis_wall_defend"

		wm_addteamvoiceannounce 1 "oasis_allies_wall_destroy"

		wm_teamvoiceannounce 0 "oasis_axis_city_lost"
		wm_teamvoiceannounce 0 "oasis_axis_wall_defend"

		wm_teamvoiceannounce 1 "oasis_allies_city_captured"
		wm_teamvoiceannounce 1 "oasis_allies_wall_destroy"

		wm_removeteamvoiceannounce 0 "oasis_axis_city_defend"

		wm_removeteamvoiceannounce 1 "oasis_allies_city_capture"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 		4 0 2
		wm_objective_status 		4 1 1

		alertentity old_city_wobj
	}

	trigger check_obj
	{
		accum 0 abort_if_equal 1 // Do Allied own the flag?

		wm_objective_status 		4 0 2
		wm_objective_status 		4 1 1

	}

	trigger force_allied
	{
		accum 0 abort_if_equal 1 // Do Allied own the flag?

		alertentity old_city_wobj
		alertentity oldcityspawns
	}

	trigger kill
	{
		remove
	}
}

oldcitywall //Broken section of Old City wall
{
	spawn
	{
		wait 200

		constructible_class 3
	}

	death
	{
		trigger oldcityflag force_allied // Switch forward spawn to Allied ONLY

		trigger oldcityflag check_obj

		trigger oldcityflag kill

		wm_announce "Allies have breached the Old City wall"

		// *----------------------------------- vo ------------------------------------------*
		wm_addteamvoiceannounce 0 "oasis_axis_paks_defend"

		wm_addteamvoiceannounce 1 "oasis_allies_paks_destroy"

		wm_teamvoiceannounce 0 "oasis_axis_wall_destroyed"
		wm_teamvoiceannounce 0 "oasis_axis_paks_defend"

		wm_teamvoiceannounce 1 "oasis_allies_wall_destroyed"
		wm_teamvoiceannounce 1 "oasis_allies_paks_destroy"

		wm_removeteamvoiceannounce 0 "oasis_axis_wall_defend"
		wm_removeteamvoiceannounce 0 "oasis_axis_city_defend"

		wm_removeteamvoiceannounce 1 "oasis_allies_wall_destroy"
		wm_removeteamvoiceannounce 1 "oasis_allies_city_capture"
		// *---------------------------------------------------------------------------------*

		wm_objective_status 		3 0 2
		wm_objective_status 		3 1 1

		wm_set_main_objective	1 0
		wm_set_main_objective	1 1
	}
}
}


(MadJack) #2

First, try to use [ code ] [ / code ] to put script stuff as it clearly defines to us what is part of the script.


Stuff inside a [ CODE ] [ / CODE ] looks like that and keeps its formatting.
		Tabs stay tabs.
  spaces retain they        alignments, etc.

I’m glad you decided to take on scripting by its horn. It’s the only way you’ll get more experienced and it’ll be more fun for you down the line.

Anyway, here’s some of the answers for your questions.

a team_WOLF_objective witht he following: (I DONT UNDERSTAND THIS ENTITY OR ITS PURPOSE)

In radiant’s entity window, you can read the description of this ent as follow:

This is the clickable spawnpoint flags seen on the commandmap. When active, this will make a player spawn at the team_CTF_spawnpoint closest to it

So basically, it sets the flag as clickable so you can spawn near the flag. If you don’t put that where the spawn is, players can’t click on the flag to chose where they’ll spawn (if more than one spawnflags exist)

a func_explosive
targetname dynawall // dont understand the importance of this key???

targetname gives the entity a name. In that case, the func_explosive can be refered in game and in radiant using that name. So if you’d want to point a light at that func_explosive, in the light entity properties, you would use: target dynawall In radiant you would see an arrow going from the light to the func_explosive.

objflags 4 //makes dynamite logo appear???

objflags doesn’t work at all. Don’t even include that. The code to take care of that is non-existant. Don’t mind it.

I’ll answer questions about the script in a different post. It’ll be easier this way I think.

Edit: Forgotten stuff


(MadJack) #3

Well, I reread and tri-read :wink: what you wrote and I can’t really answer as I don’t know what is not working neither what that test map is supposed to be doing.

Can you tell us that?


(Charming_Fox) #4

of course, the test map should behave exactly the same as the oasis wall/forward spawn point… but the flag doesn’t start out owned by axis, both teams spawn at the flag regardless of who owns it, the pseudo-wall can be shot/knifed and if you dynamite it, it doesnt blow up, it’s as if the map isnt even looking at the script at all or that my script doesn’t have the necessary ingredients to call up the procedures, but as far as i can tell everything is named correctly and in the right place.


(MadMaximus) #5

you have 2 closing brackets at the bottom of uyour script, get rid of 1, and u need a closing bracket for yuour game_manager area, from what i can see…


(MadJack) #6

As MadMaximus said, move that last curly brace just right there


   } 
}  // <-------- here!
oldcityflag 
{ 

As for the “old city wall”, you have to make a brush and make it a func_explosive. Set the entity’s keys/values. Then make another brush at the base of that wall, about 128 units high, width should be where you want the dynamite to be planted. Make that a trigger_objective_info, link it to the func_explosive and don’t forget to set its keys/values. That should make it blowable.


(Charming_Fox) #7

HAPPY ME!!!
Thank you guys, it kind of works now!!! i just have to fix a couple of little detaisl and it might be ok, then it’s onto the next problem :slight_smile: :slight_smile: :smiley:


(Charming_Fox) #8

IT WOKS!!! IT COMPLETELY TOTALLY AND UTTERLY WORKS PERFECTLY!!! Exactly the same as in Oasis, everything works perfectly!!! YAY!