Can a trigger_multiple's health be checked/printed

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Can a trigger_multiple's health be checked/printed

Post by tltrude »

I am trying to make the health of a trigger_multiple an objective, and print it's health on the screen as it goes down. But, it is not going so good because I don't know how to check the trigger's health. The trigger in the map is targetnamed "missle_ex_trigger" and has a health of 4000 (for now) and projectiles set. Any help would be great!

Code: Select all


level waittill prespawn

	level.controlling_team = "neutral"  //do not change
	level.allies_points = 0
	level.axis_points = 0
	level.missle_health = 4000
	level.win_points = 60 // team that gets to this number first wins.


//--------------------------------------
//  objective threads
//--------------------------------------

silodoor_waittill_capture:

  while ( $silodoor_trigger )
  {
    $silodoor_trigger waittill trigger
    local.player = parm.other

       	if (local.player.dmteam == level.controlling_team)  //prevents pressing the trigger again
		{
			goto silodoor_waittill_capture
		}
		else
	if (local.player.dmteam == "allies")
		{
			if (level.silodoors == 0)  // if silo doors are closed
				{
				waitthread silodoors_open
				thread check_points
				}
			println "Missile launch is on hold!"
			level.controlling_team = local.player.dmteam
		}
		else
	if (local.player.dmteam == "axis")
		{
			if (level.silodoors == 1) // if silo doors are open
				{
				waitthread silodoors_close
				thread check_points
				}
			println "Missle Launch countdown is running!"
			level.controlling_team = local.player.dmteam

		}

   waitframe // protection
}
end

//***********************************************
//   active scoreboard
//***********************************************
announce_points:

	wait .9
	locprint level.subtitleX level.subtitleY ("Countdown: "+ level.axis_points + "\n" + "Missile health: "+ level.missle_health)

	goto announce_points

end

//----------------------------------------------------------->
//Award points
//----------------------------------------------------------->

check_points:

	wait 1
	if ((level.missle.dead != 1) && ( level.missle_health <= level.win_points))
		{
		level.missle_health = ($missle_ex_trigger.health)
		thread check_win
		goto check_points
		}
	else
	if ((level.silodoors == 0)) && (level.axis_points <= level.win_points))
		{
		level.axis_points = level.axis_points + 1
		thread check_win
		goto check_points
		}

end

//***********************************************
// winning team
//***********************************************
check_win:

	if (level.axis_points == level.win_points)
	{
	teamwin axis
	}
	else 
	if (level.missle_health == 0)
	{
	teamwin allies
	}
	wait 10 

end
Last edited by tltrude on Sun Jan 25, 2004 4:13 am, edited 1 time in total.
Tom Trude,

Image
User avatar
Axion
Major General
Posts: 683
Joined: Mon Sep 29, 2003 5:14 am
Location: Northern California
Contact:

Post by Axion »

Holy crap, that's the first time that I've EVER seen tltrude stumped. :shock:

I'm not enough of a scripting guru to help, but I wish you good luck in finding the solution.

And sorry for being off-topic.
"The work of a thousand years is nothing but rubble."
- Dr. Carl Goerdeler (1943)
Visit my mapping site: http://www.freewebs.com/axion9
Image
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

locprint level.subtitleX level.subtitleY ("Countdown: "+ level.axis_points + "\n" + "Missile health: "+ level.missle_health)

Instead of level.missle_health, can't you just use $missle_ex_trigger.health? :?
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

That is something like what I did in my strafe.scr I made a trigger multiple and binded it to the plane for a health entitiy with bullets and projectile flags checked . I then kill the plane based on the health of the trigger .
nuggets
General
Posts: 1006
Joined: Fri Feb 28, 2003 2:57 am
Location: U-england-K (england in the UK) :P
Contact:

Post by nuggets »

just a little bit of nonsense to add in as your q's been answered

if nothing is "doing" the thread, (i.e)
$player thread this_or_that

and you just have
thread this_or_that

if you refer to self, it'll be the trigger :D
hope this helps, prob not cos it's all foreign 2 me :-/
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Thanks guys!

Post by tltrude »

Works great! thanks everyone!

Code: Select all

	level.silodoors = 0
	level.missle_gone = 0
	level.missle_swpos = 0
	level.controlling_team = "neutral"  //do not change
	level.allies_points = 0
	level.axis_points = 0
	level.misslenumber = 100
	level.missle_health = 4000
	level.win_points = 300 // team that gets to this number first wins.

	level.subtitleX = 89 // on-screen scoreboard, X coordinate
	level.subtitleY = 50 // on-screen scoreboard, Y coordinate

	level.dmrespawning = 1 // respawn = 1, no respawn = 0
	level.dmroundlimit = 0 // round time limit in minutes
	level.clockside = draw // set to axis, allies, kills, or draw

	//level waittill roundstart // Temp for testing--remove slash marks for final

	thread silodoors_waittill_capture
	thread check_points
	thread announce_points
	thread missle_feedback
	thread axis_counter

end

//--------------------------------------
//  objective threads
//--------------------------------------

silodoors_waittill_capture:

  while ( $silodoor_trigger )
  {
    $silodoor_trigger waittill trigger
    local.player = parm.other

       	if (local.player.dmteam == level.controlling_team)  //prevents pressing the trigger again
		{
			goto silodoor_waittill_capture
		}
		else
	if (local.player.dmteam == "allies")
		{
			if (level.silodoors == 0)  // if silo doors are closed
				{
				waitthread silodoors_open
				thread check_points
				}
			iprintlnbold_noloc "Missile launch is on hold!"
			level.controlling_team = local.player.dmteam
		}
		else
	if (local.player.dmteam == "axis")
		{
			if (level.silodoors == 1) // if silo doors are open
				{
				waitthread silodoors_close
				thread check_points
				}
			iprintlnbold_noloc "Silo doors are closed!"
			level.controlling_team = local.player.dmteam

		}

   waitframe // protection
}
end

//***********************************************
//   active scoreboard
//***********************************************

announce_points:

	wait .9
	locprint level.subtitleX level.subtitleY ("Countdown: " + (level.win_points - level.axis_points) + "\n" + "Missile health: " + (level.misslenumber) + " percent" )

	goto announce_points

end

//----------------------------------------------------------->
//Award points
//----------------------------------------------------------->

missle_feedback:

	local.originalhealth = $missle_ex_trigger.health
	local.previoushealth = $missle_ex_trigger.health	//initialize	

	while (1)
	{
		if !(isAlive $missle_ex_trigger)
			{
			end
			}

		if ($missle_ex_trigger.health < local.previoushealth)
			{
			local.misslefraction = ($missle_ex_trigger.health / local.originalhealth) * 100
			local.misslefractioninteger = int local.misslefraction
			local.previoushealth = $missle_ex_trigger.health
			level.misslenumber = local.misslefractioninteger
			}
	wait .1	
	}

end

axis_counter:

	$missle_launch_trigger waittill trigger
	$missle_off hide
	$missle_on show
	$missle_on playsound button_push
	while (level.silodoors == 0)
		{
		level.axis_points = level.axis_points + 1
		wait 1
		}
	goto axis_counter


check_points:

	wait .1
	if !(isAlive $missle_ex_trigger)
		{
		thread explode_missle
		}
	if (level.axis_points == level.win_points)
		{
		thread missle_launch
		}
	goto check_points

end

Tom Trude,

Image
Post Reply