Page 1 of 1

triggering a fan

Posted: Thu Oct 16, 2003 8:38 pm
by MxPxpunk
I was wondering if there was a way to make a one time use of a trigger to start a fan, i am using it as a helicopter blade and i already know how to make a fan. i am using the non-scripted way and im not sure if i can do it with out a script. my first attempts were unseccessful because it stop the already spinning blades. how do i start the map with them not moving but still be able to turn them on? i targeted both propelers and added a trigger for both but i cant figure out how to make it work.

Posted: Thu Oct 16, 2003 8:51 pm
by bdbodger
You will need to do it with script . Make a trigger_multiple give it the Key: setthread Value: mythread . In your level script put this thread

mythread:
self remove // removes the trigger
$myfan rotatey 360 // set rotation speed here
end

you can even get them to start slow and then speed up

mythread:
self remove // removes the trigger
$myfan rotatey 90 // set rotation speed here
wait 5
$myfan rotatey 180
wait 3
$myfan rotatey 360
end

Posted: Thu Oct 16, 2003 9:20 pm
by MxPxpunk
its all clear except for the trigger multiple where on the helicopter do i put it. oh and where do i put the script text in the .scr file, after level waittill spawn?

Posted: Fri Oct 17, 2003 6:56 am
by TheStorm
If you want to turn it off and on use a trigger_use, place the trigger where you want the player to press use....maybe where the pilot are supposed to sit. Give the trigger key/value setthread/mythread and key/value targetname/yourtriggername

Then some where in the begining of your level scr file add this

level.helibladespinn = 0

then this should be the mythread and I've used somthing similar to bdbodger.

Code: Select all

mythread:
   $yourtriggername nottriggerable
   if (level.helibladespinn == 0)
   {
      $myfan loopsound yoursound // if you have a sound or else skip this
      for (local.i=10;local.i < 360;local.i = local.i +10) 
      {
          $myfan rotatey local.i
          wait 0.2 // Adjust this so it increases speed in the rate you want
      }
      level.helibladespinn = 1
   }
   else
   {
       for (local.i=360 ;local.i > 0;local.i = local.i - 10) 
      {
          $myfan rotatey local.i
          wait 0.2 // Adjust this so it decreases speed in the rate you want
      }
      level.helibladespinn = 0
      $myfan stopsound
   }
   $yourtriggername triggerable
end

I have not checked the code for spelling errors and stuff, it should basically work!

Posted: Fri Oct 17, 2003 5:58 pm
by MxPxpunk
ok cool, thanks. for the rear propeller of the chopper, it rotates on x, should i have a sepparate trigger/thread or shoud i have two targets for the one trigger and just add the script for the first propeller but change the targetname and rotatey to rotatex.

Posted: Fri Oct 17, 2003 7:54 pm
by TheStorm
Give it a different target name and then just add it to the script

$myfan rotatey local.i
$myfan1 rotatex local.i