Page 1 of 2

WW2 bucket truck

Posted: Wed Nov 05, 2003 8:21 am
by tltrude
Ok, I made an authentic WW2 telephone repair bucket truck, ha ha. It works great--goes up and down with engine sounds. But I would like it to come down when the player in the bucket dies or jumps out. Any ideas would be welcome.

Image

Code: Select all

//------------------------------------------------> 
// Bucket truck threads 
//------------------------------------------------>

bucket_prep:

	$bucket_trigger bind $bucket
	$bucket bind $arm2
	$arm2 bind $arm1
	$bucket time 6
	$arm1 time 6
	$arm2 time 6
	goto bucket_mover

end

bucket_mover:

	$bucket_trigger waittill trigger
	$bucket_truck_speaker stoploopsound
	$bucket_truck_speaker loopsound bucket_truck_snd
	$arm1 rotateXup -45
	$arm2 rotateXup 90
	$bucket rotateXup -45
	$arm1 move
	$arm2 move
	$bucket waitmove
	$bucket stoploopsound
	$bucket_truck_speaker loopsound bucket_truck_idle

	$bucket_trigger waittill trigger
	$bucket_truck_speaker stoploopsound
	$bucket_truck_speaker loopsound bucket_truck_snd
	$arm1 rotateXup 45
	$arm2 rotateXup -90
	$bucket rotateXup 45
	$arm1 move
	$arm2 move
	$bucket waitmove
	$bucket_truck_speaker stoploopsound
	goto bucket_mover

end
There will probably have to be a wait so the body and gear has time to vanish (about 9.5 seconds) before the bucket comes down. I could put a second trigger on the ground level, but other players might trigger it.

Posted: Wed Nov 05, 2003 9:44 am
by bdbodger
I see lots of things you could do with this script . For instance you could devide it into two one for a up button and one for a down button . For example

moveup:

$bucket_trigger waittill trigger
local.guy = parm.other
$bucket_truck_speaker stoploopsound
$bucket_truck_speaker loopsound bucket_truck_snd

while(local.guy.useheld == 1)
{
$arm1 rotateXup -1
$arm2 rotateXup 2
$bucket rotateXup -1
$arm1 move
$arm2 move
$bucket waitmove
}

$bucket stoploopsound
$bucket_truck_speaker loopsound bucket_truck_idle

if !(isalive local.guy)
{
$arm1 rotatexdownto 0 // absolute angle 0 which is the original position of the arm before moveing
$arm2 rotatexdownto 0
$bucket rotatexdownto 0
$arm1 move
$arm2 move
$bucket waitmove
}
goto moveup
end

works

Posted: Wed Nov 05, 2003 10:42 am
by tltrude
Well that works fine, although it is mighty slow moving. I jumped out and then blew myself up, but the bucket did not come down. Maybe I was still "local.guy" after respawning? It would also need something to limit the up travel.

Posted: Wed Nov 05, 2003 1:34 pm
by smartaiguy
Maybe put a trigger inside the bucket. When ever its being triggered keep it up, once the trigger goes off go down.

Like

$trigger waittill trigger

then make it so if its triggered make it operational, if not return to the original postion. Maybe this will help.

triggers

Posted: Wed Nov 05, 2003 6:08 pm
by tltrude
There are now two more triggers. A trigger_multiple named "$bucket_occupied_trigger" and a second trigger_used named "$bucket_trigger2".

Posted: Thu Nov 06, 2003 2:33 am
by smartaiguy
well that should do the trick!

Posted: Thu Nov 06, 2003 2:53 am
by nuggets
good evening :D

add a script_object inside the bucket
targetname box_trigger

bucket_prep:
$bucket_trigger bind $bucket
$bucket bind $arm2
$arm2 bind $arm1
$bucket time 6
$arm1 time 6
$arm2 time 6
goto bucket_up
end

bucket_up:
$bucket_trigger waittill trigger
$bucket_trigger nottriggerable
$bucket_truck_speaker stoploopsound
$bucket_truck_speaker loopsound bucket_truck_snd
$arm1 rotateXup -45
$arm2 rotateXup 90
$bucket rotateXup -45
$arm1 move
$arm2 move
$bucket waitmove
$bucket_trigger triggerable
$bucket stoploopsound
$bucket_truck_speaker loopsound bucket_truck_idle
level.in_bucket = 0
while (1)
{for (local.i=1;local.i<=$player.size;local.i++)
{if ($player[local.i] istouching $box_trigger)
{level.in_bucket++}}
if (level.in_bucket == 0)
{waitframe}
else
{goto bucket_down}}
$bucket_trigger waittill trigger

