Disable trigger if touching.

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
agentmad007
Brigadier General
Posts: 570
Joined: Tue Feb 24, 2004 3:52 pm

Disable trigger if touching.

Post by agentmad007 »

Hi ,

$ring_egypt_trigger and $ring_nazi_trigger are 2 trigger multiple , when fired they teleport my player to the appropriate location .

Architecture made by Bdbodger:

Code: Select all

ring_teleporter1: // this ring_nazi_trigger triggered by setthread

	//self waittill trigger

	self nottriggerable

	$ring_egypt_trigger nottriggerable


	wait 2 // wait for players to enter

	
	waitthread end_trigger_touched $ring_egypt_trigger

$ring_speaker playsound transring

	waitthread rings_down


	local.counter = 0

	for(local.p = 1;local.p <= $player.size;local.p++)
	{
		if($player[local.p] istouching self && local.counter < 2 )
		{
			thread ring_teleport $player[local.p] $ring_egypt
			local.counter++
		}
	}

	waitthread rings_up

	waitthread end_trigger_touched $ring_egypt_trigger

//self triggerable

//$ring_egyt_trigger triggerable

	waitthread release_trigger



end

ring_teleporter2: // this ring_egypt_trigger triggered by setthread

	//self waittill trigger

	self nottriggerable

	$ring_nazi_trigger nottriggerable

	wait 2 // wait for players to enter


	waitthread end_trigger_touched $ring_nazi_trigger


$ring_speaker playsound transring

	waitthread rings_down

	local.counter = 0

	for(local.p = 1;local.p <= $player.size;local.p++)
	{
		if($player[local.p] istouching self && local.counter < 2)
		{
			thread ring_teleport $player[local.p] $ring_nazi
			local.counter++
		}
	}

	waitthread rings_up

	waitthread end_trigger_touched $ring_nazi_trigger

//self triggerable

//$ring_nazi_trigger triggerable

	waitthread release_trigger

end

spot_used:

while(1)
{
	self waittill trigger

	self nottriggerable

	self.isused = 1

	local.ringuser = parm.other

	while(local.ringuser istouching self)
		
		waitframe

	self.isused = 0

	self triggerable
}
end

end_trigger_touched local.trigger:

local.ok = 0

while(local.ok != 1)
{
	local.check = 0

	for(local.p=1;local.p<=$player.size;local.p++)
	{
		if($player[local.p] istouching local.trigger)
			local.check = 1
	}

	if(local.check == 0)
		local.ok = 1

waitframe
}
end

rings_down:

	$ring1 time .3
	$ring2 time .3
	$ring3 time .3
	$ring4 time .3
	$ring5 time .3
	$ring1_1 time .3
	$ring2_2 time .3
	$ring3_3 time .3
	$ring4_4 time .3
	$ring5_5 time .3

	$ring1 movedown 191
	$ring1 waitmove
	$ring1_1 movedown 191
	$ring1_1 waitmove 
	$ring2 movedown 191
	$ring2 waitmove 
	$ring2_2 movedown 191
	$ring2_2 waitmove
	$ring3 movedown 191
	$ring3 waitmove 
	$ring3_3 movedown 191
	$ring3_3 waitmove
	$ring4 movedown 191
	$ring4 waitmove 
	$ring4_4 movedown 191
	$ring4_4 waitmove
	$ring5 movedown 191
	$ring5 waitmove 
	$ring5_5 movedown 191
	$ring5_5 waitmove
end

rings_up:

	$ring1 time .3
	$ring2 time .3
	$ring3 time .3
	$ring4 time .3
	$ring5 time .3
	$ring1_1 time .3
	$ring2_2 time .3
	$ring3_3 time .3
	$ring4_4 time .3
	$ring5_5 time .3

	$ring5 moveup 191
	$ring5 waitmove 
	$ring5_5 moveup 191
	$ring5_5 waitmove
	$ring4 moveup 191
	$ring4 waitmove
	$ring4_4 moveup 191
	$ring4_4 waitmove  
	$ring3 moveup 191
	$ring3 waitmove 
	$ring3_3 moveup 191
	$ring3_3 waitmove 
	$ring2 moveup 191
	$ring2 waitmove
	$ring2_2 moveup 191
	$ring2_2 waitmove 
	$ring1 moveup 191
	$ring1 waitmove 
	$ring1_1 moveup 191
	$ring1_1 waitmove
end

When fired they are nottriggerable then , i want to make them triggerable again only if none player is touching one of the trigger to let the script teleport the player .

I have a MAJOR bug , the script is broken after a while, and the rings are getting crazy .

So i think to fix it i ll have to make My main triggers triggerable only if none players are touching them ingame.

So i skiped :


Code: Select all

//self triggerable

//$ring_nazi_trigger triggerable
to :

Code: Select all

waiithread release_trigger
My first suggest was:

Code: Select all


release_trigger:

local.trigger_activated = 0

while(local.trigger_activated != 1)

{

		for(local.i=1;local.i<=$player.size;local.i++)
	{

if(($player[local.i] istouching $ring_egypt_trigger) || ($player[ocal.i] istouching $ring_egypt_trigger))
{			
local.trigger_activated= 1 
}

if(local.trigger_activated == 0)
{

$ring_egypt_trigger triggerable
$ring_nazi_trigger triggerable

}

	}
waitframe

}

end



However it doesn't work.When i am teleported and stand inside the trigger (touching it so) i am teleported again 20 sec afterward.

Can someone help me to fix it plz .
Deadly and slient.
Elgan
Site Admin
Posts: 890
Joined: Tue Apr 13, 2004 10:43 pm
Location: uk
Contact:

Post by Elgan »

u spelt local.i wrong in ur loop check:P
Green Beret
Major General
Posts: 746
Joined: Mon Apr 19, 2004 12:21 pm
Contact:

Post by Green Beret »

Try this,change the trigger name to match yours

Code: Select all


self waittill trigger //you will have to hit E to teleport.
//if you dont want it to simply take this line out

local.trig = spawn trigger_multiple

local.trig.origin = (  -1864.26 944 12.03 ) //coords of trig.

local.trig setsize ( -10 -10 -10 ) ( 10 10 10 ) //trig. size

local.trig setthread  Trigger1 

local.trig message "Triggered" 

local.trig wait 1 

local.trig delay 0       


Trigger1:

local.player=parm.other                                                           

if (local.player.isTrigger1==1)                                                  

end 

local.player.isTrigger1=1     

local.player tele 0 0 0 //this will be the destination coordinates

wait 5 

local.player stufftext ?say teleported? 

local.player.isTrigger1=0

end                                            
or try taking out the // before all your self waittill trigger.
Image
Post Reply