script_mover with setrotation


(ChimTea) #1

Problem:

//youtu.be/ji_7iJtjMNg

I can keep rotating my lever. But I don’t want that.

The script

//==============================================
//=========   Lifting Ramp    ==================
//==============================================

lifting_ramp_trigger
{
	spawn
	{
		accum 5 set 1			// Initial state is down
		wait 500			// Wait for everything to settle
		trigger lifting_ramp_trigger main	// Move switch into correct position
	}
	trigger main
	{
		trigger lifting_ramp_trigger up
		trigger lifting_ramp_trigger down
	}
	trigger up
	{
		accum 5 abort_if_not_equal 1	// Ready to run up routine == 1
		resetscript			// wont return to trigger that called it

		trigger lifting_ramp_switch up
		accum 5 set 0			// Setup accum for up routine
	}
	trigger down
	{
		accum 5 abort_if_not_equal 0	// Ready to run down routine == 0
		resetscript			// wont return to trigger that called it

		trigger lifting_ramp_switch down
		accum 5 set 1			// Setup accum for up routine
	}
}


lifting_ramp_switch
{
	spawn
	{
	}

	trigger up
	{
		playsound sound/movers/switches/butn2.wav
		setrotation 0 0 -90
		wait 500
		stoprotation
	}
	trigger down
	{
		playsound sound/movers/switches/switch.wav
		setrotation 0 0 90
		wait 500
		stoprotation
	}

}

Should I set the func_inv_user invisible when triggered?

Sorry about the darkness didn’t really put lighting in it yet.


(stealth6) #2

Have you tried without resetscript?


(ChimTea) #3

Have now, It will only go in one direction then. I could call a setstate during the movement so the trigger is invisible.

Update:

lifting_ramp_switch
{
	spawn
	{
		[B]setstate ramp_inv default[/B]
	}

	trigger up
	{
		[B]setstate ramp_inv invisible[/B]
		playsound sound/movers/switches/butn2.wav
		setrotation 0 0 -90
		wait 500
		stoprotation
		[B]setstate ramp_inv default[/B]
	}
	trigger down
	{
		[B]setstate ramp_inv invisible[/B]
		playsound sound/movers/switches/switch.wav
		setrotation 0 0 90
		wait 500
		stoprotation
		[B]setstate ramp_inv default[/B]
	}

}

Technically it works but, setstate called but no entities found. That and it wont show the cursor hint anymore.


(stealth6) #4

Where did you find documentation for setrotation? If I google it all I can find is:
setrotation <pitchspeed> <yawspeed> <rollspeed>

You have 5 values?


(ChimTea) #5

Got no idea, might as well remove it


(stealth6) #6

So the problem now is that the switch works, but the hint is invisible & it only turns in 1 direction?


(ChimTea) #7

I just have to place the setstate correctly but I’m unsure where exactly.
I can’t place it at ‘lifting_ramp_switch’ on the trigger_up or down, because then I would have set it two times invisible.


(stealth6) #8

Well with the info provided I don’t really understand what you’re trying to do, but from what I understand I’d do this:


lifting_ramp_trigger {
	trigger main
	{
		setstate ramp_inv invisible
		trigger lifting_ramp_trigger up
		trigger lifting_ramp_trigger down
		setstate ramp_inv default
	}
}


(ChimTea) #9

I want it to act as a switch, to make another script_mover go up & down as well. But it works differently since no path_corners are used here.


(twt_thunder) #10

Dont know if it is to any help… but take a look at my bridge and script

http://www.thewolfteam.org/download.php?view.173