Page 1 of 4

How to use an entire dm team?

Posted: Thu Jun 26, 2003 5:04 am
by TheShiznaeSpe
I need to check to see if ANY player from one team is in a trigger for 30 seconds AND that no player from the other team gets inside for more than 3 seconds.

Rox and I have got this script so far (all it does is check for one player for 30 seconds):

Code: Select all

while (local.player IsTouching $target_building_trigger[local.index] == 1)
{
wait 30
// ACTION TO BE DONE-ADD HERE
}

Posted: Thu Jun 26, 2003 8:31 am
by jv_map
Hmm I see troubles :(

The scripting language is not even advanced enough to find out whether a player is currently in the game or spectating without a huge work-around (like I did with the bot scripts ;))....

Capture

Posted: Thu Jun 26, 2003 8:38 am
by tltrude
Here is a thread used for capturing a trolly that might give you ideas.

Code: Select all

trolly_waittill_capture:

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

       	if (local.player.dmteam == level.controlling_team)  //prevents pressing the trigger again
		{
			goto trolly_waittill_capture
		}
		else
	if (local.player.dmteam == "allies")
		{
			if (level.tspos == 1)  // if trolly switch is already on
				{
				thread trolly_switches_off
				$trolly stop
				$trolly loopsound lighthouse_run wait
				wait 2
				}
			$trolly playsound allied_ranger_ba //sound is "Cover me!"
			level.controlling_team = local.player.dmteam
			waitthread trolly_switches_on
			thread trolly_move_up
		}
		else
	if (local.player.dmteam == "axis")
		{
			if (level.tspos == 1) // if trolly switch is already on
				{
				thread trolly_switches_off
				$trolly stop
				$trolly loopsound lighthouse_run wait
				wait 2
				}
			$trolly playsound axis_axis5_ba //sound is "Cover me!"
			level.controlling_team = local.player.dmteam
			waitthread trolly_switches_on
			thread trolly_move_down
		}

   waitframe // protection
}
end

Posted: Thu Jun 26, 2003 9:39 am
by bdbodger
What about this

$mytrigger key:setthread Value:playercheck

playercheck:
local.player=parm.other

if local.player.dmteam=="spectator"
end
if local.player.dmteam=="axis"
local.player thread axischeck
else
local.player thread alliedcheck

end

axischeck:
local.timer= level.time+30
while (self istouching $mytrigger)
{
$mytrigger nottriggerable
if level.time >= local.timer
{
timer1=1
end
}
waitframe
}
$mytigger triggerable
end

alliedcheck:
local.timer= level.time+3
while (self istouching $mytrigger)
{
$mytrigger nottriggerable
if level.time >= local.timer
{
timer2=1
end
}
waitframe
}
$mytigger triggerable
end

but this will allow only one player in the trigger at a time because it sets it as nottriggerable

In the SDK they have this but I don't know if it works or not

edgetriggered( Boolean newEdgeTriggered )


If true, trigger will only trigger when object enters trigger, not when it is inside it.

Posted: Thu Jun 26, 2003 12:01 pm
by nuggets
you have $mytigger instead of $mytrigger that might be why it's not retriggerable

Posted: Thu Jun 26, 2003 1:02 pm
by bdbodger
Typo it happens it's not my thread . :roll:

Posted: Thu Jun 26, 2003 6:58 pm
by TheShiznaeSpe
Hmmm using some things from tltrude's script, I've come up with this (Is it coherent? Does it make sense?):

Code: Select all

set_up_teams:

$target_building_trigger waittill trigger

local.player = parm.other // these first 2 parts were already here
if(local.player.dmteam == "allies")
{
local.player.dmteam = local.holding_team_allies
local.player delete // will this allow a different player to be in trigger?
thread allies_win_hold
}

if(local.player.dmteam == "axis")
{
local.player.dmteam = local.holding_team_axis
local.player delete
thread axis_win_hold
}

if(local.player.dmteam == "spectator")  // eliminates spectate triggering
{
end
}

end

allies_win_hold:

$target_building_trigger waittill trigger

local.triggerer = parm.other
if(local.triggerer.dmteam == local.holding_team_allies)
{
while (local.triggerer IsTouching $target_building_trigger[local.index] == 1) 
{
if(local.triggerer IsAlive == 0)
{
local.triggerer delete
}
else
{
wait 30 
teamwin allies
}
}
}
else
{
local.triggerer delete
end
}

end

axis_win_hold:

$target_building_trigger waittill trigger

local.triggerer = parm.other
if(local.triggerer.dmteam == local.holding_team_axis)
{
while (local.player IsTouching $target_building_trigger[local.index] == 1) 
{
if(local.triggerer IsAlive == 0)
{
local.triggerer delete
}
else
{
wait 30 
teamwin axis
}
}
}
else
{
local.triggerer delete
end
}

end
sorry for the lack of indents- i wrote in reply box

Posted: Thu Jun 26, 2003 7:07 pm
by TheShiznaeSpe
:idea: :idea:

Would it be possible to say, if NO ONE on axis enters the trigger for 30 seconds, then allies win?

sort of like this:

Code: Select all

allies_win_hold:

$target_building_trigger waittill trigger

local.player = parm.other
if(local.player.dmteam == "allies")
{
}
if(local.player.dmteam == "axis")
{
wait 5
}
while (local.player IsTouching $target_building_trigger[local.index] == 0) 
{ 
wait 30 
teamwin allies 
}
}
end
????

Posted: Fri Jun 27, 2003 7:36 am
by nuggets
oh yeah, oops :P

does this need to be triggerable by each team, where either team can win, like a central rendez-vous point, or is it just allies that'd win if them hold it,

