Wierd problem


(IGoreI) #1

I have two class 3 objectives, I want it to be open as to which one you destroy first, like oasis, where I borrowed most of the script from. if I destroy obj 1 then 2 it ends the match,if i destroy obj 2 it ends right away, but i want it to be able to go 2-1 as well, as you shouldn’t end the map with one obj destroyed. here’s my script, please help.

game_manager
{
spawn
{
accum 0 set 0 //fort spawn
accum 1 set 0 // State of objective number one
accum 5 set 0 // Corrent number of Pak 75mm guns destroyed

	globalaccum 1 set 0
	globalaccum 5 set 0

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


	// 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>
	wait 150
	setautospawn	"Fort"	1
	setautospawn	"Fort"	0
}

trigger objective_counter

{
	accum 5 inc 1				// Increase game counter
	accum 5 abort_if_not_equal 2		// All guns destroyed ?

	wait 8000

	accum 1 set 1				// Both objectives destroyed

	// Call function to check if the round has been won

	trigger game_manager checkgame

}

trigger checkgame

{
	accum 1 abort_if_not_equal 1

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

	// End the round
	wm_endround

	wait 500

}

}

fort_spawn
{
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 Fort"

	alertentity fort_wobj
	setautospawn "Fort" 0
	setautospawn "Lake" 1	

}

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 Fort"

	alertentity fort_wobj
	alertentity Caves_wobj
	setautospawn "Caves" 0
	setautospawn "Fort" 1
}


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

// ================================================
// ========== CONSTRUCTIBLE STUFF =================
// ================================================
ladder
{
spawn
{
wait 200
constructible_class 2
constructible_constructxpbonus 10
constructible_destructxpbonus 10
}
death
{
wm_announce “Axis destroyed the ladder”
}
}

// ================================================
// ========== DESTRUCTIBLE STUFF ==================
// ================================================

// Radio Tower
radio
{
spawn
{
wait 200
constructible_class 3
constructible_constructxpbonus 10
constructible_destructxpbonus 10
}

death
{
	wm_announce "Allies have destroyed the Radio Tower!"

	// Update game manager counter for objectives
	trigger game_manager objective_counter
}

}

// Rocket
v2
{
spawn
{
wait 200

	constructible_class 3
}
death
{
	wm_announce "Allied team has destroyed the Rocket"
	trigger game_manager objective_counter
}

}

// ================================================
// ======== END DESTRUCTIBLE STUFF ================
// ================================================


(Flippy) #2

hm im not sure, it looks ok-ish to me…

ive never tried this type of objective but it seems weird that you use accum 5 to count up the number of objectives destroyed, and then ALSO accum 1 to also check if both are destroyed

you cuold just aswel leave the game_manager checkgame scriptblock out and change the objective_counter to this:


trigger objective_counter
   {
        accum 5 inc 1 // Increase game counter
        accum 5 abort_if_not_equal 2 // All guns destroyed ?
 
       wait 8000      // This is a bit long ain't it?

        wm_setwinner 1
        wm_endround
   } 

Also, as indictated in the scrpit, an 8 second wait after the two guns are destroyed? that’s really long imo, what if allies destroy the last gun at 37 seconds left, they’ll all be cheering and stuff and still lose the match :blah:


(DAbell) #3

Hey IgoreI

Have a look at the script that I used for my mam ST NAZAIRE, as you can see i have two objectives like yourself and they can be destroyed in any order.

