Interfering threads in a script?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
TechZimmy
Corporal
Posts: 36
Joined: Tue Feb 18, 2003 12:55 am
Contact:

Interfering threads in a script?

Post by TechZimmy »

I made a map with a bunch of secret passages, and in the secred passage "control" room i have 2 switches, one called rd_switch1 with a trigger called rd_trigger1 that opens a secret door (remote_door) , and one called rd_swichlock with a trigger called rd_triggerlock that lockes the main passageway door (rd_doorlock). Here is my code for it so far:

Code: Select all

level waittill prespawn
level.rdoorpos = 0
level.passlock = 0
thread remote_door1
thread lockdoors

remote_door1:

   $rd_trigger1 waittill trigger
   if (level.rdoorpos == 0)
   {
      $rd_switch1 playsound alarm_switch
      $rd_switch1 anim turn
      $remote_door open
      level.rdoorpos = 1
      goto remote_door1
   }
   if (level.rdoorpos == 1)
   {
      $rd_switch1 playsound alarm_switch
      $rd_switch1 anim idle
      $rd_switch2 anim idle
      $remote_door close
      level.rdoorpos = 0

      goto remote_door1
   }
end

lockdoors:

   $rd_triggerlock waittill trigger
   if (level.passlock == 0)
   {
      $rd_swichlock playsound alarm_switch
      $rd_swichlock anim turn
      $rd_doorlock lock
      level.passlock = 1
      goto lockdoors
   }
   if (level.passlock == 1)
   {
      $rd_swichlock playsound alarm_switch
      $rd_swichlock anim idle
      $rd_doorlock unlock
      level.passlock = 0
      goto lockdoors
   }
end
When i go to use the switch in remote_door1 all i hear is the sound of the door closing every time i click it, the switch dosent move, and the door does nothing. The switch that locks the door however, works. Are the threads interfering somehow?
Zimmy
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

end

Post by tltrude »

You need an "end" here:

thread lockdoors

end

remote_door1:
Tom Trude,

Image
TechZimmy
Corporal
Posts: 36
Joined: Tue Feb 18, 2003 12:55 am
Contact:

Post by TechZimmy »

No change. The same thing happens.
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

targetnames

Post by tltrude »

If you are sure the targetnames in the map match the ones in the script, and there are no setthreads in the triggers, you can try this.

Place a script_origin near the door face and targetname it "remote_key1" or whatever.

In your script change this line:

$remote_door open $remote_key1 // remote_key1 is a fake player

If it is an alarm switch, you need to use these lines to move it:

$rd_switch1 anim turnoff // arm moves down
$rd_switch1 anim turnon
Last edited by tltrude on Sun May 25, 2003 3:28 pm, edited 1 time in total.
Tom Trude,

Image
TechZimmy
Corporal
Posts: 36
Joined: Tue Feb 18, 2003 12:55 am
Contact:

Post by TechZimmy »

YAHOOOOOOO! Thank you! It works! Wooohooooooo!
(Ive been stuck on this for about a week)
Post Reply