Flying Boat!!!


(Ex0|]uS) #1

I have made a boat in my level, made it and scripted it just like the tank prefabs, but for mine, when i go into the map, the boat is outside of the map, past the sky texture?!?!?!?!
i dont understand why it isn’t in the map, i was thinking it could be the boat, because it isn’t a gamemodel, its just brush objects in the shape of a boat. everything looks ok though in the map editor,

here is the script
VVVV

boat
{
	//----------------------------------------------------------------------
	// The following are events that this entity is capable of triggering
	//----------------------------------------------------------------------
	spawn
	{
		// Set variables to defaults
		accum 0 set 0			// State
		accum 1 set 0			// Path state
		accum 1 bitset 0		// Set obstacle 0 as present
		accum 3 set 0			// Reset stop timer
		accum 9 set 0			// Reset script lockout counter

		// Wait for entities to spawn
		wait 100
		
		// Set initial position to the first waypoint
		followspline 0 waypoint_000 10000
		accum 2 set 1

		// Set default state (ie. boat ready)
		trigger self sound_idle
		trigger self anim_tracks_stop
		setstate boat_smoke invisible
	}
	

	
	// Called when the entity is hurt
	pain
	{
	}
	
	
	
	// Called when the entity is destroyed
	death
	{
		// Update state bits
		accum 0 bitset 0						// Mark as broken, which mean it will stop at next waypoint
	}
	
	
	
	// Indirectly called when the entity is repaired
	rebirth
	{
		// Lock script
		trigger self script_lock			
	
			// Remove smoke
			setstate boat_smoke invisible
	
			// Start
			trigger boat_sound rebirth
			wait 500

			// Update state bits
			accum 0 bitreset 0					// Mark as not broken
		    accum 0 bitreset 4					// Mark as visually not broken
		
		// Unlock script
		trigger self script_unlock
	}
	
	
	
	// Called when a player is using the mounted MG
	mg42 mount
	{
	}
	
	
	
	// Called when a player is no longer using the mounted MG
	mg42 unmount
	{
	}
	

	
	
	
	//----------------------------------------------------------------------
	// Trigger functions
	//----------------------------------------------------------------------

	// This function is called when a player moves inside the escort zone
	trigger escort_trigger
	{
		// Check for obstacles
		trigger self check_obstacle_status

		// Update state bits and counters
		accum 0 bitset 2				// Mark as escort present
		accum 3 set 0					// Reset stop timer
		
		// Check if allowed to move
		accum 0 abort_if_bitset 0		// Abort if its broken
		accum 0 abort_if_bitset 1		// Abort if its already moving
		accum 0 abort_if_bitset 3		// Abort if an obstacle is in the way
		accum 9 abort_if_not_equal 0	// Abort if the script is currently locked
		
		// Lock script
		trigger self script_lock
		
			// Starting state
			trigger boat_sound start
			startanimation 55 10 15 nolerp norandom
			wait 666

			// Driving state
			trigger self anim_tracks_forward
			startanimation 5 40 15 nolerp norandom

			// Wait a bit before starting to move
			wait 500
			
		// Unlock script
		trigger self script_unlock
		
		// Start movement loop
		trigger self move
	}

	
	
	// This function is called periodicly by a func_timer entity in the map.
	// Each time it checks a counter to see if the escort has been gone too
	// long. The counter is reset by the escort trigger function.
	trigger timer
	{
		// Increase counter, and if it hasn't reached 4 then abort
		accum 3 inc 1
		accum 3 abort_if_less_than 4
		
		// Update state bits
		accum 0 bitreset 2						// Mark as not escorted, which means it will stop at next waypoint

		// Need to periodicly check if the tank has been damaged
		trigger self check_death
	}
	
	


	
	//----------------------------------------------------------------------
	// Waypoint functions that checks if it can proceed to the next waypoint
	//----------------------------------------------------------------------

	// Check if its broken, and if so change to the broken state
	trigger check_death
	{
		// Check if its broken
		accum 0 abort_if_not_bitset 0		// Abort if not broken
		accum 0 abort_if_bitset 1			// Abort if its already moving
		accum 0 abort_if_bitset	4			// Abort if its already in its broken state
		accum 9 abort_if_not_equal 0		// Abort if the script is currently locked

		// Lock script
		trigger self script_lock

			// This target_kill entity will kill the func_constructible so that an engineer can repair it
			alertentity boat_kill
		
			// Start smoking
			setstate boat_smoke default

			// Death sound
			trigger self sound_death
			
			// Stopping state
			trigger self anim_tracks_stop
		    startanimation 45 10 15 nolerp norandom
		    wait 666

			// Stationary state
		    startanimation 0 1 15 nolerp norandom

			// Update state bits
		    accum 0 bitset 4				// Mark as visually broken state

		// Unlock script
		trigger self script_unlock
	}

	
	
	// Check if it isn't escorted, and if not then stop it
	trigger check_escort
	{
		// Check if its not escorted
		accum 0 abort_if_bitset 2			// Abort if escort is present

		// Lock script
		trigger self script_lock

			// Stop sound
			trigger boat_sound stop

			// Stopping state
			trigger self anim_tracks_stop
		    startanimation 45 10 15 nolerp norandom
		    wait 666

			// Stationary state
		    startanimation 0 1 15 nolerp norandom
			
		// Unlock script
		trigger self script_unlock
	}

	//----------------------------------------------------------------------
	// Misc. functions
	//----------------------------------------------------------------------
	trigger script_lock 
		{
		accum 9 inc 1
		}
	
	trigger script_unlock 
		{
		accum 9 inc -1
		}


		
	
		
	//----------------------------------------------------------------------
	// Move functions
	//----------------------------------------------------------------------
	
	// Dispatching move function
	trigger move
	{
		// The obstacle bit is still valid because of the obstacle check done by the calling function
		accum 0 abort_if_bitset 3			// Abort if an obstacle is in the way

		// List of waypoints to go to
		accum 2 trigger_if_equal 1 tank1 move_to_001
		accum 2 trigger_if_equal 2 tank1 move_to_002
		accum 2 trigger_if_equal 3 tank1 move_to_003
		accum 2 trigger_if_equal 4 tank1 move_to_004
		accum 2 trigger_if_equal 5 tank1 move_to_005
		accum 2 trigger_if_equal 6 tank1 move_to_006
		accum 2 trigger_if_equal 7 tank1 move_to_007
	}
	
	// Move to waypoint 001
	trigger move_to_001
	{
		accum 0 bitset 1			// Mark as moving
		followspline 0 waypoint_001 80 wait length -64
		accum 0 bitreset 1			// Mark as not moving
		trigger self move_increment
	}

	// Move to waypoint 002
	trigger move_to_002
	{
		accum 0 bitset 1			// Mark as moving
		followspline 0 waypoint_002 80 wait length -64
		accum 0 bitreset 1			// Mark as not moving
		trigger self move_increment
	}

	// Move to waypoint 003
	trigger move_to_003
	{
		accum 0 bitset 1			// Mark as moving
		followspline 0 waypoint_003 80 wait length -64
		accum 0 bitreset 1			// Mark as not moving
		trigger self move_increment
	}

	// Move to waypoint 004
	trigger move_to_004
	{
		accum 0 bitset 1			// Mark as moving
		followspline 0 waypoint_004 80 wait length -64
		accum 0 bitreset 1			// Mark as not moving
		trigger self move_increment
	}

	// Move to waypoint 005
	trigger move_to_005
	{
		accum 0 bitset 1			// Mark as moving
		followspline 0 waypoint_005 80 wait length -64
		accum 0 bitreset 1			// Mark as not moving
		trigger self move_increment
	}

	// Move to waypoint 006
	trigger move_to_006
	{
		accum 0 bitset 1			// Mark as moving
		followspline 0 waypoint_006 80 wait length -64
		accum 0 bitreset 1			// Mark as not moving
		trigger self move_increment
	}

	// Move to waypoint 007
	trigger move_to_007
	{
		accum 0 bitset 1			// Mark as moving
		followspline 0 waypoint_007 80 wait length -64
		accum 0 bitreset 1			// Mark as not moving
	}
	
	
	//----------------------------------------------------------------------
	// Boat sounds
	//----------------------------------------------------------------------
	trigger sound_idle
	{
		stopsound
		playsound sound/vehicles/tank/tank_idle.wav looping volume 512
	}
	
	trigger sound_start
	{
		stopsound
		playsound sound/vehicles/tank/tank_revup.wav volume 196
	}
	
	trigger sound_move
	{
		stopsound
		playsound sound/vehicles/tank/tank_move.wav looping volume 512
	}
	
	trigger sound_stop
	{
		stopsound
		playsound sound/vehicles/tank/tank_revdown.wav volume 196
	}
	
	trigger sound_death
	{
		stopsound
		playsound sound/vehicles/tank/tank_stop.wav volume 256
	}
	
	trigger sound_rebirth
	{
		stopsound
		playsound sound/vehicles/tank/tank_start.wav volume 196
	}
}


