Page 1 of 3

Elevator script + map Hilfe...

Posted: Thu Feb 03, 2005 5:09 pm
by Kalti
Okay guys, trying to get my elevator to work with the animated trainswitches, with counterweight but without liftdoors and it only travels one floor up/down.

I've looked at various maps, scripts and tutorials and decided the lift script from Wacko's *ihr* (and Krane's) Dorf2 map, it has the counterweight and cables while I tried to implement tltrude's animated trainswitches found on his *your* altelevator map.

Currently when I activate the lower switch MOH is returned to the main screen on the console error: 'ERROR: Command overflow. Possible infinite loop in thread.'

The script is me, hoping to make it work eventhough I'm just trying to understand what Wacko & tltrude exactly did. Sounds & wires not (yet?) used:

Code: Select all

// Venice Lift
// Architecture: Kalti
// Scripting: Kalti
// Lift script used by courtesy of Wacko
// Animated switches as in Altelevator map by tltrude

main:

//*** Scoreboard Messages And Image
setcvar "g_obj_alliedtext1" "Venice" 
setcvar "g_obj_alliedtext2" "By Kalti"
setcvar "g_obj_alliedtext3" "Script Test"
setcvar "g_obj_axistext1" "Ahem" 
setcvar "g_obj_axistext2" "Visit"
setcvar "g_obj_axistext3" "www.uberclan.com"
setcvar "g_scoreboardpic" "none"

local.master = spawn ScriptMaster

//local.master aliascache [aliasname] [soundfile] soundparms [basevolume] [randvolume] [basepitch] [randpitch] [mindist] [maxdist] [channel] loaded maps "obj dm"

	// call additional stuff for playing this map round based is needed
	if(level.roundbased)
		thread roundbasedthread

	level waittill prespawn

//*** Precache Dm Stuff
	//exec maps/dm/venice_precache.scr

	exec global/door_locked.scr::lock
	level.script = maps/dm/elevator.scr
	//exec global/ambient.scr venice
	//exec global/weather.scr
	//exec global/shutter.scr
	thread lift_prep

	level waittill spawn

end

//*** Elevator ***
lift_prep:
	//*** Wires ***
	//$el_wire_01 moveUp 340
	//$el_wire_01 move
	//$el_wire_02 moveUp 540
	//$el_wire_02 move
	//$el_wire_03 moveUp 740
	//$el_wire_03 move
	//$el_wire_04 moveUp 940
	//$el_wire_04 waitmove
	//*** Wires ***
	$venice_lifttrigger_up nottriggerable
end

liftup:
	$venice_lifttrigger_down anim move
	$venice_lifttrigger_up nottriggerable
	//$venice_lift loopsound lift_sound
	$venice_lift time 6
	$venice_lift moveUp 800
	$venice_lift move
	//*** Wires ***
	//$el_wire_01 time 6
	//$el_wire_01 moveUp 800
	//$el_wire_01 move
	//$el_wire_02 time 6
	//$el_wire_02 moveUp 600	
	//$el_wire_02 move
	//$el_wire_03 time 6
	//$el_wire_03 moveUp 400
	//$el_wire_03 move
	//$el_wire_04 time 6
	//$el_wire_04 moveUp 200
	//$el_wire_04 move
	//*** Wires ***
	$venice_liftweight time 6
	$venice_liftweight moveDown 800
	$venice_liftweight move
	//*** Wires ***
	//$we_wire_01 time 6
	//$we_wire_01 moveDown 600
	//$we_wire_01 move
	//$we_wire_02 time 6
	//$we_wire_02 moveDown 400
	//$we_wire_02 move
	//$we_wire_03 time 6
	//$we_wire_03 moveDown 200
	//$we_wire_03 waitmove
	//*** Wires ***
	//$venice_lift loopsound liftsound
	$venice_lifttrigger_down triggerable
	$venice_lifttrigger_down anim idle
	goto liftup
end

liftdown:
	$venice_lifttrigger_up anim move
	$venice_lifttrigger_down nottriggerable
	//$lift loopsound lift_sound
	$lift time 6
	$lift moveDown 800
	$lift move
	//*** Wires ***
	//$el_wire_01 time 6
	//$el_wire_01 moveDown 800
	//$el_wire_01 move
	//$el_wire_02 time 6
	//$el_wire_02 moveDown 600
	//$el_wire_02 move
	//$el_wire_03 time 6
	//$el_wire_03 moveDown 400
	//$el_wire_03 move
	//$el_wire_04 time 6
	//$el_wire_04 moveDown 200
	//$el_wire_04 move
	//*** Wires ***
	$venice_liftweight time 6
	$venice_liftweight moveUp 800
	$venice_liftweight move
	//*** Wires ***
	//$we_wire_01 time 6
	//$we_wire_01 moveUp 600
	//$we_wire_01 move
	//$we_wire_02 time 6
	//$we_wire_02 moveUp 400
	//$we_wire_02 move	
	//$we_wire_03 time 6
	//$we_wire_03 moveUp 200
	//$we_wire_03 waitmove
	//*** Wires ***
	//$lift loopsound lift_sound wait
	$venice_lifttrigger_up triggerable
	$venice_lifttrigger_up anim idle
	goto liftdown
end
//*** END Elevator ***

//-----------------------------------------------------------------------------

roundbasedthread:

	// Can specify different scoreboard messages for round based games here.

	level waitTill prespawn

	level waittill spawn

	// set the parameters for this round based match
	level.dmrespawning = 0 // 1 or 0
	level.dmroundlimit = 5 // round time limit in minutes
	level.clockside = kills // set to axis, allies, kills, or draw

	level waittill roundstart

end
I may have made a mistake in mohr but looking around tells me the error probably is caused by inproper use of the 'goto' command. However, I really have no idea how to fix this or how to do it the right way, so I'm hoping one of you guys has some time to take a look at it...

Download Map+Script

Thanks,

Image

Kalti

Btw. distances of lift-travel have not been adjusted to fit the map!

Re: Elevator script + map Hilfe...

Posted: Thu Feb 03, 2005 7:54 pm
by Rookie One.pl

Code: Select all

liftup:
	$venice_lifttrigger_up waittill trigger // <-- that's what you forgot
	$venice_lifttrigger_down anim move // <-- there's no such thing!!!
	$venice_lifttrigger_up nottriggerable
	//$venice_lift loopsound lift_sound
	$venice_lift time 6
	$venice_lift moveUp 800
	$venice_lift move
	//*** Wires ***
	//$el_wire_01 time 6
	//$el_wire_01 moveUp 800
	//$el_wire_01 move
	//$el_wire_02 time 6
	//$el_wire_02 moveUp 600	
	//$el_wire_02 move
	//$el_wire_03 time 6
	//$el_wire_03 moveUp 400
	//$el_wire_03 move
	//$el_wire_04 time 6
	//$el_wire_04 moveUp 200
	//$el_wire_04 move
	//*** Wires ***
	$venice_liftweight time 6
	$venice_liftweight moveDown 800
	$venice_liftweight move
	//*** Wires ***
	//$we_wire_01 time 6
	//$we_wire_01 moveDown 600
	//$we_wire_01 move
	//$we_wire_02 time 6
	//$we_wire_02 moveDown 400
	//$we_wire_02 move
	//$we_wire_03 time 6
	//$we_wire_03 moveDown 200
	//$we_wire_03 waitmove
	//*** Wires ***
	//$venice_lift loopsound liftsound
	$venice_lifttrigger_down triggerable
	$venice_lifttrigger_down anim idle // <-- again, no such thing exists
	goto liftup
end
Similar for the down part.

Posted: Thu Feb 03, 2005 7:58 pm
by Kalti
Thanks... But that anim part, isn't that controlling the animation of the switches ?

Btw. just to be as complete as possible about it, I want both switches (triggers) to call (when not at that floor) and send the elevator (when available)

Posted: Thu Feb 03, 2005 8:04 pm
by wacko

Code: Select all

//*** Elevator ***
lift_prep:
	level.liftpos=1 //1 is up, 0 is down
	$venice_lift time 6
	$venice_liftweight time 6	
end

liftup:
	$venice_liftswitch_down anim move
	$venice_lifttrigger_down nottriggerable
	$venice_lifttrigger_up nottriggerable
	
	if (level.liftpos==0)
	{
		$venice_lift moveUp 360
		$venice_lift move
		$venice_liftweight moveDown 360
		$venice_liftweight waitmove
		level.liftpos=3
	}

	if(level.liftpos==1)
	{	
		$venice_lift moveDown 360
		$venice_lift move
		$venice_liftweight moveUp 360
		$venice_liftweight waitmove
		level.liftpos=2
	}
	level.liftpos = level.liftpos - 2
	$venice_lifttrigger_up triggerable
	$venice_lifttrigger_down triggerable
	$venice_liftswitch_down anim idle
end

liftdown:
	$venice_liftswitch_up anim move
	$venice_lifttrigger_up nottriggerable
	$venice_lifttrigger_down nottriggerable
	
	if (level.liftpos==0)
	{
		$venice_lift moveUp 360
		$venice_lift move
		$venice_liftweight moveDown 360
		$venice_liftweight waitmove
		level.liftpos=3
	}

	if(level.liftpos==1)
	{	
		$venice_lift moveDown 360
		$venice_lift move
		$venice_liftweight moveUp 360
		$venice_liftweight waitmove
		level.liftpos=2
	}
	level.liftpos = level.liftpos - 2
	$venice_lifttrigger_up triggerable
	$venice_lifttrigger_down triggerable
	$venice_liftswitch_up anim idle
end

Posted: Thu Feb 03, 2005 8:05 pm
by wacko
had written a whole story but when i submitted, rookie one and kalti were in between and all was gone. :cry:
anyway, this last one works. in ur script, u did $venice_lifttrigger_down and _up twice, for the trigger and for the switch which would have to be $venice_liftswitch_down and _up, of course. And the goto command made the overflow :wink:

Posted: Thu Feb 03, 2005 8:09 pm
by Green Beret
Wacko wrote: //*** Elevator ***

if (level.liftpos==0)//has space

if(level.liftpos==1)//doesnt have a space
is this on purpose?
will it work both ways ,just curious im still learning :?

Posted: Thu Feb 03, 2005 8:11 pm
by wacko
no, just sloppy :wink: (wanted to be faster than someone else :P )
and it works both ways.

Posted: Thu Feb 03, 2005 8:18 pm
by Kalti
Amazing... thanks guys and much appreciated, Wacko.

Now, for the sake of understanding it all... the numbers your using 'moveUp 360' (and the other values) are those worldunits in mohr ?

And you didn't have to change the .map source for it to work ? I've had given setthreads to both triggers:

venice_lifttrigger_up (setthread liftup)

venice_lifttrigger_down (setthread liftdown)

Do I need still need these ?

Posted: Thu Feb 03, 2005 8:22 pm
by wacko
the numbers your using 'moveUp 360' (and the other values) are those worldunits in mohr ?
yes, 360 worldunit (seemed to be something like that when examining ur map)

And you didn't have to change the .map source for it to work ? I've had given setthreads to both triggers:
venice_lifttrigger_up (setthread liftup)
venice_lifttrigger_down (setthread liftdown)
Do I need still need these?
Sure. They fire the threads by this :wink:

Posted: Thu Feb 03, 2005 8:25 pm
by Kalti
Okay thanks, but still... they're differently named, how can they work both ways... ie. up and down (request & send) ?

Posted: Thu Feb 03, 2005 8:30 pm
by wacko
Kalti wrote:Okay thanks, but still... they're differently named, how can they work both ways... ie. up and down (request & send) ?
No matter which trigger is used, the elevator decides where to go by the level.liftpos. If it's 1 it goes down, else it goes up. There are two threads (lift_up and lift_down) to anim the proper switch. If u didn't do these switches, it could have been just one thread.

Posted: Thu Feb 03, 2005 8:35 pm
by wacko
to make things clearer, u could do it like

Code: Select all

lift_prep:
	level.liftpos=1 //1 is up, 0 is down
	$venice_lift time 6
	$venice_liftweight time 6	
end

liftup:
	$venice_liftswitch_down anim move
	waitthread lift_move
	$venice_liftswitch_down anim idle
end

liftdown:
	$venice_liftswitch_up anim move
	waitthread lift_move
	$venice_liftswitch_up anim idle
end

lift_move:
	$venice_lifttrigger_up nottriggerable
	$venice_lifttrigger_down nottriggerable
	if (level.liftpos==0)
	{
		$venice_lift moveUp 360
		$venice_lift move
		$venice_liftweight moveDown 360
		$venice_liftweight waitmove
		level.liftpos=3
	}
	if(level.liftpos==1)
	{	
		$venice_lift moveDown 360
		$venice_lift move
		$venice_liftweight moveUp 360
		$venice_liftweight waitmove
		level.liftpos=2
	}
	level.liftpos = level.liftpos - 2
	$venice_lifttrigger_up triggerable
	$venice_lifttrigger_down triggerable
end

Posted: Thu Feb 03, 2005 8:49 pm
by Kalti
Okay, so specifying 4 instead of just 2 values for level.liftpos is is making each trigger work both ways ?

I can see that script being clearer then the first :wink:

Btw. is there any way to handle the complete animation first before moving the actual lift ?

Posted: Thu Feb 03, 2005 10:06 pm
by wacko
k. After some weird attempts, here's how it should look like. Together with Kalti, we managed to do this

Code: Select all

//*** Elevator ***
lift_prep:
	level.liftpos=1 //1 is up, 0 is down
	$venice_lift time 6
	$venice_liftweight time 6	
end

liftup:
	$venice_liftswitch_down anim move
	wait 1
	$venice_liftswitch_down anim idle
	waitthread lift_move
end

liftdown:
	$venice_liftswitch_up anim move
	wait 1
	$venice_liftswitch_up anim idle
	waitthread lift_move

end

lift_move:
	$venice_lifttrigger_up nottriggerable
	$venice_lifttrigger_down nottriggerable
	if (level.liftpos==0)
	{
		$venice_lift moveUp 360
		$venice_lift move
		$venice_liftweight moveDown 360
		$venice_liftweight waitmove
		level.liftpos=1
	}
	else
	{	
		$venice_lift moveDown 360
		$venice_lift move
		$venice_liftweight moveUp 360
		$venice_liftweight waitmove
		level.liftpos=0
	}
	$venice_lifttrigger_up triggerable
	$venice_lifttrigger_down triggerable
end
//*** END Elevator ***
btw, the anim stages of the switch are just move and idle. How could he make it go slowly (instead of jump) back to the idle position?

Posted: Thu Feb 03, 2005 10:38 pm
by Kalti
Wacko wrote:...Together with Kalti...
lol... nevermind that, it was Wacko who did the scripting I just took a lucky guess and asked if it was possible to use the "else" statement...

Thanks for your time and patience Wacko Image