Page 1 of 1
Fans scripting
Posted: Wed Feb 11, 2004 6:39 pm
by Snipes
heres what i've got:
Code: Select all
// Big fan for Complex
// ARCHITECTURE: Snipes
// SCRIPTING: Snipes
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Test"
setcvar "g_obj_alliedtext2" "BIG FAN"
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none"
level waittill prespawn
exec global/DMprecache.scr
exec global/testaye.scr testaye
level.script = "maps/dm/testaye.scr"
level waittill spawn
thread bigfan
thread stopfan
end
bigfan:
$bigfan rotatey 360
$bigfan time 10
end
stopfan:
$stopfan rotatey 0
end
end
I have a trigger_use with targetname stopfan which I have targeted to the script_object which is bigfan. I was hoping when I press use on it the bigfan it would stop? It doesnt though.
Going furthur I would like maybe one switch to make it switch on and off or maybe two (one for on and one for off)
* The speed doesnt work either

I want it to rotate quite slow.
My Fan isnt really a fan but a large moving platform with four parts.
Thanks.
Posted: Wed Feb 11, 2004 7:06 pm
by jv_map
I suppose you want the fan to stop rotating rather than the trigger, so
$stopfan rotatey 0
should be
$bigfan rotatey 0
Also, give the trigger key / value
setthread / stopfan
Finally the speed is the number after the rotate command, in degrees per second. Hence 360 means 1 complete turn each second, setting it lower obviously causes your fan to rotate slower.
Posted: Wed Feb 11, 2004 8:57 pm
by Snipes
Dude, your a genius! Thanks!!!

stop
Posted: Thu Feb 12, 2004 2:01 am
by tltrude
Remove the "thread stopfan" line under level waittill spawn (starts the thread) because the thread is now being started by the setthread in the trigger named stopfan.
Here is a way to use just one trigger--lets targetname it "bigfan_switch" (no setthread needed).
Code: Select all
// Big fan for Complex
// ARCHITECTURE: Snipes
// SCRIPTING: Snipes
main:
// set scoreboard messages
setcvar "g_obj_alliedtext1" "Test"
setcvar "g_obj_alliedtext2" "BIG FAN"
setcvar "g_obj_alliedtext3" ""
setcvar "g_obj_axistext1" ""
setcvar "g_obj_axistext2" ""
setcvar "g_obj_axistext3" ""
setcvar "g_scoreboardpic" "none"
level waittill prespawn
exec global/DMprecache.scr
exec global/testaye.scr testaye
level.script = "maps/dm/testaye.scr"
level waittill spawn
level.fan_spinning = 0
thread bigfan_mover
end
bigfan_mover:
$bigfan_switch waittill trigger
if (level.fan_spinning == 0)
{
thread bigfan_start
goto bigfan_mover
}
if (level.fan_spinning == 1)
{
thread bigfan_stop
goto bigfan_mover
}
end
bigfan_start:
wait .5
$bigfan loopsound lighthouse_run
$bigfan rotateY 36 // 10 seconds per revolution (6 rpm)
level.fan_spinning = 1
end
bigfan_stop:
wait .5
$bigfan stoploopsound
$bigfan rotateY 0
level.fan_spinning = 0
end
You'll need to add player clip, or no one will be there to turn it off, ha ha! Well, you could add trigger/lines that will turn it off if no one is on it, I guess.
BTW, your scripting skills are good, at least you tried before asking for help!
Hope that works for you!
Posted: Thu Feb 12, 2004 6:51 pm
by Snipes
So im gathering that if the trigger is pushed the fan will stop if moving and start if stopped. ahh thanks!
Did u make up the _spinning as a varible? or is in game function thing?
Thanks for yout help , before i had another fanstart trigger use to start, (i had to triggers) but this is easier , cheers
Yes
Posted: Thu Feb 12, 2004 9:19 pm
by tltrude
Yes, I made up the variable name. If you look under "level waittill spawn" you'll see where "level.fan_spinning" is set to 0 (not spinning). That has to be done or the bigfan_mover thread will not know what value it has to start with. Notice that the name starts with "level" and not "local"--"level" makes it useable in any thread.
I could of made it work with a lot fewer script line, and in only one thread. But, I wanted you to have options for more triggers. With the stop and start in two threads, you can add an emergency cutoff switch. Just use this key/value in the cutoff trigger's properties.
Key: setthread
Value: bigfan_stop
Good luck with your map!