PDA

View Full Version : How I hate Scripting


DaRkFiRe
13th September 2003, 00:19
I'm getting that Error At line 486, "}" expected, end of script found. Does anybody see anything wrong with it?




game_manager
{
spawn
{
// Set scenario information

wm_axis_respawntime 15
wm_allied_respawntime 15
wm_number_of_objectives 2
wm_set_round_timelimit 15


wm_objective_status 1 0 0
wm_objective_status 2 0 0
wm_objective_status 3 0 0
wm_objective_status 4 0 0

wm_set_defending_team 0
wm_setwinner 0

trigger checkgame
}
wm_setwinner 1
wait 1000
wm_endround

accum 1 set 0
accum 2 set 0

wait 2000

setautospawn "Axis Spawn" 0
setautospawn "Allies Spawn" 1

}

trigger allies_flag
{

wm_objective_status 6 1 1
wm_objective_status 6 0 0

wm_announce "Allies capture the forward bunker!"

}

trigger axis_flag
{

wm_objective_status 6 0 1
wm_objective_status 6 1 0

wm_announce "Axis capture the forward bunker!"



}

}

// ================================================
// ============ FORWARD SPAWN ==============
// ================================================

forward_spawn
{
spawn
{
// accum 3 set 2 // 0-Axis, 1-Allied
}


trigger axis_capture
{

accum 3 abort_if_not_equal 1

accum 3 set 0

trigger game_manager axis_flag

setautospawn "Forward Spawn" 0
setautospawn "Allies Spawn" 1

wait 1000

// *----------------------------------- vo ------------------------------------------*
wm_teamvoiceannounce 0 "radar_axis_bunker_stop"

wm_teamvoiceannounce 1 "radar_allies_bunker_capture"

wm_addteamvoiceannounce 0 "radar_axis_bunker_stop"

wm_addteamvoiceannounce 1 "radar_allies_bunker_capture"
// *---------------------------------------------------------------------------------*
}

trigger allied_capture
{

accum 3 abort_if_not_equal 0

accum 3 set 1

trigger game_manager allies_flag

setautospawn "Axis Spawn" 0
setautospawn "Forward Spawn" 1

wait 1000

// *----------------------------------- vo ------------------------------------------*
wm_teamvoiceannounce 0 "radar_axis_bunker_captured"

wm_teamvoiceannounce 1 "radar_allies_bunker_captured"

wm_addteamvoiceannounce 0 "radar_axis_bunker_captured"

wm_addteamvoiceannounce 1 "radar_allies_bunker_captured"
// *---------------------------------------------------------------------------------*

}

}




bunker_wall
{
spawn
{
wait 200
constructible_class 3
}

death
{
wm_announce "The Allies have breached the Bunker Wall!"
}

}

crates
{
spawn
{
wait 200
constructible_class 3
}

death
{
wm_announce "The Allied team has destroyed the Ammo Supply!"
trigger game_manager checkgame
}

}


ammodefense
{
spawn
{
wait 200
constructible_class 2
}

death
{
wm_announce "The Allied team has breached the Ammo Defense!"
}

}

// ================================================
// ============ NEUTRAL COMMAND POST ==============
// ================================================

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
}

}

// ================================
// ======= REMOVE LMS STUFF =======
// ================================

// LMS Command Post
neutral_compost_toi_lms
{
spawn
{
wait 50
setstate neutral_compost_toi_lms invisible
}
}

neutral_compost_clip_lms
{
spawn
{
wait 400
remove
}
}

neutral_compost_closed_clip_lms
{
spawn
{
wait 400
remove
}
}

neutral_compost_closed_model_lms
{
spawn
{
wait 400
remove
}
}

allied_compost_built_lms
{
spawn
{
wait 400
remove
}
}

allied_compost_built_model_lms
{
spawn
{
wait 400
remove
}
}

axis_compost_built_lms
{
spawn
{
wait 400
remove
}
}

axis_compost_built_model_lms
{
spawn
{
wait 400
remove
}

}

Mean Mr. Mustard
13th September 2003, 00:22
game_manager
{
spawn
{
// Set scenario information

wm_axis_respawntime 15
wm_allied_respawntime 15
wm_number_of_objectives 2
wm_set_round_timelimit 15


wm_objective_status 1 0 0
wm_objective_status 2 0 0
wm_objective_status 3 0 0
wm_objective_status 4 0 0

wm_set_defending_team 0
wm_setwinner 0

trigger checkgame
}
wm_setwinner 1
wait 1000
wm_endround

accum 1 set 0
accum 2 set 0

wait 2000

setautospawn "Axis Spawn" 0
setautospawn "Allies Spawn" 1

}

One error, you have a rogue "}" after trigger checkgame

DaRkFiRe
13th September 2003, 00:39
Didn't work. Now I get this error: G_ScriptParse: Trigger must have a name and identifier: endgame.



game_manager
{
spawn
{
// Set scenario information

wm_axis_respawntime 15
wm_allied_respawntime 15
wm_number_of_objectives 2
wm_set_round_timelimit 15


wm_objective_status 1 0 0
wm_objective_status 2 0 0
wm_objective_status 3 0 0
wm_objective_status 4 0 0

wm_set_defending_team 0
wm_setwinner 0

trigger endgame

// Set the round winner: 0 == AXIS, 1 == ALLIED
wm_setwinner 0
wm_endround

accum 1 set 0
accum 2 set 0

wait 2000

setautospawn "Axis Spawn" 0
setautospawn "Allies Spawn" 1

}

Mean Mr. Mustard
13th September 2003, 01:16
oops! my bad. I thought you were calling a trigger. Were you actuallydefining trigger checkgame?

If so, first move it out of the spawn fragment. Then create a new fragment

spawn
{
blah blah
}

trigger checkgame
{
stuff here for this routine (probably wm_setwinner and wm_endround)
}

DaRkFiRe
13th September 2003, 01:30
Hmm, can you add that into my above posts' script?

Mean Mr. Mustard
13th September 2003, 02:24
Not sure if this is want you want, but....

game_manager
{
spawn
{
// Set scenario information

wm_axis_respawntime 15
wm_allied_respawntime 15
wm_number_of_objectives 2
wm_set_round_timelimit 15


wm_objective_status 1 0 0
wm_objective_status 2 0 0
wm_objective_status 3 0 0
wm_objective_status 4 0 0

wm_set_defending_team 0
wm_setwinner 0

accum 1 set 0
accum 2 set 0

wait 2000

setautospawn "Axis Spawn" 0
setautospawn "Allies Spawn" 1

}

trigger checkgame
{
wm_setwinner 1
wait 1000
wm_endround
}

trigger allies_flag
{

wm_objective_status 6 1 1
wm_objective_status 6 0 0

wm_announce "Allies capture the forward bunker!"

}

trigger axis_flag
{

wm_objective_status 6 0 1
wm_objective_status 6 1 0

wm_announce "Axis capture the forward bunker!"
}

}


The way I understand it, everything in spawn happens when the map starts. So you are initializing a bunch of variables. You call triggers to change that data (among other things). So, in the above script, doing from somewhere else (after the allies have completed some task)

trigger game_manager checkgame

will set the allied side to when, then end the round. Is that waht you wanted?

DaRkFiRe
13th September 2003, 02:29
Yes, Danke!

flashkillaman
26th September 2003, 13:23
how to make a .script file?
where to place it to test map