Dynamitable objective can still be shot


(TNR360) #1

I made a gun that can be destroyed with dynamite, however the dynamite does nothing and it can be destroyed with bullets… when I plant though it does anounce “dynamite planted” but once it blows nothing happens

I even set health to 0 so bullets cant destroy it but nothing changes

*Script:

Game_manager
{

spawn
{

// Game rules
wm_axis_respawntime	25
wm_allied_respawntime	14
wm_set_round_timelimit	35
	
// Stopwatch mode defending team (0=Axis, 1=Allies)
wm_set_defending_team	0

// Winner on expiration of round timer (0=Axis, 1=Allies -1=None)
wm_setwinner	0

}

trigger objective_counter
{
accum 1 inc 1
trigger game_manager checkgame
}

trigger checkgame
{
accum 1 abort_if_not_equal 2
wm_announce “The Allies have taken control of the beach!”
wm_setwinner 1
wait 2500
wm_endround
}

eastgun
{
spawn
{
wait 300
constructible_class 3
}
death
{

  	trigger eastgun_toi remove
  	wm_announce "East Anti-tank gun destroyed!!!"
  	trigger game_manager objective_counter
} 	 

}

eastgun_toi
{
trigger remove
{
remove
}
}

westgun
{
spawn
{
wait 300
constructible_class 3
}
death
{

  	trigger westgun_toi remove
  	wm_announce "West Anti-Tank gun destroyed!!!"
  	trigger game_manager objective_counter
} 	 

}

westgun_toi
{
trigger remove
{
remove
}
}

}


(RayBan) #2

your script is setup wrong, you have everything within the game_manager, when the
script blocks for your entities should be seperate.

also, the waits for your eastgun/westgun is a little long… 400… imo, you can do this no
problem, but you should add a wait of around 500 to your game_manager, so all the
entities you have loaded, also have time to setup and settle before your game_manager
takes over,




game_manager
{

	spawn
	{
		wait 400	// added a wait here

		// Game rules
		wm_axis_respawntime 25
		wm_allied_respawntime 14
		wm_set_round_timelimit 35

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

		// Winner on expiration of round timer (0=Axis, 1=Allies -1=None)
		wm_setwinner 0

		accum 1 set 0 	// this was not setup either, just to make shure no randomness is there
				// to begin with
	}

	trigger objective_counter
	{
		accum 1 inc 1
		trigger game_manager checkgame
	}

	trigger checkgame
	{
		accum 1 abort_if_not_equal 2
		wm_announce "The Allies have taken control of the beach!"
		wm_setwinner 1
		wait 2500
		wm_endround
	}
}

eastgun
{
	spawn
	{
		wait 25	// changed this wait from 400 to 25.. 400 is a little to much
		constructible_class 3
	}

	death
	{
		trigger eastgun_toi remove
		wm_announce "East Anti-tank gun destroyed!!!"
		trigger game_manager objective_counter
	}
}

eastgun_toi
{
	trigger remove
	{
		remove
	}
}

westgun
{
	spawn
	{
		wait 25	// changed this wait from 400 to 25.. 400 is a little to much
		constructible_class 3
	}

	death
	{
		trigger westgun_toi remove
		wm_announce "West Anti-Tank gun destroyed!!!"
		trigger game_manager objective_counter
	}
}

westgun_toi
{
	trigger remove
	{
		remove
	}
}



that should work


(TNR360) #3

thanks

it worked perfectly but what do I add to get the game to end after both are destroyed?


(-SSF-Sage) #4

[QUOTE=TNR360;177526]thanks

it worked perfectly but what do I add to get the game to end after both are destroyed?[/QUOTE]

From what I see in the script Rayban gave you, it should act like that. Did you test it?


(TNR360) #5

yea I thought it shouldve done that too but after blowing both guns nothing happened


(isbowhten) #6

well you could try to replace accum with globalaccum but this should not be the reason…
put a printaccum 1 at the end of the checkgame trigger… the accum could be raised too often because of a recursion which should not happen.


(-SSF-Sage) #7

Have you followed it with g_scriptdebug 1?


(DeatH) #8

TNR you still haven’t replied to my PM…


(TNR360) #9

I havent been on this site since september :stuck_out_tongue:


(TNR360) #10

nothing seems to work

is there another way of doing it?


(isbowhten) #11

ye i would have done it another way… not checkgame increases the accum (i would use globalaccum) but the death trigger itself increases the globalaccum…
then both death routines do not execute the checkgame trigger BUT they have those lines at their end.
globalaccum 1 abort_if_not_equal 2
setwinner 0/1/-1
wm_endround…
so you do not need excluded triggers so none of the bugs in et can cause a mistake…
AND will the objective ( use g_scriptdebug 1 ) really be destroyed?
e.g. if the obj is directly behind a door but the door is closed then hundreds of dynamites wont blow it up.


(TNR360) #12

after blowing up either one of the guns console gives me this:

Planted at East Anti-Tank Gun
G_scripting: trigger has unknown name: game_manager
East Anti-Tank Gun Destroyed!!!

???


(isbowhten) #13

do you have the script_multiplayer entity with scriptname “game_manager” ?
^^