bucket_down:
$bucket_trigger nottriggerable
$bucket_truck_speaker stoploopsound
$bucket_truck_speaker loopsound bucket_truck_snd
$arm1 rotateXup 45
$arm2 rotateXup -90
$bucket rotateXup 45
$arm1 move
$arm2 move
$bucket waitmove
$bucket_trigger triggerable
$bucket_truck_speaker stoploopsound
goto bucket_up

end

//and yes it is 3:15am :(

Bucket

Posted: Thu Nov 06, 2003 3:16 am
by tltrude
The "bucket" is only big enough for one player. And, as I said before, the trigger_multiple in it is named "$bucket_occupied_trigger" and the two trigger_use are named "$bucket_trigger", and $bucket_trigger2".

Posted: Thu Nov 06, 2003 4:02 am
by bdbodger
If the speed is not right adjust the time of the parts

moveup:

$bucket_trigger waittill trigger
local.guy = parm.other
$bucket_truck_speaker stoploopsound
$bucket_truck_speaker loopsound bucket_truck_snd

while(local.guy.useheld == 1)
{
local.angles=$arm1.angles

if(local.angles[0] < 90)
{
$arm1 rotateXup -5
$arm2 rotateXup 5
$bucket rotateXup -5
$arm1 move
$arm2 move
$bucket waitmove
}
}

$bucket stoploopsound
$bucket_truck_speaker loopsound bucket_truck_idle

waitthread downcheck local.guy

goto moveup
end
//************************************************************
movedown:
$bucket_trigger2 waittill trigger
local.guy = parm.other
$bucket_truck_speaker stoploopsound
$bucket_truck_speaker loopsound bucket_truck_snd

while(local.guy.useheld == 1)
{
local.angles=$arm1.angles

if(local.angles[0] > 0 )
{
$arm1 rotateXup 5
$arm2 rotateXup -5
$bucket rotateXup 5
$arm1 move
$arm2 move
$bucket waitmove
}
}

$bucket stoploopsound
$bucket_truck_speaker loopsound bucket_truck_idle

waitthread downcheck local.guy

goto movedown
end
//********************************************************************
downcheck local.guy:
if (!(isalive local.guy) || !(local.guy istouching bucket_trigger))
{
$bucket_truck_speaker stoploopsound
$bucket_truck_speaker loopsound bucket_truck_snd

$arm1 rotatexdownto 0 // absolute angle 0 which is the original position of the arm before moveing
$arm2 rotatexdownto 0
$bucket rotatexdownto 0
$arm1 move
$arm2 move
$bucket waitmove
}
$bucket stoploopsound
$bucket_truck_speaker loopsound bucket_truck_idle
end

Posted: Thu Nov 06, 2003 5:04 am
by Mirek
Hello Tom :D


I guess going from your original script I myself would do it this way using a single trigger ($bucket_trigger) in the bucket -

Code: Select all


//------------------------------------------------> 
// Bucket truck threads 
//------------------------------------------------> 

bucket_prep: 

   level.bucketfull = 0

   $bucket_trigger bind $bucket 
   $bucket bind $arm2 
   $arm2 bind $arm1 
   $bucket time 6 
   $arm1 time 6 
   $arm2 time 6 

   thread bucket_check
   goto bucket_mover 

end 

bucket_check:

                // Keep checking if bucket is occupied

	if (local.guy istouching $bucket_trigger )
	{
                  level.bucketfull = 1
	}
                 else
                {
                  level.bucketfull = 0
	}
                 

       wait .2

       goto bucket_check

end

bucket_mover: 

    while ( level.bucketfull <= 0)
               wait .2


   $bucket_truck_speaker stoploopsound 
   $bucket_truck_speaker loopsound bucket_truck_snd 
   $arm1 rotateXup -45 
   $arm2 rotateXup 90 
   $bucket rotateXup -45 
   $arm1 move 
   $arm2 move 
   $bucket waitmove 
   $bucket stoploopsound 
   $bucket_truck_speaker loopsound bucket_truck_idle 

    while ( level.bucketfull >= 1)
               wait .2

   wait 9.5 // your sugested wait time before going down
 
   $bucket_truck_speaker stoploopsound 
   $bucket_truck_speaker loopsound bucket_truck_snd 
   $arm1 rotateXup 45 
   $arm2 rotateXup -90 
   $bucket rotateXup 45 
   $arm1 move 
   $arm2 move 
   $bucket waitmove 
   $bucket_truck_speaker stoploopsound 

   goto bucket_mover 

end 


Hope it helps - Cheers

