Lever, nottriggerable

Post your scripting questions / solutions here

Moderator: Moderators

Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Lever, nottriggerable

Post by Dani »

This is a continuation from another post, BUT i have the gates moving fine now, the only problem i have is that you can trigger them twice so they won't move the correct distance, how do i get this to work, here is my script now:

Code: Select all

main: 

level waittill prespawn 
$gate time 10 
$cell time 3 
level.gateopen = 0
level.cellopen = 0
end

gate_switch:
if(level.gateopen == 0){
 $gate moveup 368
 $gate waitmove
 level.gateopen = 1 
}else{
 $gate movedown 368
 $gate waitmove
 level.gateopen = 0
}
end
Please tell me how to make them nottriggerable, and please also tell me if there are any coding errors i have made.
Thanks you
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

Please, post scripting questions in the scripting forum and do not start useless polls...

As to your problem, better post the parts of your script that have to do with triggering :)
Image
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

I think you need to add a new state: moving.
And then check to see i the gate is moving, and if so ignore the triggering.

Another way is to use

Code: Select all

$gate moveto $a_nice_waypoint
instead of telling it to move a distance. That way you can tell it to move multiple times and it will still go to the same place.
Admin .MAP Forums
Image
Head above heels.
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

Give your gate triggers targetnames. Lets say you gave the first gate trigger a targetname of gate1.

Then in code you do something like this:

Code: Select all

main: 

level waittill prespawn 
$gate time 10 
$cell time 3 
level.gateopen = 0 
level.cellopen = 0 
thread gate_switch // add this statement to execute the thread
end 

gate_switch: 
while(1) // this will run this thread in a constant loop
{
$gate1 waittill trigger // this waits until trigger is activated
$gate1 nottriggerable // and now the trigger is deactivated
if(level.gateopen == 0)
 { 
 $gate moveup 368 
 $gate waitmove 
 level.gateopen = 1 
 $gate1 triggerable // activate the trigger again
 }
else
 { 
 $gate movedown 368 
 $gate waitmove 
 level.gateopen = 0 
 $gate1 triggerable // activate the trigger again
 } 
waitframe // this is to protect the while loop from crashing - waits 1 frame
}
end
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Post by Dani »

Oh, well i can not get way pionts because i have lots of different object, and i can't get the targername thing to work.
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Post by Dani »

I am sorry, but your method with waittil trigger does not work, it just loops in a continuoes loop, which could be useful, but not here. WAT DO I DO. my map is SO close to being finished and this is the only little glitch that i have. :x :cry: :( :!: :?:
Bjarne BZR
Site Admin
Posts: 3298
Joined: Wed Feb 05, 2003 2:04 pm
Location: Sweden
Contact:

Post by Bjarne BZR »

It shouldent really loop out of control... do you get any erors at all in the log? Set "logfile 2" before you load the map.
Admin .MAP Forums
Image
Head above heels.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

spawn

Post by tltrude »

This should work. Btw, the "!" symbol means "does not".

Code: Select all

main: 

	level waittill prespawn 

	$gate time 10
	$cell time 3
	level.gateopen = 0
	level.gatemoving = 0
	level.cellopen = 0

	level waittill spawn

end

gate_switch:
 
	if((level.gateopen == 0) && (level.gatemoving != 1))
	{
		level.gatemoving = 1 
		$gate moveup 368 
		$gate waitmove 
		level.gateopen = 1
		level.gatemoving = 0
		end 
	}
	if((level.gateopen == 1) && (level.gatemoving != 1))
	{ 
		level.gatemoving = 1
		$gate movedown 368 
		$gate waitmove
		level.gateopen = 0 
		level.gatemoving = 0
	}
 
end
Would you like to add sound?
Tom Trude,

Image
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Post by Dani »

Erm yes plz i WOULD like to add sound. But i don't know how. If you can offer me a QUICK and EASY solution then i would be happy :) thx. I will try your thing.
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Post by Dani »

tltrude you R a genious, GOD i should say, THANKS YOU. You got it to work, You got it to work, You got it to work, You got it to work, You got it to work, You got it to work, You got it to work, You got it to work, You got it to work, You got it to work, You got it to work, :D THANKS! no how about this sound?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

sound

Post by tltrude »

Code: Select all

main: 

   level waittill prespawn 

   exec global/ambient.scr mohdm7 // Background sound (wind).

   $gate time 10 
   $cell time 3 
   level.gateopen = 0 
   level.gatemoving = 0 
   level.cellopen = 0 

   level waittill spawn 

end 

gate_switch: 
  
   if((level.gateopen == 0) && (level.gatemoving != 1)) 
   { 
      level.gatemoving = 1
      $gate loopsound lighthouse_run
      $gate moveup 368 
      $gate waitmove 
      level.gateopen = 1 
      level.gatemoving = 0
      $gate stoploopsound 
      end 
   } 
   if((level.gateopen == 1) && (level.gatemoving != 1)) 
   { 
      level.gatemoving = 1
      $gate loopsound lighthouse_run
      $gate movedown 368 
      $gate waitmove 
      level.gateopen = 0 
      level.gatemoving = 0 
      $gate stoploopsound 
   } 
  
end 
Well, you wanted a quick sound! I would have to know what type gate it is for a better one. Although, there are not a lot of choices for gates that take 10 seconds to open and close. The "lighthous_run" sound is easy to use because it works in all game types--without an ubersound workaround.

I added background sound too.
Tom Trude,

Image
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Post by Dani »

Thanks you VERY much i will try this out. It is a castle gate, one of those MASSIVE ones. I made it 10 seconds because I thought it was cool.

P.S. i also have a prison door that opens and closes, wat about sounds for this?
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

ok

Post by tltrude »

Ok, change "lighthouse_run" to "m2l1_gate_open".

For the cell, use "gate_iron_open1", but change it to "playsound" and don't use the stoploopsound lines.

$Cell playsound gate_iron_open1
Tom Trude,

Image
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Post by Dani »

thanks you a lot. One more thing, sorry to go on. But in multiplayer the sounds do not happen, why is this.

P.S. how do you find out which sounds to use, so i can do it for myself in the furture, Thanks.
Dani
Sergeant Major
Posts: 113
Joined: Mon Mar 08, 2004 6:45 pm
Contact:

Post by Dani »

The sounds work perfectly. THANK. YOU. LOADS! Please reply my previous post?
Post Reply