Boktor's Project


(Boktor) #41

Good point. All my map files are in maps/techbuster/
I changed it now to:

mapMetaData maps/techbuster/ {

but the script still isn’t doing anything. Messages on the sys.print lines don’t show on the console.

I do get a bunch of warnings though. I don’t know why…
script/misc/objective.script(57): Thread ": Tried to localize an empty string
script/misc/objective.script(57): Thread ‘idPlayer_player_edf_0’: Tried to localize an empty string


(Boktor) #42

Here are the contents of \SDK 1.5\base\maps echbuster

edit: hold on file uploader isn’t good quality


(Boktor) #43

These are the contents of my map folder
…\SDK 1.5\base\maps echbuster


(Donnovan) #44

I believe you have the files in the wrong place.

Try to create a folder like C:\ETQW Custom echbuster and them put those files there. Example of what you got:

  • pakmeta.conf shound be in C:\ETQW Custom echbuster\pakmeta.conf
  • techbuster.mtr should be in C:\ETQW Custom echbuster\materials echbuster.mtr
  • techbuster.script should be in C:\ETQW Custom echbuster\script\maps echbuster.script
  • and so on…

Then configure your SDK Launcher “SAVE PATH” option like that:

Then create a new mod called techbuster (you need to recreate it).

I believe this can help.


(Boktor) #45

Thanks, Donnovan!

Now when my script has bad lines the map refuses to start, which is a good sign! I followed everything you said and now the script is being recognized.

You guys are a huge help. Will keep you updated.


(.Chris.) #46

Also to keep things tidy, create a new ‘mod’ to work on your map from the SDK launcher incase you haven’t already, it will keep all your files away from the base files so you dont accidently overwrite anything. Note how on Don’s image he’s using mod name of his map.


(Boktor) #47

Yep I just did that exactly. I do notice that file management is cleaner this way.


(Donnovan) #48

Boktor,

What is the script error you is having now?


(Boktor) #49

Ok 2 big issues right now

  1. Spawns don’t work
  2. The game doesn’t end when the objective blows up

So to explain the spawns I made this:

and then finally in the script file, I have the lines


	entity          gdfBaseSpawn;
	entity          stroggBaseSpawn;

and farther down

        gdfBaseSpawn            = worldspawn.getEntityKey( "script_gdf_base_spawn" );
        stroggBaseSpawn         = worldspawn.getEntityKey( "script_strogg_base_spawn" );
	gdfBaseSpawn.setGameTeam( gdfTeam );
	stroggBaseSpawn.setGameTeam( stroggTeam );

When I start the game, on either team I spawn in a default point in the middle of the map
Am I missing something? Any advice for this?


(Donnovan) #50

I noticed that on this image you have a “merge_” before the spawn name, on the worldspawn key:

“merge_script_gdf_base_spawn” “gdf_base_spawnmaster”

So on the script you need also to put that “merge_” thing, like that:

gdfBaseSpawn            = worldspawn.getEntityKey( "[b]merge_[/b]script_gdf_b...

May be you can recreate the key on the map worldspawn just removing the “merge_”.


(Boktor) #51

I’ve tried all 4 possible combinations of merge_script and script in worldspawn and map script. None seem to work.

Here’s the full script I’m trying to get working in case anyone wants to look.
Very early on I put in a sys.print line, but I still don’t see any text output to the console.

#define OBJECTIVE_TECHBUSTER_DESTROY_TECH       0

object mapObject_techbuster : mapObject_Default {
  	void		preinit();
	void		InitObjectives();
	void		CompleteObjective( float index, entity p );
	void		StartFirstObjective();
	void		OnTechDestroyed();
	void		OnTimeLimitHit();

	handle          GetObjectiveMessage( float index );

	float		mainObjectiveIndex;
	entity	        techDestruction;
	entity          gdfBaseSpawn;
	entity          stroggBaseSpawn;
	entity          objective1Marker;


}

mapObject_Base techbuster_MapScript() {
	return new mapObject_techbuster;
}

void mapObject_techbuster::preinit() {
}

void mapObject_techbuster::InitObjectives() {

        sys.print( "*****LOADED TECHBUSTER SCRIPT*****" );

	gameRules.setWinningTeam( gdfTeam );
	gdfTeam.SetRespawnWait( 20 );
	stroggTeam.SetRespawnWait( 20 );
	CreateRespawnTimeThread( gdfTeam );


	// Spawn points
	gdfBaseSpawn            = worldspawn.getEntityKey( "merge_script_gdf_base_spawn" );
        stroggBaseSpawn         = worldspawn.getEntityKey( "merge_script_strogg_base_spawn" );

        // Objective
	techDestruction         = worldspawn.getEntityKey( "script_destroy_entity" );

	objective1Marker        = worldspawn.getEntityKey( "script_obj1_marker" );

	gdfBaseSpawn.setGameTeam( gdfTeam );
	stroggBaseSpawn.setGameTeam( stroggTeam );

	objective1Marker.vStartObjective();

        thread	StartFirstObjective();

        mainObjectiveIndex = OBJECTIVE_TECHBUSTER_DESTROY_TECH;
        objManager.setNextObjective( gdfTeam, mainObjectiveIndex );
	objManager.setNextObjective( stroggTeam, mainObjectiveIndex );

}

void mapObject_techbuster::StartFirstObjective() {
	sys.wait( 5.f );

	objManager.SetObjectiveEntity( techDestruction, mainObjectiveIndex );

	CreateInitialTimedMission( techDestruction );
	techDestruction.vCreateMission();
	techDestruction.vStartObjective();

}

void mapObject_techbuster::CompleteObjective( float index, entity p ) {

	if ( index == OBJECTIVE_TECHBUSTER_DESTROY_TECH ) {
		OnTechDestroyed();
	}
}

handle mapObject_techbuster::GetObjectiveMessage( float index ) {
	if ( index == OBJECTIVE_TECHBUSTER_DESTROY_TECH ) {
		return sys.localizeString( "maps/valley/obj_contaminator" );
	}

	return g_locStr_BadObjective;
}

void mapObject_techbuster::OnTechDestroyed() {
        objective1Marker.vFinishObjective();

	StopTimedMission();
	techDestruction.vFinishObjective();

	gameRules.setWinningTeam( gdfTeam );
	gameRules.endGame();
	
        techDestruction.vCompleteMission();

}

void mapObject_techbuster::OnTimeLimitHit() {
	FinishTimedMission();
	objManager.SetObjectiveEntity( $null_entity, -1 );
}



(.Chris.) #52

You only use merge_script_ in your map references, there is no need to include “merge_” when calling for it in the mapscript. For entities in the main .world file just use “script_”

Do you get any errors what so ever in the console? You said before you had some so it was reading the script before.


(Donnovan) #53

If you use merge_ on the worldspawn you must use merge_ on the script, if you dont use merge_ on the worldspawn then you must not use merge_ on the script they must have the same name. The script points to the worldspawn key to get its value, this is why they must be exactly the same.


(.Chris.) #54

No you don’t, the “merge_” part is ignored when you use it in the worldspawn of a reference and is only there so the main.world knows to include the worldspawn keys and values from that map reference. If you just use “script_name” in a map reference instead of “merge_script_name” the game wont be able to find it.

So just to clarify Boktor. If these spawn entities are in the main .world file which you use to compile the map then you don’t need to prefix “merge_” in the worldspawn. However if they are in a map reference you do need to use “merge_” in the worldspawn but you don’t need to use the prefix when calling for it in the map’s .script.


(Boktor) #55

Ah I understand.
Well I don’t have anything in references that needs worldspawn keys, so I am only using “script_name” now. Spawns still don’t work though, no idea why.

Not anymore, but If I add bad lines somewhere I will get an error and the map will refuse to start. For example, if I put “sys.print( “LOADED TECHBUSTER SCRIPT” );” in the block where I’m declaring entities, the map won’t start.


(Boktor) #56

Hmm turns out the spawns work when you take off the “owner” key. But then the spawn masters are unused.


(.Chris.) #57

Do you have all the playzones and stuff setup? Think they are required for spawn masters to work, not sure though. Good luck with those, they are a pain in the arse.


(Donnovan) #58

I will say you something when i reach my home and compare your script with mine.

Thanks Chris for the explanation about the “merge_” thing.


(Boktor) #59

No, I was hoping I could skip on some of because it is a single-objective indoor map.

Unrelated question:
In a lot of scripts I see

void	destroy();

and then later, right before setting up objectives and stuff

void mapObject_techbuster::destroy() {
}

what is this?


(Boktor) #60

Hey guys, I’ve picked up my mapping again and did a lot this week. Instead of focusing on “Techbuster” right now I’m following the tutorial for the etqwmap that comes with the SDK and replicating it in my own map as I go along.
http://wiki.splashdamage.com/index.php/Barebones_Map_script

Folders and files are set up in the right places (hopefully), and I have objectives and everything set up in the .world. Basically I’ve done everything in the list, but script is where I’m stuck (again).

Ok so call my world “redfire”

Of course previously I was able to playtest my map with the devmap command in SDK, but now that I’ve set up other files to allow redfire.script to run with the map it won’t start and I get errors:

--------- Game Map Init ------------
Initializing scripts
WARNING: file script/maps/redfire.script, line 1: redefinition of 'OBJECTIVE_REDFIRE_BUILD_BRIDGE'
WARNING: file script/maps/redfire.script, line 2: redefinition of 'OBJECTIVE_REDFIRE_CAPTURE_OUTPOST'
WARNING: file script/maps/redfire.script, line 3: redefinition of 'OBJECTIVE_REDFIRE_HACK_OBJECTIVE'
WARNING: file script/maps/redfire.script, line 4: redefinition of 'OBJECTIVE_REDFIRE_DESTROY_OBJECTIVE'
--------- Game Map Shutdown ----------
--------------------------------------
********************
ERROR: Error: file script/maps/redfire.script, line 6: ":" is not a type
********************

Here’s the entire script, basically same as etqwmap.script but removed some spawns

#define OBJECTIVE_REDFIRE_BUILD_BRIDGE			0
#define OBJECTIVE_REDFIRE_CAPTURE_OUTPOST		1
#define OBJECTIVE_REDFIRE_HACK_OBJECTIVE		2
#define OBJECTIVE_REDFIRE_DESTROY_OBJECTIVE		3

object mapObject_Redfire : mapObject_Default {
        void                    InitObjectives();

	void			CompleteObjective( float index, entity p );
	handle			GetObjectiveMessage( float index );

	void			OnBridgeBuilt();
	void			OnOutpostCaptured();
	void			OnHackObjective();
	void			OnDeviceDestroyed();

	void			PostBridgeBuiltAudio();
	void			StartShieldObjective();
	void			StartFirstObjective();
	void			OnShieldDestroyedScud( entity trigger );

	vector			GetGDFBasePosition() { return '9800 -10870 2080'; }

	void			OnTimeLimitHit();

	void			OnShieldHacked();

	void			OnShieldDeployed( entity obj, entity trigger );
	void			OnHackComplete( entity obj );
	void			OnMCPSpawned( entity obj );
	void			OnMCPDestroyed( entity obj, vector newLocation, vector newAngles );
	void			OnMCPDelivered( entity obj );

	void			ClearMCPData();

	float			mainObjectiveIndex;

	entity			gdfBaseTerritory;
	entity			bridgeTerritory;
	entity			outpostTerritory;
	entity			stroggBaseTerritory;
	entity			shieldTerritory;

	entity			objective1Marker;
	entity			objective2Marker;
	entity			objective3Marker;
	entity			objective4Marker;


	entity 			stroggBaseSpawn;
	entity 			gdfBaseSpawn;
        entity 			gdfOutpostSpawn;

	entity			bridgeConstruction;
	entity			device;

	entity			scudTrigger;

	entity			mcpRoute;
	entity			mcpCaller;
	entity			shieldCaller;

	entity			currentMCP;
}

mapObject_Base Redfire_MapScript() {
	return new mapObject_Redfire;
}

void mapObject_Redfire::InitObjectives() {

	sys.print( "*****LOADED ETQW MAP SCRIPT*****
" );
	
	gameRules.setWinningTeam( stroggTeam );
	gdfTeam.SetRespawnWait( 20 );
	stroggTeam.SetRespawnWait( 20 );
	CreateRespawnTimeThread( gdfTeam );

	gdfBaseTerritory		= worldspawn.getEntityKey( "script_gdf_base_territory" );
	bridgeTerritory			= worldspawn.getEntityKey( "script_bridge_territory" );
	outpostTerritory		= worldspawn.getEntityKey( "script_outpost_territory" );
	shieldTerritory			= worldspawn.getEntityKey( "script_shield_territory" );
	stroggBaseTerritory		= worldspawn.getEntityKey( "script_strogg_base_territory" );
	
	objective1Marker		= worldspawn.getEntityKey( "script_obj1_marker" );
	objective2Marker		= worldspawn.getEntityKey( "script_obj2_marker" );
	objective3Marker		= worldspawn.getEntityKey( "script_obj3_marker" );
	objective4Marker		= worldspawn.getEntityKey( "script_obj4_marker" );

	bridgeConstruction		= worldspawn.getEntityKey( "script_bridge_materials" );
	device					= worldspawn.getEntityKey( "script_strogg_device" );

	stroggBaseSpawn			= worldspawn.getEntityKey( "script_strogg_base_spawn" );

	gdfBaseSpawn			= worldspawn.getEntityKey( "script_gdf_base_spawn" );
	gdfOutpostSpawn			= worldspawn.getEntityKey( "script_gdf_outpost_spawn" );

	mcpRoute				= worldspawn.getEntityKey( "script_mcp_route" );
	mcpCaller				= worldspawn.getEntityKey( "script_mcp_caller" );
	shieldCaller			= worldspawn.getEntityKey( "script_shieldgen_caller" );

	gdfBaseSpawn.setGameTeam( gdfTeam );
	stroggBaseSpawn.setGameTeam( stroggTeam );
	gdfOutpostSpawn.setGameTeam( $null_entity );

	objective1Marker.vStartObjective();
	objective2Marker.vFinishObjective();
	objective3Marker.vFinishObjective();
	objective4Marker.vFinishObjective();

	thread StartFirstObjective();

	mainObjectiveIndex = OBJECTIVE_REDFIRE_BUILD_BRIDGE;
	objManager.setNextObjective( gdfTeam, mainObjectiveIndex );
	objManager.setNextObjective( stroggTeam, mainObjectiveIndex );
}

void mapObject_Redfire::CompleteObjective( float index, entity p ) {
	if ( index == OBJECTIVE_REDFIRE_BUILD_BRIDGE ) {
		OnBridgeBuilt();
	} else if ( index == OBJECTIVE_REDFIRE_CAPTURE_OUTPOST ) {
		OnOutpostCaptured();
	} else if ( index == OBJECTIVE_REDFIRE_HACK_OBJECTIVE ) {
		OnHackObjective();
	} else if ( index == OBJECTIVE_REDFIRE_DESTROY_OBJECTIVE ) {
		OnDeviceDestroyed();
	}
}

void mapObject_Redfire::OnShieldDeployed( entity obj, entity trigger ) {
	scudTrigger = trigger;
	scudTrigger.vStartObjective();
}

void mapObject_Redfire::OnHackComplete( entity obj ) {
	if ( obj == scudTrigger ) {
		OnShieldHacked();
	}
}

void mapObject_Redfire::ClearMCPData() {
	if ( currentMCP != $null_entity ) {
		currentMCP.vFreeMission();
		currentMCP = $null_entity;
	}
}

void mapObject_Redfire::OnMCPSpawned( entity obj ) {
	ClearMCPData();
}

void mapObject_Redfire::OnMCPDestroyed( entity obj, vector newLocation, vector newAngles ) {
	if ( currentMCP != obj ) {
		return;
	}

	ClearMCPData();

	mcpCaller.vCallDrop( newLocation, newAngles );
}

void mapObject_Redfire::OnMCPDelivered( entity obj ) {
	ClearMCPData();

	if ( mainObjectiveIndex == OBJECTIVE_REDFIRE_CAPTURE_OUTPOST ) {
		currentMCP = obj;
		objManager.SetObjectiveEntity( currentMCP, mainObjectiveIndex );
		currentMCP.vSetGoalMarker( objective2Marker );
		currentMCP.vSetPathTargets( mcpCaller.getWorldOrigin(), objective2Marker.getWorldOrigin() );
		currentMCP.setTrackerEntity( mcpRoute );
		CreateInitialTimedMission( currentMCP );
		currentMCP.vCreateMission();
	}
}

handle mapObject_Redfire::GetObjectiveMessage( float index ) {
	if ( index == OBJECTIVE_REDFIRE_BUILD_BRIDGE ) {
		return sys.localizeString( "maps/valley/obj_bridge" );
	}

	if ( index == OBJECTIVE_REDFIRE_CAPTURE_OUTPOST ) {
		return sys.localizeString( "maps/valley/obj_outpost" );
	}

	if ( index == OBJECTIVE_REDFIRE_HACK_OBJECTIVE ) {
		return sys.localizeString( "maps/valley/obj_depot" );
	}

	if ( index == OBJECTIVE_REDFIRE_DESTROY_OBJECTIVE ) {
		return sys.localizeString( "maps/valley/obj_contaminator" );
	}

	return g_locStr_BadObjective;
}

void mapObject_Redfire::OnShieldHacked() {
	objManager.SetObjectiveEntity( $null_entity, -1 );
	StopTimedMission();
	scudTrigger.vCompleteMission();
}


void mapObject_Redfire::OnBridgeBuilt() {
	
	mainObjectiveIndex = OBJECTIVE_REDFIRE_CAPTURE_OUTPOST;
	objManager.setNextObjective( gdfTeam, mainObjectiveIndex );
	objManager.setNextObjective( stroggTeam, mainObjectiveIndex );

	objective1Marker.vFinishObjective();
	objective2Marker.vStartObjective();
		
	bridgeTerritory.setGameTeam( gdfTeam );

	gdfBaseTerritory.setActive( false );
	bridgeTerritory.setActive( true );
	outpostTerritory.setActive( true );

	objManager.SetObjectiveEntity( $null_entity, -1 );

	StopTimedMission();
	bridgeConstruction.vCompleteMission();

	mcpCaller.vOnDeploy();

	thread PostBridgeBuiltAudio();
	
	gdfTeam.SetRespawnWait( 15 );
	ResetRespawnTimeThread();
		
}

void mapObject_Redfire::OnOutpostCaptured() {
	mainObjectiveIndex = OBJECTIVE_REDFIRE_HACK_OBJECTIVE;
	objManager.setNextObjective( gdfTeam, mainObjectiveIndex );
	objManager.setNextObjective( stroggTeam, mainObjectiveIndex );

	gdfOutpostSpawn.setGameTeam( gdfTeam );

	outpostTerritory.setGameTeam( gdfTeam );

	objective2Marker.vFinishObjective();
	objective3Marker.vStartObjective();

	objManager.SetObjectiveEntity( $null_entity, -1 );

	if ( currentMCP != $null_entity ) {
		currentMCP.vCompleteMission();
	}
	StopTimedMission();

	shieldCaller.vOnDeploy();

	G_PlayObjectiveCompletedRoll( GDF );
	objManager.PlaySound( worldspawn.getKey( "snd_outpost_captured_strogg" ), stroggTeam );
	objManager.PlaySound( worldspawn.getKey( "snd_outpost_captured_gdf" ), gdfTeam );
	
	gdfTeam.SetRespawnWait( 20 );
	stroggTeam.SetRespawnWait( 20 );
	ResetRespawnTimeThread();
}

void mapObject_Redfire::OnHackObjective() {

	sys.print( "*****SHIELD HACKED*****
" );
	
	mainObjectiveIndex = OBJECTIVE_REDFIRE_DESTROY_OBJECTIVE;
	objManager.setNextObjective( gdfTeam, mainObjectiveIndex );
	objManager.setNextObjective( stroggTeam, mainObjectiveIndex );

	objective3Marker.vFinishObjective();
	objective4Marker.vStartObjective();

	device.vStartObjective();

	shieldTerritory.setGameTeam( gdfTeam );

	scudTrigger.vFreeMission();

	objManager.SetObjectiveEntity( device, mainObjectiveIndex );
	CreateInitialTimedMission( device );
	device.vCreateMission();
	
	gdfTeam.SetRespawnWait( 20 );
	stroggTeam.SetRespawnWait( 20 );
	ResetRespawnTimeThread();
}

void mapObject_Redfire::OnDeviceDestroyed() {
	objective4Marker.vFinishObjective();

	StopTimedMission();
	device.vFinishObjective();;

	gameRules.setWinningTeam( gdfTeam );
	gameRules.endGame();

	device.vCompleteMission();
}

void mapObject_Redfire::PostBridgeBuiltAudio() {
	sys.wait( 10.f );

	objManager.PlaySound( worldspawn.getKey( "snd_mcp_intro_strogg" ), stroggTeam );
	objManager.PlaySound( worldspawn.getKey( "snd_mcp_intro_gdf" ), gdfTeam );
}

void mapObject_Redfire::StartShieldObjective() {
	sys.wait( 5.f );

	scudTrigger.vSetActive( true );
	CreateInitialTimedMission( scudTrigger );
	scudTrigger.vCreateMission();
	objManager.SetObjectiveEntity( scudTrigger, mainObjectiveIndex );
}

void mapObject_Redfire::OnShieldDestroyedScud( entity trigger ) {
	thread StartShieldObjective();
}

void mapObject_Redfire::StartFirstObjective() {
	sys.wait( 5.f );

	objManager.SetObjectiveEntity( bridgeConstruction, mainObjectiveIndex );

	CreateInitialTimedMission( bridgeConstruction );
	bridgeConstruction.vCreateMission();
	bridgeConstruction.vStartObjective();
}

void mapObject_Redfire::OnTimeLimitHit() {
	FinishTimedMission();
	objManager.SetObjectiveEntity( $null_entity, -1 );

	objManager.PlaySound( worldspawn.getKey( "snd_gdflose_strogg" ), stroggTeam );
	objManager.PlaySound( worldspawn.getKey( "snd_gdflose_gdf" ), gdfTeam );
}

No idea why the error. Something wrong with my colon? I eat plenty of fiber :o