//======================================================================
// The following are related entities which are attached because they need to follow the script_mover
//======================================================================

boat_enabler_trigger
{
	spawn
	{
		// Wait for host entity to spawn
		wait 100
		
		// Attaches itself to a tag on the script_mover
		attachtotag boat tag_turret
	}
}

boat_smoke
{
	spawn
	{
		// Wait for host entity to spawn
		wait 100
		
		// Attaches itself to a tag on the script_mover
		attachtotag boat tag_turret
		
		// Turn off smoking
		alertentity boat_smoke
	}
}



boat_toi
{
	spawn
	{
		// Wait for host entity to spawn
		wait 100
		
		// Attaches itself to a tag on the script_mover
		attachtotag boat tag_turret
	}
}





//======================================================================
// The following are the remaining entities
//======================================================================

boat_construct
{
	spawn
	{
		// Needed for the icon to reappear correctly on the command map
		constructible_class 2
	}
	
	// Called when the repairs are starting
	buildstart final
	{
	}

	// Called when the repairs have failed
	decayed final
	{
	}
	
	// Called when the repairs have failed
	failed
	{
	}
		
	// Called when the repairs are done
	built final
	{
		// Resurrect the entity. This fills up its health and trigger the ::rebirth function
		alertentity tank1
	}
}

