runnaway train


(mrfin) #1

hello mapping types

… spot of trouble with one of the script movers in my map saga that one of you clever mapping people might be able to help me with. Affraid I’m pretty much lost on this 1

Basically it is all ok, can be fixed and destroyed, appears on the map, follows the splines etc. Trouble is that when the player gets away from the mover it carries on going!!
Will only stop if it gets damaged.

Here are the relevant parts of the script:

//STUCKCHECK////////////////////////////////////
	trigger stuck_check
{
	accum 1 bitreset 3
	trigger train stuck_check_scriptlockout
	trigger train stuck_check_finished
}

trigger stuck_check_finished
{
	accum 3 abort_if_not_equal 106

	accum 1 bitset 3
}

trigger stuck_check_scriptlockout
{
	accum 1 abort_if_not_bitset 4

	accum 1 bitset 3
}

//STOPCHECK///////////////////////////////////////////////

trigger stopcheck_setup
{
	accum 1 bitset 6				// stop - no pushing
	accum 1 abort_if_bitset 8		// no one in the trigger, abort

	trigger train stuck_check		// call the stop check function
	accum 1 abort_if_bitset 3		// we're stuck so break out

	accum 1 bitreset 6				// we're free to keepgoing
}

trigger stopcheck
{
	trigger train stopcheck_setup
	accum 1 abort_if_not_bitset 6

	trigger train script_lockout

	// Any just stopped moving stuff goes here
	
	trigger train_engine stop
	//trigger truck 		wheels_stop 
	
	// <<<<< stop animation goes here

	trigger train script_lockout_stop
	resetscript 
}

// ========================================
// ========================================




// ========================================
// script lockouts

trigger script_lockout
{
	accum 1 bitset 4
}

trigger script_lockout_stop
{
	accum 1 bitreset 4
}

// ========================================
// ========================================


// ========================================
// enable/disable

trigger train_enable
{
	trigger train stuck_check
	accum 1 abort_if_bitset 3 	// stuck check

	accum 4 set 0				// reset stop counter
	accum 1 bitreset 8			// reset stop check

	accum 1 abort_if_bitset 2 	// already following spline
	accum 1 abort_if_bitset 4 	// script lockout

	accum 1 abort_if_bitset 7 	// death check

	// Any just started moving stuff goes here
	trigger train_engine start
	
	// <<<<< start animation goes here
	trigger train move
}

trigger train_disable
{
	accum 4 inc 1				// up the stop counter
	accum 4 abort_if_less_than 2

	accum 1 bitset 8
	
	trigger train deathcheck
	
}

This script is purely a conversion from the truck mover that works fine in my map

Any ideas very welcome and much appreciated


(TFate) #2

While in game testing your map try using:

/g_scriptdebug 1

Then it will show in the console if, when a player leaves the trigger area, trigger train_disable is called.

Also, make sure you’re not using the same accums that you used with your truck.


(mrfin) #3

Also, make sure you’re not using the same accums that you used with your truck.

Thanks TFate…

I’ll look at these. Thing is I’m not at all ‘up’ on accums…I will have to learn about these…my understanding of them is dodgy to say the least

Thing is…yes they are the same set of accums as used in the truck…I assumed that each seperate script function could have it’s own set

I don’t know how to set accums!!??

Will take a look as this sounds likely to be the cause of my present headache

Any pointers to a dimwits how to for accums?

thanks again


(Chruker) #4

What is in this function?
trigger train deathcheck

Does the train_disable function actually gets called? Check it like Tfate said.

Thing is…yes they are the same set of accums as used in the truck…I assumed that each seperate script function could have it’s own set

Close. Each scriptblock has its own set.

I don’t know how to set accums!!??

Just like its already done in the script:


accum 4 set 0 // reset stop counter

Any pointers to a dimwits how to for accums?

The closes thing is this one from Ifurita: http://www.planetwolfenstein.com/4newbies/Map_Scripting_4_Newbies.pdf

But also the LDR has a tiny amount about this: http://www.planetquake.com/simland/ldr1_1/glossary.htm#routine


(mrfin) #5

thanks Chruker

I was just about to start working on my script when I checked my emails and found your reply :cool:

Will get to it
thanks again