Posted: Thu Nov 06, 2003 5:11 am
by bdbodger
My way you can control the amount the bucket rises and falls so if you can make a way to control the truck too you can use the lift to get anywhere you want within reach

Posted: Thu Nov 06, 2003 5:25 am
by bdbodger
I just thought of something else all the parts are bound to the bottom arm so if you rotate the bottom arm you can rotate the rest of it as well just make sure you have an origin brush as part of the bottom arm . If you somehow had buttons for all the parts of the arm you could make it move like real adjust the reach and direction etc . For example when the bottom arm is moveing up you rotate the middle arm to keep things level . When the middle arm is moveing you rotate the bucket to keep it level . I think 6 button will be needed two for rotation of the arm left and right , two for the bottom arm up and down and two for the top arm up and down . Or use 3 buttons press one the first time it goes down press it again it goes up .

Posted: Thu Nov 06, 2003 5:45 am
by bdbodger
Jee I am getting lots of ideas what about makeing the base a scaled down vehicletank base with no turret . when you attach driverslot entity to a tank with no turret the tank base moves like a normal player tank but you dont because there is no turret and I think your view will be locked so you have to detach before you do anything else like move the arm or look around and shoot . I think if the arm is bound to the base and you are in the bucket you will move with the tank base . Make the base scaled down enough so the bucket is almost on the ground when down .

Drivable

Posted: Thu Nov 06, 2003 11:51 am
by tltrude
Yes, I thought of making the halftrack drivable too. It would be nice to be able to move your "sniper truck" to anywhere on you want. I don't think 6 triggers would fit on the bucket--they would be to close to eachother. If keypad keys could be assigned, it might work. But, it seem a bit over the top to me.

I will try the new threads and post the results. Thanks!

Mirek - looks good, but no way down shot of jumping or death.
bdbodger - got an infinite loop shutdown!--added "wait .1" to both while statements.

Tried It and it doesn't work. The bucket goes up about a foot and stops. It can be lowered again, but nothing happens when I jump out with it raised.

Code: Select all

//------------------------------------------------> 
// Bucket truck threads 
//------------------------------------------------>

bucket_prep:

	$bucket_trigger bind $bucket
	$bucket_trigger2 bind $bucket
	$bucket_occupied_trigger bind $bucket
	$bucket bind $arm2
	$arm2 bind $arm1
	$bucket time 1
	$arm1 time 1
	$arm2 time 1
	thread moveup
	thread movedn

end

moveup: 

	$bucket_trigger waittill trigger 
	local.guy = parm.other 
	$bucket_truck_speaker stoploopsound 
	$bucket_truck_speaker loopsound bucket_truck_snd 

	while(local.guy.useheld == 1) 
	{ 
		local.angles=$arm1.angles 
		wait .1 
		if(local.angles[0] < 90) 
		{ 
		$arm1 rotateXup -1 
		$arm2 rotateXup 2 
		$bucket rotateXup -1 
		$arm1 move 
		$arm2 move 
		$bucket waitmove
		} 
	} 

	$bucket stoploopsound 
	$bucket_truck_speaker loopsound bucket_truck_idle 

	waitthread downcheck local.guy 

	goto moveup 
end 

movedn: 
	$bucket_trigger2 waittill trigger 
	local.guy = parm.other 
	$bucket_truck_speaker stoploopsound 
	$bucket_truck_speaker loopsound bucket_truck_snd 

	while(local.guy.useheld == 1) 
	{ 
		local.angles=$arm1.angles 
		wait .1 
		if(local.angles[0] > 0 ) 
		{ 
		$arm1 rotateXup 1 
		$arm2 rotateXup -2 
		$bucket rotateXup 1 
		$arm1 move 
		$arm2 move 
		$bucket waitmove
		} 
	} 

	$bucket stoploopsound 
	$bucket_truck_speaker loopsound bucket_truck_idle 

	waitthread downcheck local.guy 

	goto movedn 
end 

downcheck local.guy:
 
	if (!(isalive local.guy) || !(local.guy istouching $bucket_occupied_trigger)) 
	{ 
		$bucket_truck_speaker stoploopsound 
		$bucket_truck_speaker loopsound bucket_truck_snd
		$bucket time 6
		$arm1 time 6
		$arm2 time 6 
		$arm1 rotatexdownto 0 // absolute angle 0 which is the original position
		$arm2 rotatexdownto 0 
		$bucket rotatexdownto 0 
		$arm1 move 
		$arm2 move 
		$bucket waitmove
		$bucket time 1
		$arm1 time 1
		$arm2 time 1  
	} 
	$bucket_truck_speaker stoploopsound

end

Posted: Thu Nov 06, 2003 1:21 pm
by smartaiguy
hmm...