game_manager
{
	spawn
	{
		remapshaderflush
		
		// Game rules
		wm_axis_respawntime	20	
		wm_allied_respawntime	20
		wm_number_of_objectives	6	
		wm_set_round_timelimit	30

		// Objectives
		//1 Blow up Harbour Wall
		//2 Blow up South Winding House Door
		//3 Blow up South Winding Mechanism
		//4 Claim forward spawn point
		//5 Blow up North Winding Mechanism
		//6 Stop Axis from building North barricade
		
		// Current main objectives for each team (0=Axis, 1=Allies)
		wm_objective_status 1 0 0
		wm_objective_status 1 1 0
		wm_objective_status 2 0 0
		wm_objective_status 2 1 0
		wm_objective_status 3 0 0
		wm_objective_status 3 1 0
		wm_objective_status 4 0 0
		wm_objective_status 4 1 0
		wm_objective_status 5 0 0
		wm_objective_status 5 1 0
		wm_objective_status 6 0 0
		wm_objective_status 6 1 0


		//Accum values
		accum 1 set 0 //Overall Allied status
		accum 2 set 2 //set 2 = null value

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

		// Winner on expiration of round timer (0=Axis, 1=Allies, -1=no winner at expiration)
		wm_setwinner	0 //Assumes axis defending

		wait 2000
	}

	trigger objective_counter //Counts Allied objectives completed
	{
	accum 1 inc 1
	trigger game_manager checkgame
	}

	trigger checkgame
	{
	accum 1 abort_if_not_equal 2
	wm_setwinner 1
	wait 4000

	wm_endround
	}

}


// SOUTH WINDING MECHANISM STUFF

windmechsouth
{
	spawn
	{
		wait 200
		constructible_class 3
	}
	death
	{
		wm_announce "Allies have destroyed the South Winding Mechanism"

		wm_objective_status 3 0 2
		wm_objective_status 3 1 1

		trigger game_manager objective_counter
	}
}

// NORTH WINDING MECHANISM STUFF

windmechnorth
{
	spawn
	{
		globalaccum 1 set 0
		wait 200
		constructible_class 3
	}
	death
	{
		wm_announce "Allies have destroyed the North Winding Mechanism"

		globalaccum 1 set 1

		wm_objective_status 5 0 2
		wm_objective_status 5 1 1

		trigger game_manager objective_counter
	}
}

You can ignore the globalaccum part in the final part of the North winding mechanism as it was linked to a moving dock gate that would obviously be disabled if the winding mechanism was destroyed.

I hope this helps you out.

<DJ>


(IGoreI) #4

So it looks like I should drop accum 5 and use the accum 1 to count. I just borrowed most of the script from Oasis, so that must be the problem. Thanks, I’ll try it out and post back if it works. And I’ll lower the wait time, that was also left over from oasis.Thanks for the help!


(Flippy) #5

Erm no, you need to drop accum 1 and use only accum 5 :wink:

a quick example: (note that i havent tried this before but it should work in theory)


game_manager
{
	spawn
	{
		wait 300
		
		accum 5 set 0		// Number of objectives completed: 0

		wm_setwinner 0		// Axis wins when time expires

	// other game_manager spawn stuff
	}

	trigger checkwin
	{
		accum 5 abort_if_not_equal 2	// Check if both obj are destroyed
		wm_announce "Allies destroyed both objectives!"
		wait 1000
		wm_setwinner 1
		wm_endround
	}
}

objective1
{
	death
	{
		accum 5 inc 1		// Add 1 to 'accum 5' value
		wm_announce "Objective 1 destroyed!"

		trigger game_manager checkwin	// Trigger checkwin to see if allies win
	}
}

objective2
{
	death
	{
		accum 5 inc 1		// Add 1 to 'accum 5' value
		wm_announce "Objective 2 destroyed!"

		trigger game_manager checkwin	// Trigger checkwin to see if allies win
	}
}


(IGoreI) #6

Well, I got it to work, the scripting wasn’t the problem, I thought to recheck all the entities involved, and my trigger objctive info was targeting like 4 different elements with in the rocket( coudn’t see that normally, I had to move the trigger to see the connections), so I rebuilt it and it worked. I also had the error where after destroying the rocket it would say destroyed like 4 times, so I fixed two probs in one.Thanks for the help guys, my script IS much cleaner now.