boat_disabler
{
	spawn
	{
	}

	trigger run
	{
		// Call the function which controls the escort timeout
		trigger tank1 timer
	}
}

boat_enabler
{
	spawn
	{
	}

	trigger run
	{
		// Call the function which handles the escort
		trigger tank1 escort_trigger
	}
}

boat_kill
{
	spawn
	{
	}
}

boat_timer
{
	spawn
	{
	}
}






//======================================================================
// This block contains sound redirectors. Since commands are executed in order
// the only way to have multiple waits at the same time is to play them through another scriptblock
//======================================================================

boat_sound
{
	spawn
	{
	}
	
	trigger start
	{
		trigger boat sound_start
		wait 3400
		trigger boat sound_move
	}
	
	trigger stop
	{
		trigger boat sound_stop
		wait 1400
		trigger boat sound_idle
	}
	
	trigger rebirth
	{
		trigger boat sound_rebirth
		wait 1400
		trigger boat sound_idle
	}

	trigger turret_fire
	{
		trigger boat_turret sound_fire
	}

	trigger turret_turn_start
	{
		trigger boat_turret sound_turn_start
	}

	trigger turret_turn_stop
	{
		trigger boat_turret sound_turn_stop
	}
}

yes i havent changed the tank sounds yet, so it still sounds like a tank

need help
thanks
~l3


(zl1corvette) #2

Do you have an origin brush for your boat script_mover?


(Ex0|]uS) #3

yes, i have set an orgin brush on it, but because it is not a model, its just a bunch of brushes at script mover, it come up with an error … script mover much be a “model”…

how would i fix that so i can still use the boat i made to move


(Shaderman) #4

AFAIK you can convert your brushes to an ase model (search this forum for a “howto”) and use it for your mover then. But I’m not sure if the model has to be a md3.


(thegnat) #5

(source: http://www.splashdamage.com/index.php?name=pnPHPbb2&file=viewtopic&t=5470)

But AFAIK you can use brushwork without any hazle for script movers. Just select the whole brushwork and a 8x8 (or something similar) origin brush at the origin of the model and make it a script_mover entity.
That should actually work.


(Oxygen - o2) #6

yeah

putting models in actually confuses things :S


(Ex0|]uS) #7

ok, well i dont get how to do that model thing, but u said i could do it with just a lot of script_mover brushes, and a orgin brush.

i added a orgin brush and had all of the brushes (including the orgin brush) be script_mover, but when i try to run it on a server, it still comes up with the error
script_mover needs to be a “model” … something like that
if someone has a prfab of a script_mover with brushes, not a model i would really like to get that

need some help,
thanks
~l3


(thegnat) #8

Hmm… mysterious.

I would do it like this:

  1. Create the “model” out of brushes
  2. Add a small brush with the common/origin texture
  3. Select the whole bunch of brushes including the origin
  4. Make them a script_mover
  5. Add key/values like targetname and scriptname (I think thats an essential on script_movers)
  6. Write the script

Thats usually works. :eek3:


(Ex0|]uS) #9

ok, well i selected a brush from my boat, copied it and turned it into a orgin brush, this way it has all the key/values that it needs, but the error still come up that i need a “model”

???


(thegnat) #10

From what you have said, it seems that you don’t know how to put a script_mover together.
Found a link on another thread that really covers all steps to get a script_mover working.
It’s for RtCW, but its the same system.

http://www.nibsworld.com/rtcw/tutorial_basic_script_mover.shtml

I also suggest to ungroup your entity, or if you have saved it before you started messing around with script_movers, delete the not working one and do it again step by step. The origin brush doesn’t need to be 8x8, but I found that it will help you finding the actual origin point better. Place it in the middle (top view) of your model and adjust its placement (Z axis) in side view. Keep in mind, that boats have an other rolling-point than ground vehicles.


(Ex0|]uS) #11

ok, i got the script_mover figured out, and that tutorrial u have a link to is absolutly no help at all, it doesn’t even relate to ET, maybe i am way off, it just seemed like it is a lot different then ET script_movers

i dont know whats up need help

~l3


(zl1corvette) #12

ok, select all the brushes of your boat, including the origin brush, you should have them all selected at the same time, right click on the grid and click script_mover, you now have a functional script_mover
if that still doesn’t work, than I don’t know what’s wrong


(LaggingTom) #13

Go through the tutorial, it’s for RTCW, but ET is based on the RTCW engine, and works pretty well much the same. Just go through it.


(Ex0|]uS) #14

man, i have been doing that but it doesn’t seem to be working, i will keep messing with it
thanks
~l3


(Ex0|]uS) #15

sry about all the plank posts, my comp was goin crazy

ok, so i remade the whole thing and it is now in my map, i dont know what i did wrong.
but i am having another problem…
it looks all fine in the .map but in the game the boat is facing the wrong way, i tryed using the angle keys in “N” menu and that didn’t work.
also, the boat is in one place, and it can be repaired and everything, but the brushes of the boat are in a different area, so i repair and invisible boat, and the brush boat on the other side of my map begins to move
like im here and i can repair the boat here

:smiley: <----

/
but the brushes of the boat apear over here and the boat moves over here
|-------> > > > :moo:
sry, i made the little drawing so it would make a bit more sence ( :smiley: = me) ( :moo: =boat)
thanks ~l3


(thegnat) #16

Waaah! SPAM! :moo:
The angle key works only on models and entities, that have a model like the MG42.

I assume its a problem with your origin brush, that the boat appears in another place than the trigger is.


(Ex0|]uS) #17

thegnut, i just sent u back a reply, i will send u my boat tonight, i aint home from school yet


(thegnat) #18

Yes, got it now. Think the SD server is going bzrk right now :weird:

Fatal error: Maximum execution time of 60 seconds exceeded in...

(Ex0|]uS) #19

ok, i dont know what is wrong with it, could someone check out my prefab and tell me what i am doing wrong,
i can send it to you
thanks
~l3