Pivoting a brush. Possible?


(MadJack) #1

I’ve got a lever I’d like to pivot and I can’t seem to do it.

I tried using setrotation but that didn’t do anything neither did setposition etc.

Here’s a pic of what I want the lever to do…

Activate, top goes down, bottom stays where it is…

I would really prefer doing that than having a lever on a wall…

Any ideas?


(Mean Mr. Mustard) #2

I think the lever needs to be a script_mover. Set the origin at the pivot point. Then rotate via the ‘faceanlges’ script command.


(Schaffer) #3

@Mean Mr Mustard: The man never sleeps.


(Java.Lang) #4

Ha, that image looks reminiscent of a Tomb Raider level for some reason.


(MadJack) #5

Thanks for the idea Mr Mustard.

The lever is already a script_mover but I didn’t check where the origin is so that’s probably why it didn’t work when I tried with faceangles. I’ll try this and post the result.

@Lang, yeah, Tomb Raider had those levers everwhere :slight_smile:


(seven_dc) #6

Try to make your lever as a func_door_rotating. Just a tought. I do not know if it works but it is worth a try.


Chevrolet Corvette C5 Specifications


(MadJack) #7

I thought about that and I dismissed the idea though for the love of life I can’t remember why :eek:

As soon as I can go into radiant I’ll try both those options.


(Mr_Tickles) #8

Just remember it is possible, think of the railgun track switch :slight_smile:

I can’t really offer anything else, but it may have something to do when the tank in fueldump/goldrush pivots? Or indeed the rotating door. Sorry


(MadJack) #9

Good! Finally made it work but here’s the catch…

When I called the script to move the lever yesterday it looked like this:


drawbridge
{
	spawn
	{
		accum 0 set 0 // 0 = backward 1 = forward
		wait 55
	}
	
	trigger move
	{
		accum 0 trigger_if_equal 0 drawbridge forward
		accum 0 trigger_if_equal 1 drawbridge backward 
	}
	
	trigger forward
	{
		gotomarker drawbridge_forward 75 wait
		accum 0 set 1
	}
	
	trigger backward
	{
		gotomarker drawbridge_backward 75 wait
		accum 0 set 0
	}
}

drawbridge_allied_lever
{
	trigger movedown
	{
		faceangles 0 0 -45 500
	}
	trigger moveup
	{
		faceangles 0 0 0 500
	}	
}

drawbridge_allied_lever_tst
{
	trigger activate
	{
		trigger drawbridge_allied_lever movedown
		trigger drawbridge move
                                           trigger drawbridge_allied_lever moveup
	}
}

What was happening with the code above is that the target_script_trigger would call trigger activate which would move the lever down, move the drawbridge then move the lever back up. The thing is that even if there’s a wait at the gotomarker, it’s only the code following the gotomarker that is in the same scriptblock that will be put on wait. Meaning that even if it was in a wait, the lever moveup was still being trigger before the drawbridge was at the end resulting in the lever to move so fast that you wouldn’t see it move.

I suspected as much so I thought to do something like faceangles 0 0 -45 1500 but that didn’t do the trick, the damn thing couldn’t be seen moving or it wasn’t moved at all.

So I decided to try the following instead.


drawbridge
{
	spawn
	{
		accum 0 set 0 // 0 = backward 1 = forward
		wait 55
	}
	
	trigger move
	{
		accum 0 trigger_if_equal 0 drawbridge forward
		accum 0 trigger_if_equal 1 drawbridge backward 
	}
	
	trigger forward
	{
		gotomarker drawbridge_forward 75 wait
		accum 0 set 1
		trigger drawbridge_allied_lever moveup
	}
	
	trigger backward
	{
		gotomarker drawbridge_backward 75 wait
		accum 0 set 0
		trigger drawbridge_allied_lever moveup
	}
}

drawbridge_allied_lever
{
	trigger movedown
	{
		faceangles 0 0 -45 500
	}
	trigger moveup
	{
		faceangles 0 0 0 500
	}	
}

drawbridge_allied_lever_tst
{
	trigger activate
	{
		trigger drawbridge_allied_lever movedown
		trigger drawbridge move
	}
}

Now, that way, the moveup is only trigger AFTER the drawbridge has finished moving because it’s in the same scriptblock as the gotomarker … wait.