Training level

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
*GCC*Nigel
Second Lieutenant
Posts: 169
Joined: Sun Dec 04, 2005 5:13 am

Training level

Post by *GCC*Nigel »

God help me, I actually have to get into scripting...

Is there a way to script a target to fall over when shot in the center, then pop up again when a lever is hit?
Stein Auf
Devil_Dog
Warrant Officer
Posts: 140
Joined: Fri Feb 17, 2006 2:59 pm

Post by Devil_Dog »

Try makeing it a rotating door that opens down when shot(i think you would set the health), and closes up with a trigger near the lever.
Computers hate me!!!!!
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

devildog's on the right track, but you really need a script. make a door that rotates DOWN (put the origin at the bottom of the target and then set the angle to the direction it should fall), put a trigger in front of it, give it a setthread of killTarget, and put this in your script.

Code: Select all

killTarget:

$target doopen
$targetTrigger nottriggerable
end
then, on your lever put a setthread and do this

Code: Select all

lever:

$target doclose
$targetTrigger triggerable
end
this is off the top of my head, not totally sure doopen and doclose are correct, it's what g_allclasses says but i'm still not sure. in any event that's the framework you need to make it do what you described.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

You can't make a door rotate down . Setting the angle -2 will make a func_door slide down and -1 will make it slide up but for a rotateing door it will only open and close on a yaw angle . You will have to do it by script . Make your door as normal with an origin brush at the bottom then with both selected make it a script_object . Put a trigger_multiple in front of it where you want it to be shot and have the trigger target your target . Set the projectiles spawnflag checkbox it should then say spawnflags 16 . For the lever you could use an amimate/equipment/trainswitch or amimate/equipment/trainswitch_pulse . Place the switch and put a trigger_use around it . Have the trigger_use target the trainswitch . For the scripting part try this . I will use the targetnames $target_trigger for the trigger multiple and $switch_trigger for the trigger use .

target_down:

$target_trigger.down = 0
$target_trigger time 1

while(1)
{
$target_trigger waittill trigger

if($target_trigger.down = 0)
{
$($target_trigger.target) rotatedownto -90
$($target_trigger.target) waitmove
$target_trigger.down = 1
}
}
end

target_switch:

while(1)
{
$switch_trigger waittill trigger

if($target_trigger.down = 1)
{
$($switch_trigger.target) anim move
$($target_trigger.target) rotateupto 0
$($target_trigger.target) waitmove
$target_trigger.down = 0
}
}
end
Image
User avatar
k47a
товарищ
Posts: 810
Joined: Fri Mar 25, 2005 1:19 pm

Post by k47a »

bdbodger wrote:You can't make a door rotate down
cant you use the 'stormdoor' kind of door? (check Tom's door map for stormdoor)
Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

The storm door was scripted . You can't make a func_rotating door rotate down but you can scirpt a script_object to do that .
Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Post by tltrude »

bdbodger is right, function type doors will not rotate up and down.

You'll probably need to spawn a new trigger in the script after the trigger_multiple is killed.
Tom Trude,

Image
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

If you don't give the trigger multiple a health setting it shouldn't be killed it is only when you give it health that it can be killed .
Image
Post Reply