WW2 bucket truck

Post your scripting questions / solutions here

Moderator: Moderators

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

Post by bdbodger »

You changed a line

if (!(isalive local.guy) || !(local.guy istouching $bucket_occupied_trigger))

the $bucket_trigger is already bound to the bucket so you don't need another trigger . I assumed that the $bucket_trigger was inside the bucket . I don't know why it only went up a foot if the useheld loop is working . I can see where adding a wait to the loop was nessasary I thought the waitmove would make it not nessasary but oh well . when you make a script object it's angles are 0 0 0 . If you rotatexdownto 0 you should end up where you started at angle 0 the x angle is forward and back 0 being level and in front of the object . To make the x angle right you may have to have the forward direction you want for the arms face the right side of the editor angle 0 so as not to confuse it with the z axis . I mean if you make if so the arms face 90 then you need to rotate on the z axis to make it work . I know you probably know all this but I though I'd mention it for those that don't .
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

trigger

Post by tltrude »

You had:
............................................
moveup:

$bucket_trigger waittill trigger
............................................

in the tread, so you must know it is a trigger use. Also, your line did not have a "$" for the trigger name. As you can see in prep, the trigger multiple "$bucket_occupied_trigger" is also bound to the bucket. Your old thread worked just fine to make the bucket move up, but had no limit.

Ahhh! Arm1 rotates with a negative number.

local.angles=$arm2.angles

should fix it!........it did, although I had to change it to 45 degrees (arm1 is subtracted from arm2).

Now I have another problem. The downcheck thread only runs if I jump out onto the rim and click on one of the two trigger_use. And, the arms and bucket flip the wrong way to get back to 0 (under the truck). I think this is because arm1 is at 315 when it is all the way up.
Tom Trude,

Image
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

WOW!

Post by tltrude »

It works! It works! Thanks bdbodger! I will post the tutorial map as soon as I clean up a few bugs with other things in it.

Code: Select all

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

bucket_prep:

	$bucket_trigger bind $bucket
	$bucket_trigger2 bind $bucket
	$up_switch bind $bucket
	$down_switch 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.angles=$arm2.angles
	if (local.angles[0] == 45)
	{
		goto moveup
	} 
	local.guy = parm.other 
	$bucket_truck_speaker stoploopsound 
	$bucket_truck_speaker loopsound bucket_truck_snd 
	$up_switch anim move

	while (local.guy.useheld == 1) 
	{ 
	local.angles=$arm2.angles 
	wait .1 
		if (local.angles[0] < 45) 
		{ 
			$arm1 rotateXup -1 
			$arm2 rotateXup 2 
			$bucket rotateXup -1 
			$arm1 move 
			$arm2 move 
			$bucket waitmove
		}
//	iprintln "Arm2 angle = " (local.angles[0])
	} 

	$bucket stoploopsound 
	$bucket_truck_speaker loopsound bucket_truck_idle 
	thread downcheck local.guy 
	$up_switch anim idle
	goto moveup 
end 

movedn: 
	$bucket_trigger2 waittill trigger
	local.angles=$arm2.angles
	if (local.angles[0] == 0)
	{
		goto movedn
	} 
	local.guy = parm.other 
	$bucket_truck_speaker stoploopsound 
	$bucket_truck_speaker loopsound bucket_truck_snd 
	$down_switch anim move

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

	$bucket stoploopsound 
	$bucket_truck_speaker loopsound bucket_truck_idle 
	thread downcheck local.guy 
	$down_switch anim idle
	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 rotateXupto 0
		$arm2 rotateXdownto 0
		$bucket rotateXupto 0 
		$arm1 move 
		$arm2 move 
		$bucket waitmove
		$bucket time 1
		$arm1 time 1
		$arm2 time 1
		$bucket_truck_speaker stoploopsound
		end  
	}
	wait .1 
	goto downcheck local.guy

end
Last edited by tltrude on Sat Nov 08, 2003 12:12 am, edited 2 times in total.
Tom Trude,

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

Post by bdbodger »

