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