[BT] Prone scripts!?

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
m0g
Lieutenant Colonel
Posts: 407
Joined: Fri May 23, 2003 10:11 am
Location: Sweden
Contact:

[BT] Prone scripts!?

Post by m0g »

I found these in the BT MP Demo and need a bit help. Im not a scripter but to me it looks lite there will be a Prone feature in BT!? Well, the 2 first scr files interesting!

animl/prone.scr

Code: Select all

//println "prone.scr"

waitexec anim/smoking.scr::SmokeRemoveCigarette

start:

switch (self.position)
{
	stand:
	walk:
	run:
		switch (self.weapongroup)
		{
			pistol:
			rifle:
			mp40:
			mp44:
			bar:
			thompson:
				self.blendtime = 0.5
				self setmotionanim (self.weapongroup + "_crouch_alert")
				wait self.blendtime

				self.position = crouch
				self.weaponpos = up

				self.blendtime = 0.1
				self setmotionanim (self.weapongroup + "_crouchtoprone")
				self waittill flaggedanimdone
				self.position = prone

				if (self.ground == beach)
				{
					self.blendtime = 0.5
					self setmotionanim shingle_idle
					self waittill flaggedanimdone
				}
				else
				{
					self.blendtime = 0.1
					self setupperanim (self.weapongroup + "_prone_aim")
					self setmotionanim (self.weapongroup + "_prone_legs")
					wait self.blendtime
				}
				break

			unarmed:
			bazooka:
				self setmotionanim rifle_crouch_alert
				//self waittill flaggedanimdone
				wait 0.5
				self.position = crouch
				break

			default:
				self.position = prone
				println "^~^~^ Prone stand default case for " self.weapongroup " - fix prone.scr"
				break
		}
		goto start

	crouch:
	crouchwalk:
	crouchrun:
		// Play an animation to make him get down to prone
		// (Would be cool if the run case involved diving...)
		switch (self.weapongroup)
		{
			pistol:
			rifle:
			mp40:
			mp44:
			bar:
			thompson:
				self.weaponpos = up

				self.blendtime = 0.25
				self setmotionanim (self.weapongroup + "_crouchtoprone")
				self waittill flaggedanimdone
				self.position = prone

				if (self.ground == beach)
				{
					self.blendtime = 0.50
					self setmotionanim shingle_idle
					wait self.blendtime
				}
				else
				{
					self.blendtime = 0.20
					self setupperanim (self.weapongroup + "_prone_aim")
					self setmotionanim (self.weapongroup + "_prone_legs")
					wait self.blendtime
				}
				break

			unarmed:
			bazooka:
				self setmotionanim rifle_crouch_alert
				self waittill flaggedanimdone
				break

			default:
				println "^~^~^ Crouch -> Prone/Default Case (shouldn't happen)"
				break
		}

		self.position = prone
		goto start

	prone:
	pronewalk:
		switch (self.weapongroup)
		{
			pistol:
			rifle:
			mp40:
			mp44:
			bar:
			thompson:
			grenade:
				//println "Prone/Hold Rifle or SMG"
				//println self.ground
				if (self.ground == beach)
				{
					self setmotionanim (shingle_idle)
					self waittill flaggedanimdone
				}
				else if (self.weaponpos == up)
				{
					self setupperanim (self.weapongroup + "_prone_aim")
					self setmotionanim (self.weapongroup + "_prone_legs")
					wait self.blendtime
				}
				else
				{
					// Need a good animation for this...
					self setupperanim (self.weapongroup + "_prone_aim")
					self setmotionanim (self.weapongroup + "_prone_legs")
					wait self.blendtime
				}
				self.position = prone
				break

			bazooka:
				self setmotionanim rifle_crouch_alert
				self waittill flaggedanimdone
				self.position = crouch
				break

			unarmed:
				if (self.ground == beach)
				{
					self setmotionanim (shingle_idle)
					self waittill flaggedanimdone
				}
				else
				{
					self setmotionanim (self.weapongroup + "_prone_legs")
					self waittill flaggedanimdone
				}
				break

			default:
				println ("^~^~^ Prone Idle/Default case for "+self.weapongroup+" weapon group - fix prone.scr")
				self setupperanim (self.weapongroup + "_prone_aim")
				self setmotionanim (rifle_prone_legs)
				wait self.blendtime
				self.position = prone
				break
		}
		break

	knees:
	floor:
	crawl:
		// We're incapacitated, so we can't go prone.  If we can get to crouch then we can go
		// prone from there.  Crouch handles all the niceties of making the pain look cool.
		waitexec anim/crouch.scr::transition
		goto start

	default:
		// I think I handled every case, so this is an error case
		println "^~^~^ Unknown position in prone.scr, fix prone.scr"
		break
}
anim/pronewalk.scr

Code: Select all

//------------
// Prone_walk
//------------
// Move while prone.  Have to go prone first if we're not already.

//println "prone_walk.scr"

start:

switch (self.position)
{
	prone:
	pronewalk:
		switch (self.weapongroup)
		{
			pistol:
			rifle:
			mp40:
			mp44:
			bar:
			thompson:
				self setmotionanim (self.weapongroup + "_prone_walk_forward")
				self waittill flaggedanimdone
				break
			
			unarmed:
				self setmotionanim unarmed_prone_walk
				self waittill flaggedanimdone
				break

			default:
				println "Prone walk default case for " self.weapongroup " - fix prone_walk.scr"
				break
		}
		break
	
	run:
	crouchrun:
		// If we're running, dive
		switch (self.weapongroup)
		{
			pistol:
			rifle:
			mp40:
			mp44:
			bar:
			thompson:
			unarmed:
				self setmotionanim (self.weapongroup + "_diveongrenade")
				self waittill flaggedanimdone
				break
			
			default:
				println "Run to prone walk default case for " self.weapongroup " - fix prone_walk.scr"
				break
		}
		goto start
	default:
		// Need to go prone before we can prone walk.
		waitexec anim/prone.scr
		goto start
}
global/prone.scr

Code: Select all

// tells AI to go prone
//self.position = "prone" // temporary to make it work
self exec global/fullanim.scr anim/prone.scr

global/proneto.scr

Code: Select all

// This file shouldn't exist, it's been replaced by pronewalkto, to create a more 
// standard naming convention and to allow us the option of adding pronerunto in 
// the future.

start local.node:
self exec global/pronewalkto.scr local.node

global/pronewalkto.scr

Code: Select all

// parameters:
// local.node - node to prone/crawl to

start local.node:
//self.position = "pronewalk" // temporary to make it work
self exec global/moveto.scr anim/prone_walk.scr local.node
jv_map
Site Admin
Posts: 6521
Joined: Tue Sep 03, 2002 2:53 pm
Location: The Netherlands
Contact:

Post by jv_map »

They are for AI only. They also look very similar to mohaa's AI prone scripts.
Image
User avatar
m0g
Lieutenant Colonel
Posts: 407
Joined: Fri May 23, 2003 10:11 am
Location: Sweden
Contact:

Post by m0g »

ah, damn... thought it would be something interesting :?
thanx JV
User avatar
mohaa_rox
Field Marshal
Posts: 2760
Joined: Mon Nov 11, 2002 7:05 am
Contact:

Post by mohaa_rox »

HOWEVER, i found out some prone animations in pak0. i imported these animations and vola! i was right! prone rifle shoot, prone rifle idle, blah blah. i tried replacing the original animations with these but no luck. :cry:

SOURCE CODE will help make prone possible
Live to map, not map to live.
-mohaa_rox, .map
moderator
Post Reply