(RayBan) #14

[QUOTE=TNR360;177568]after blowing up either one of the guns console gives me this:

Planted at East Anti-Tank Gun
G_scripting: trigger has unknown name: game_manager
East Anti-Tank Gun Destroyed!!!

???[/QUOTE]

oh… i think… check your script_multiplayer entity, see what key/value you added,
im guessing its something like,

key scriptname
value Game_manager

or something like that…

if it is, redo the value so it’s in lowercase letters, as in game_manager and not Game_manager

it cannot find the trigger game_manager and thats what’s causing the problem


(TNR360) #15

thanks guys that seemed to be the problem I didnt think it was case sensitive


(TNR360) #16

Im having alot of scripting trouble with what seems to be or should be really simple, Im not very good at the scripting part at all…

can anyone help me with this next one? sorry to bother

What happens every time the germans touch a flag autospawn is set (on flags where it is called) and wm_anounce anounces the capture, but on allies I cant get any of them to set autospawn or anounce the capture. I saw it happen once on flag 1 but it never happened again…

here it be-

game_manager
{       
      spawn {     
            // Game rules
            wm_axis_respawntime      15
            wm_allied_respawntime    15
            wm_number_of_objectives  4
            wm_set_round_timelimit   24

            // Objectives
            // 1: Take all 4 sections of the city

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

            // Winner on expiration of round timer (0=Axis, 1=Allies, -1=Neither)
            wm_setwinner   -1

            wait 500
            setautospawn   "German Spawn"   0
            setautospawn   "Allied Spawn"   1

		// *----------------------------------- vo ------------------------------------------*

		// *---------------------------------------------------------------------------------*
      }
}

// Flags ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^


//**FLAG 1**\\

Flag1
{
      spawn {
            accum 0 set 1   // 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 // did Axis own flag?

            accum 0 set 0 // Axis own the pole
	    setautospawn   "Flag 1"   0

            wm_announce   "The Axis have control over the northeast part of town!"
		// *----------------------------------- vo ------------------------------------------*

		// *---------------------------------------------------------------------------------*
               
            alertentity Flag1_obj
}

      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
	    setautospawn   "Flag 1"   1

            wm_announce   "The Allies have control over the northeast part of town!"
		// *----------------------------------- vo ------------------------------------------*

		// *---------------------------------------------------------------------------------*
               
            alertentity Flag1_obj
}   
}


//**FLAG 2**\\

Flag2
{
      spawn {
            accum 0 set 1   // 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 // did Axis own flag?

            accum 0 set 0 // Axis own the pole
	    setautospawn   "Flag 2"   0

            wm_announce   "The Axis have control over the southwest!"

		// *----------------------------------- vo ------------------------------------------*

		// *---------------------------------------------------------------------------------*

            alertentity Flag2_obj
      }

      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
	    setautospawn   "Flag 2"   1

            wm_announce   "The Allies have control over the southwest!"
 
		// *----------------------------------- vo ------------------------------------------*

		// *---------------------------------------------------------------------------------*

            alertentity Flag2_obj
      }   
}

//**FLAG 3**\\

Flag3
{
      spawn {
            accum 0 set 1   // 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 // did Axis own flag?

            accum 0 set 0 // Axis own the pole

            wm_announce   "The Axis have control over the southeast!"

		// *----------------------------------- vo ------------------------------------------*

		// *---------------------------------------------------------------------------------*

            alertentity Flag3_obj
      }

      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   "The Allies have control over the southeast!"
 
		// *----------------------------------- vo ------------------------------------------*

		// *---------------------------------------------------------------------------------*

            alertentity Flag3_obj
      }   
}

//**FLAG 4**\\

Flag4
{
      spawn {
            accum 0 set 1   // 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 // did Axis own flag?

            accum 0 set 0 // Axis own the pole

            wm_announce   "The Axis have control over the northwest!"

		// *----------------------------------- vo ------------------------------------------*

		// *---------------------------------------------------------------------------------*

            alertentity Flag4_obj
      }

      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   "The Allies have control over the northwest!"
 
		// *----------------------------------- vo ------------------------------------------*

		// *---------------------------------------------------------------------------------*

            alertentity Flag4_obj
      }   
} 

(-SSF-Sage) #17

The accum sets that owning team in the beginning is Allied. So axis needs to cap b4 allied can ofc. One thing I noticed, or should I see many times noticed.

spawn {
//....
}

To

spawn
{
//....
}

I don’t know if the forums does it, I think it does, but just mentioned.


(TNR360) #18

so I should set it to -1 right :smiley:


(kamikazee) #19

[QUOTE={SSF}Sage;177918]

spawn {
//....
}

To

spawn
{
//....
}

I don’t know if the forums does it, I think it does, but just mentioned.[/QUOTE]
AFAIK, both forms work. I know I mostly used the first form for triggers or events.


(-SSF-Sage) #20

Ahh, tested it and it doesn’t seem to matter. I’ve never seen this method used tho. I think it’s cos the second method is easier to debug imo. And the accum has to be not 0 or 1, (eg -1), IF it’s neutral in the beginning (nobody owns).