Good glad you got it working . I had the right idea just needed to tweaked as for as rotate up or down etc . I thought about the triggers last night and realized I was a little confused about it at first but after reviewing it in my mind I figured it out . One other thing you could add a trigger use to rotate the whole arm as well just by rotateing the bottom arm on the y axis . Or make a base and bind the bottom arm to it and rotate it .
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Tutorial map

Post by tltrude »

Here is the tutorial map. It is intended to show alternatives for elevator and, along with the bucket truck, has a five story elevator that requires no scripting. There is also a scissor lift cart, a window washer platform with ropes, and a swing down fire escape ladder.

The zip contains the usual playable pk3, .map file, and text version of the script.

http://pages.sbcglobal.net/tltrude/Temp/altelevator.zip

Image

Thanks for everyones help and ideas!
Tom Trude,

Image
smartaiguy
Brigadier General
Posts: 512
Joined: Tue Jul 08, 2003 2:52 pm

Post by smartaiguy »

Great!! :D
Fallschirmjager in europe(FIE)! (Mapper/Webmaster)
.Map map reviewer
Look up in the sky! Its a bird its a plane, oh wait its a bird.:lol:
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Found a problem with your bucket script .

local.angles=$arm2.angles

Is only checked while local.player.useheld =1 so when you jump out of the bucket or are killed and the bucket goes down local.angles remains at what ever it was when you where killed . You need to put that at the top of the script as well so it resets when the user is killed . Also I could not get the down leaver to work . I use it once I got in and it moved thats all I tried the other lever to move up but then the down lever didn't work at all . I also found the stairs and fire escape really narrow . I was on the roof and could not jump into the elevator escape hatch even though it is open . A trick for your wires on the window washer bind them to the platform and at the top make hollow sky textured boxes so when they move up you can't see them above the start point on the roof .
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

washer

Post by tltrude »

I tried the hollow sky box above the ropes trick before and it didn't work. I also tried caulk and nodraw. The .map file is in the zip, if you want to try it yourself. The fire escapes are 32 wide.

I don't see why the local.angles need to be reset. It should get reset when the next guy gets in and hits the up trigger. The problem with the down trigger, I think, has to do with the player being too close to it, or at the wrong angle to it.

You have all the files, so if you come up with something better, please let me know right away--before too many people download it.
Tom Trude,

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

Post by bdbodger »

in the script

$bucket_trigger waittill trigger
if (local.angles[0] == 45)
{
goto moveup

if you get killed at the to then local.angle will be 45 never gets to the useheld part this works

$bucket_trigger waittill trigger
local.angles=$arm2.angles
if (local.angles[0] == 45)
{
goto moveup

yes I guess the skybox thing is a bad idea maybe make a pulley so the the rope appears to be going though it . Any way no big deal looks good some interesting ideas in this map . Also untill I looked at the map I didn't know there where ladders on the truck .
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

Line

Post by tltrude »

Ok, I added that line to both the moveup and movedn threads and updated the download. I edited the last post that had the threads with the new version.

Oh!, if you want to try that spin of arm1 thing, there is already an origin brush at the base of it. I, however, would not think spinning would be needed, unless someone wanted to use the truck to get to a window or something. And, then there would be the problem of the bucket going though a wall and crushing (or trapping) the player.
Last edited by tltrude on Sat Nov 08, 2003 12:58 am, edited 3 times in total.
Tom Trude,

Image
smartaiguy
Brigadier General
Posts: 512
Joined: Tue Jul 08, 2003 2:52 pm

Post by smartaiguy »

:) Nice downloading it now...
Fallschirmjager in europe(FIE)! (Mapper/Webmaster)
.Map map reviewer
Look up in the sky! Its a bird its a plane, oh wait its a bird.:lol:
User avatar
Alcoholic
General
Posts: 1470
Joined: Sat May 17, 2003 5:57 am
Location: California
Contact:

Post by Alcoholic »

I must say very smart ideas tltrude. One time I tried using that method to make melee mechwarriors, but it didn't work out. :cry: Maybe you can try making some sort of vehicle with an arm that attacks players. :twisted:
Post Reply