i think i've got a possible solution but it'd take a lot of scripting so that'd be worth knowing first of all :P

also, i didn't work for me but i may have this wrong... i don't think you can use isTouching for triggers, you'll need to create a script_object and hide it and make it passable

stopwatch

Posted: Fri Jun 27, 2003 8:27 am
by tltrude
I don't think your script will work as is, but there are some good tries in it. For debuging, you should put in message lines that will show up on the screen, like this:

iprintln "The allies have entered the building!"
iprintln "The axis have entered the building!"

And here is a thread form the obj_dm.scr script that shows the stopwatch while a player is setting the bombs. It stops if the player dies.

Code: Select all

bomb_waittill_set:

self model items/pulse_explosive.tik

while ( $(self.trigger_name) )
{
println "waittill trigger " self.trigger_name 
self.trigger_name waittill trigger

	local.player = parm.other
	//"local.player.dmteam", can be 'spectator', 'freeforall', 'allies' or 'axis'
        if (local.player.dmteam != level.planting_team) 
	{
		goto bomb_waittill_set
		println "failed dmteam check" local.player.dmteam	
	}

	
	
	local.counter = 0
	while ( (Isalive local.player) && (local.player cansee self level.bombusefov level.bomb_use_distance) && (local.player.useheld == 1) )
	{
		if (local.counter == 0)
			local.player stopwatch (level.bomb_set_time * .1)
			
		local.counter++

		wait .1
		if (local.counter >= level.bomb_set_time)
		{
			iprintlnbold "A Bomb has been planted!"
			if (level.planting_team == "allies")
				self playsound dfr_objective_o
			else
				self playsound den_objective_o
			thread bomb_waittill_defuse
			thread bomb_waittill_explode
			self.live = 1
			level.bomb_set ++
			end
		}
	}
	if (local.counter > 0)
		local.player stopwatch 0
	println "usetrigger but failed check" 
	if ! (self cansee local.player level.bombusefov  level.bomb_use_distance) 
		println "failed cansee check"	
	if ! (local.player.useheld == 1)
		println "failed useheld check" local.player.useheld
}
end



Istouching will work with a trigger_multiple.  But, you are going to need counters to keep track of how meny players have entered the trigger.

Posted: Fri Jun 27, 2003 12:53 pm
by bdbodger
it is not hard to create a timer for when a player enters a trigger_multiple and yes you can use istouching with a trigger for an example look at the global/cabinet.scr . I was just concerned that the trigger whould keep triggering when you are inside it . A test map whould confirm or deny that . Maybe use some other method like when a player enters the trigger set a variable to stop it from resetting while the player is inside it .

local.player=parm.other
if local.player.dmteam="allied"
local.player thread allied_check
if local.player.dmteam="axis"
local.player thread axis_check
end

allied_check:
if level.allied_timer_started==1
end
level.allied_timer_started=1
local.allied_timer=level.time + 30
while (self istouching $my_trigger)
{
if level.time>=local.allied_timer
thread allied_win
}
level.allied_timer_started=0
end

axis_check:
if level.axis_timer_started==1
end
level.axis_timer_started=1
local.axis_timer=level.time + 3
while (self istouching $my_trigger)
{
if level.time>=local.axis_timer
thread axis_win
}
level.axis_timer_started=0
end

Posted: Fri Jun 27, 2003 5:31 pm
by nuggets
but that won't stop either team detecting if there's an enemy in there, if they reached the area together, the allies would win as their counts only needs to reach 3

Posted: Fri Jun 27, 2003 7:11 pm
by TheShiznaeSpe
nuggets wrote:
does this need to be triggerable by each team, where either team can win, like a central rendez-vous point, or is it just allies that'd win if them hold it
its a king of the hill type thing

a team must hold the target zone for 30 sec to win

So,

Can someone summarize what has been concluded? I just need to see how this all fits together.

Posted: Fri Jun 27, 2003 10:16 pm
by nuggets
well in summary you'd need something like this

trigger->multiple
key: targetname
value: area_trigger
key: setthread
value: im_here

main:
level.allies_counters = 0
level.axis_counter = 0
end

im here:
local.player = parm.other

if (local.player.dmteam == "allies")
{ if ( local.player.were_counting == 1 )
{ local.player.were_counting = 1
local.player.counter = 0
local.player thread count_me_in_im_an_ally
level.allied_counters++ }}

if (local.player.dmteam == "axis")
{ if ( local.player.were_counting == 1 )
{ local.player.were_counting = 1
local.player.counter = 0
local.player thread count_me_in_im_an_axis
level.axis_counters++ }}
end

count_me_in_im_an_ally:
if ( level.axis_counters == 0 )
{ if ( self istouching $area_trigger )
{ if ( self.counter < 30 )
{ self.counter++
wait 1
self thread count_me_in_im_an_ally
end}
else
{teamwin allies
wait 1
end}
local.player.were_counting = 0
level.allies_counters--}
}

count_me_in_im_an_axis:
if ( level.allies_counters == 0 )
{ if ( self istouching $area_trigger )
{ if ( self.counter < 30 )
{ self.counter++
wait 1
self thread count_me_in_im_an_axis
end}
else
{teamwin axis
wait 1
end}
local.player.were_counting = 0
level.axis_counters--}
}

/*this is the basics i've gotta go out now but all you need to do is add in if dead (level.allies_counters-- or level.axis_counters-- dependant on team, and there's not a 3second check, it's just a one second at the moment

hope this helps :D */

Posted: Sat Jun 28, 2003 4:45 am
by TheShiznaeSpe
ok, i'm sorry, but i'm still confused :oops:

can someone please explain what each part of the script does? just for further use and so i understand where stuff happens?