Cannot get constructables to function properly


(Ifurita) #1

I have a total of 5 constructable gates/barriers. I created the first one, wrote the script, based on the relevant link in the sticky thread - no go.

  1. Doublechecked my keys and origin brushes and they look fine.
  2. Did some more searching and found that I needed a script_multiplayer to initiate the game manager.

After that, the first constructable worked. I copied the relevent entities/models/brushes to the other locations and edited all of the proper keys and now, I can construct them, I can blow up the finished constructs, but the game never recognizes that I finished building them, e.g., no XP, no announcement, crates don’t disappear.

  1. Ungrouped all the entities at one gate and re-entered all the keys - no go
  2. Then, someone told me that replicating origin brushes was a bad thing, so I removed those and created new ones, linked to the right script_mover, TOI and func_constructable - still no go

Here is the script I am using. They are all clones of the first one, which works fine. This is driving me nuts:


//
// Map: Zeppelin Raid
// BSP: zeppelin

game_manager
{
	spawn 
   	{
   	}
} 


// Constructables ------------------------------------------------------------------------------------------------
//Ammunition Supply Point Gate

	aspgate_script
	{ 
		spawn 
		{ 
			wait 200 
			constructible_class 2 
			trigger self startup 
		} 
	
		buildstart final 
		{ 
		} 

		built final 
		{ 
			setstate aspgate default 
			setstate aspgate_materials invisible 
			wm_announce "Allied team has built the ASP Gate!" 
		} 

		decayed final 
		{ 
			trigger self startup 
		} 

		death 
		{ 
			trigger self startup 
			wm_announce "Axis team has destroyed the ASP Gate!" 
		} 

		trigger startup 
		{ 
			setstate aspgate invisible 
			setstate aspgate_materials default 
		} 
	}

\\Ammunition Supply Point Fence Breach

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

		buildstart final 
		{ 
		} 

		built final 
		{ 
			setstate aspbreach default 
			setstate aspbreach_materials invisible 
			wm_announce "Allied team has repaired the ASP Fence Breach!" 
		} 

		decayed final 
		{ 
			trigger self startup 
		} 

		death 
		{ 
			trigger self startup 
			wm_announce "Axis team has breached the ASP Fence!" 
		} 

		trigger startup 
		{ 
			setstate aspbreach invisible 
			setstate aspbreach_materials default 
		} 
	}

\\Motor Pool Gate ------------------------------------------------

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

		buildstart final 
		{ 
		} 

		built final 
		{ 
			setstate mpgate default 
			setstate mpgate_materials invisible 
			wm_announce "Allied team has built the Motor Pool Gate!" 
		} 

		decayed final 
		{ 
			trigger self startup 
		} 	

		death 
		{ 
			trigger self startup 
			wm_announce "Axis team has destroyed the Motor Pool Gate!" 
		} 

		trigger startup 
		{ 
			setstate mpgate invisible 
			setstate mpgate_materials default 
		} 
	}

//Fuel Dump Gate

	fdgate_script 
	{ 
		spawn 
		{ 
			wait 200 
			constructible_class 2 
			trigger self startup 
		} 
	
		buildstart final 
		{ 
		} 

		built final 
		{ 
			setstate fdgate default 
			setstate fdgate_materials invisible 
			wm_announce "Axis team has built the Fuel Dump Gate!" 
		} 

		decayed final 
		{ 
			trigger self startup 
		} 

		death 
		{ 
			trigger self startup 
			wm_announce "Allied team has destroyed the Fuel Dump Gate!" 
		} 

		trigger startup 
		{ 
			setstate fdgate invisible 
			setstate fdgate_materials default 
		} 
	}

\\Fuel Dump Fence Breach

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

		buildstart final 
		{ 
		} 

		built final 
		{ 
			setstate fdbreach default 
			setstate fdbreach_materials invisible 
			wm_announce "Axis team has repaired the Fuel Dump Fence Breach!" 
		} 

		decayed final 
		{ 
			trigger self startup 
		} 

		death 
		{ 
			trigger self startup 
			wm_announce "Allied team has breached the Fuel Dump Fence!" 
		} 

		trigger startup 
		{ 
			setstate fdbreach invisible 
			setstate fdbreach_materials default 
		} 
	}

//Destructable objectives

//Fuel Dump
	fueldump_script
	{
		spawn // this is called when the game starts and the entity is spawned
		{
			wait 200
			constructible_class 3 // this indicated that the oasis_wall entity is a dynamitable-only entity... 
		}

		death // this is called when the entity is destroyed... 
		{
			wm_announce "Allies have destroyed the Fuel Dump Control Room"
			setstate fueldump invisible
		}
	}
}



(damocles) #2

The only thing I can think of off the top of my head is that you don’t need stage names in single stage constructions. Where you have “built final”, you could use “built”. Dunno if that’s a problem or not though.

Why aren’t you using the underconstruction stage for the entites? You seem to have empty buildstart functions.

As a side question - why are you making your spawn function trigger a function int he same entity? Why not simply put those two lines in the triggered function into the spawn function? It’ll result in smaller and neater/easier to read code.

and afaik you can replicate origin brushes to your hearts content. It’s certainly never given me trouble. It’s only a bad thing to replicate them on their own - an entity consisting of just an origin brush would cause the game to crash on startup.


(Mean Mr. Mustard) #3

A script is not necessary for a func_constructible to work in a map (just tried it). Of course, you want a script so you can do more game control. So, your script might not be working at all - ie. not being read.

Try this:

  1. Make sure the script name is the same as the map name.
  2. Add a wait 2000 in game_manager/spawn
  3. Add a wm_announce “In script” (or something) in game_manager spawn to see if your script is being called at all

The script looks correct, so that’s why I suggested the above. I noticed your map name and bsp name are different. What is your script name?

Hope this helps - if not I’m willing to look at the script/map combo if you’re willing to let me see it.


(Ifurita) #4

The script is definately being read. It properly returned the ‘sound check’ in game manager/spawn and the first constructable script ‘aspgate_script’ works as expected.

Here is my map file - any insight you could provide would be much appreciated - since I’m beating my head against the table right now.

http://www.rtcwonline.com/dummies/maps/map-debugging.zip

The map and script are called zeppelin-0917-1600.[extension]. I keep time stamping new versions as I tryout new things or make major additions so that I can always revert back to earlier work. When I do, I make a copy of both the .map and the .script files.

Thanks


(Mean Mr. Mustard) #5

Got it:

The comment lines start with // not \ !!! Totally missed it:

This worked for me (mp gate at least)

//
// Map: Zeppelin Raid
// BSP: zeppelin

game_manager
{
	spawn 
   	{
	wait 2000
	wm_announce "Sound check! Sound check" 
   	}
} 


// Constructables 

------------------------------------------------------------------------------------------------

//Motor Pool Gate ------------------------------------------------

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

		buildstart final 
		{ 
		} 

		built final 
		{ 
			setstate mpgate default 
			setstate mpgate_materials invisible 
			wm_announce "Allied team has built the Motor Pool Gate!" 
		} 

		decayed final 
		{ 
			trigger self startup 
		} 	

		death 
		{ 
			trigger self startup 
			wm_announce "Axis team has destroyed the Motor Pool Gate!" 
		} 

		trigger startup 
		{ 
			setstate mpgate invisible 
			setstate mpgate_materials default 
		} 
	}

//Ammunition Supply Point Gate

	aspgate_script
	{ 
		spawn 
		{ 
			wait 200 
			constructible_class 2 
			trigger self startup 
		} 
	
		buildstart final 
		{ 
		} 

		built final 
		{ 
			setstate aspgate default 
			setstate aspgate_materials invisible 
			wm_announce "Allied team has built the ASP Gate!" 
		} 

		decayed final 
		{ 
			trigger self startup 
		} 

		death 
		{ 
			trigger self startup 
			wm_announce "Axis team has destroyed the ASP Gate!" 
		} 

		trigger startup 
		{ 
			setstate aspgate invisible 
			setstate aspgate_materials default 
		} 
	}

//Ammunition Supply Point Fence Breach

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

		buildstart final 
		{ 
		} 

		built final 
		{ 
			setstate aspbreach default 
			setstate aspbreach_materials invisible 
			wm_announce "Allied team has repaired the ASP Fence Breach!" 
		} 

		decayed final 
		{ 
			trigger self startup 
		} 

		death 
		{ 
			trigger self startup 
			wm_announce "Axis team has breached the ASP Fence!" 
		} 

		trigger startup 
		{ 
			setstate aspbreach invisible 
			setstate aspbreach_materials default 
		} 
	}



//Fuel Dump Gate

	fdgate_script 
	{ 
		spawn 
		{ 
			wait 200 
			constructible_class 2 
			trigger self startup 
		} 
	
		built
		{ 
			setstate fdgate default 
			setstate fdgate_materials invisible 
			wm_announce "Axis team has built the Fuel Dump Gate!" 
		} 

		decayed
		{ 
			trigger self startup 
		} 

		death 
		{ 
			trigger self startup 
			wm_announce "Allied team has destroyed the Fuel Dump Gate!" 
		} 

		trigger startup 
		{ 
			setstate fdgate invisible 
			setstate fdgate_materials default 
		} 
	}

//Fuel Dump Fence Breach

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

		buildstart final 
		{ 
		} 

		built final 
		{ 
			setstate fdbreach default 
			setstate fdbreach_materials invisible 
			wm_announce "Axis team has repaired the Fuel Dump Fence Breach!" 
		} 

		decayed final 
		{ 
			trigger self startup 
		} 

		death 
		{ 
			trigger self startup 
			wm_announce "Allied team has breached the Fuel Dump Fence!" 
		} 

		trigger startup 
		{ 
			setstate fdbreach invisible 
			setstate fdbreach_materials default 
		} 
	}

//Destructable objectives

//Fuel Dump
	fueldump_script
	{
		spawn // this is called when the game starts and the entity is spawned
		{
			wait 200
			constructible_class 3 // this indicated that the oasis_wall entity is a 

dynamitable-only entity... 
		}

		death // this is called when the entity is destroyed... 
		{
			wm_announce "Allies have destroyed the Fuel Dump Control Room"
			setstate fueldump invisible
		}
	}

EDIT: removed a “}” on the last line


(Ifurita) #6

omg!!!

i feel like such a noob. thanks a million


(Mean Mr. Mustard) #7

I only found them because I went to comment something out and couldn’t remember if it was // or \ - I tried the wrong one and got an script error!

Looks like \ comments out everything that follows the ‘\’


(sock) #8

Final is the name of the last stage of construction, in a single stage construction there is only one, the final one. I did not realise this until I looked at multiple stage constructions.

Sock
:moo:


(damocles) #9

lol, I looked at the backslah comments and thought to myself, oh, didn’t know you could use both. It never even occurred to me it might be the problem. I just assumed if it didn’t use them it would bomb. Oh well, live and learn :slight_smile: