A nice easy question .

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
Jack Ruby
General
Posts: 1443
Joined: Fri Feb 07, 2003 12:20 am
Location: london

A nice easy question .

Post by Jack Ruby »

Ok, I am assuming this should be a relatively easy thing to do.

I have a couple of animations that play when either teams wins the game.

As this animation plays I would like to see and hear some big explosions ( mission completed destroyed all the buildings kinda thing). I am not gonna make destroyed versions of the buildings, just the fireballs will suffice as they will only be on screen a second or two.

What kind of entity do I need to insert in the map to do this and what script and where would I need to put the script to set the bombs off.

This is the script thats running my animations:

Code: Select all

//----------------------------------------------------------
//	Allies are enemyspawners with #set 20 with a leader #set 25
//	Axis are enemyspawners with #set 10 with a leader #set 15
//	all spawners are targeting info_pathnodes
//	2 cameras placed $targetname alliewincamera_1 & alliewincamera_2
//----------------------------------------------------------
win_game_allie:
	
	//hide and freeze the players
	$player nodamage
	$player hide
	freezeplayer
	
	//spawn the allies	
	waitthread global/dm_ai.scr::spawnset 20 set20
	waitthread global/dm_ai.scr::spawnset 25 cappy

	//spawn the axis	
	waitthread global/dm_ai.scr::spawnset 10 set10
	waitthread global/dm_ai.scr::spawnset 15 set15

	$set10 waitthread FacingFix
	$set15 waitthread FacingFix

	for( local.i = 1; local.i <= $set10.size; local.i++ )
	{
		$set10[local.i] thread Do_Loser_End 
	}

	$set15 thread Do_Loser_End

	//Turn on the winning music	
	forcemusic aux2 aux2

	//Turn off the hud for the movie
	drawhud 0

	$alliewincamera_1 watch $alliewincamera_2
	$alliewincamera_1 cut
	cuecamera $alliewincamera_1

	wait 3

	for( local.i = 1; local.i <= $set20.size; local.i++ )
	{	
		local.rand = randomfloat .5
		local.rand += .5
		
		if( local.i <= $set10.size )
		{
			$set20[local.i] thread Do_Winner_End local.rand $set10[local.i]
		}
		else
		{
			$set20[local.i] thread Do_Winner_End local.rand NULL
		}
	}

	$cappy thread Do_Winner_Allied_Cappy_End 5 $set15
	
end

//----------------------------------------------------------
//	Allies are enemyspawners with #set 30 with a leader #set 35
//	Axis are enemyspawners with #set 40 with a leader #set 45
//	all spawners are targeting info_pathnodes
//	2 cameras placed $targetname axiswincamera_1 & axiswincamera_2
//----------------------------------------------------------
win_game_axis:

	//hide and freeze the players
	$player nodamage
	$player hide
	freezeplayer

	//spawn the axis	
	waitthread global/dm_ai.scr::spawnset 40 set40
	waitthread global/dm_ai.scr::spawnset 45 cappy

	//spawn the allies	
	waitthread global/dm_ai.scr::spawnset 30 set30
	waitthread global/dm_ai.scr::spawnset 35 set35

	drawhud 0
	
	//Start the music
	forcemusic aux4 aux4
	
	$axiswincamera_1 speed .3
	$axiswincamera_1 fov 70
	$axiswincamera_1 follow $axiswincamera_spline $axiswincamera_target	
	$axiswincamera_1 cut 
	cuecamera $axiswincamera_1	

	wait 2.0

	//Run the winner threads
	for( local.i = 1; local.i <= $set40.size; local.i++ )
	{	
		local.rand = randomfloat 3.0
		local.rand += 2.5
		
		if( local.i <= $set30.size )
		{
			$set40[local.i] thread Do_Winner_End local.rand $set30[local.i]
		}
		else
		{
			$set40[local.i] thread Do_Winner_End local.rand NULL
		}
	}

	//run the winners captain thread
	$cappy thread Do_Winner_Axis_Cappy_End 5 $set35

	wait 1

	//run the losers threads
	for( local.i = 1; local.i <= $set30.size; local.i++ )
	{
		$set30[local.i] thread Do_Allie_Loser_End 
	}

	$set35 thread Do_Allie_Loser_End	


end


//----------------------------------------------------------
//Do the winner anims and stuff
//----------------------------------------------------------
Do_Winner_End local.wait local.target:
	
	self nodamage
	self runto self.target

	wait local.wait

	self fire
	
	if( local.target != NULL )
	{
		local.target takedamage
		local.target damage NULL 1000 NULL (0 0 0) (0 0 0) (0 0 0) 0 9 0 0
	}

end

//----------------------------------------------------------
//Do the winners captain end sequence
//----------------------------------------------------------
Do_Winner_Allied_Cappy_End local.wait local.target:
	
	self nodamage
	self runto self.target

	local.rand = randomfloat 1.5
	local.rand += .5

	self fire

	level.axisFire = 0
	
	if( local.target != NULL )
	{
		local.target takedamage
		local.target damage NULL 1000 NULL (0 0 0) (0 0 0) (0 0 0) 0 9 0 0
	}

	wait 3.5
	
	$alliewincamera_2 watch $cappy
	$alliewincamera_2 fov 40
	$alliewincamera_2 cut
	cuecamera $alliewincamera_2

	wait 2
	
	//dprintln "Playing Cappy end anim"
	self anim 00A001_victory	

	wait 2
	
	//Allies have won
	teamwin allies

	//fade out the music
	forcemusic aux3 aux3

	wait 5

end


//----------------------------------------------------------
//Do the winners captain end sequence
//----------------------------------------------------------
Do_Winner_Axis_Cappy_End local.wait local.target:
	
	self nodamage
	self runto self.target

	wait local.wait

	self fire
	
	if( local.target != NULL )
	{
		local.target takedamage
		local.target damage NULL 1000 NULL (0 0 0) (0 0 0) (0 0 0) 0 9 0 0
	}
	
	wait 5
	
	self anim 00A001_victory	
	
	//Axis have won
	teamwin axis

	//fade out the music
	forcemusic aux5 aux5

	wait 5

end


//----------------------------------------------------------
//Axis end, they fire and die
//----------------------------------------------------------
Do_Loser_End:

	self nodamage
	self aimat $airstrike_origin
	
	//self runto self.target
	while ( level.axisFire == 1 )
	{
		local.delay = randomfloat 1.5
		local.delay += .5

		wait local.delay
		self fire
	}

end

//----------------------------------------------------------
//Allies run away
//----------------------------------------------------------
Do_Allie_Loser_End:

	self nodamage
	self runto self.target

end
Philip II of Macedon sent a message to Sparta:
"If I win this war, you will be slaves forever."
The Spartan ephors sent back a one word reply: "If".
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

thread

Post by tltrude »

The only thread that looks like it might be for both teams is "Do_Winner_End". So, in that one you'll need lines like this.

$my_exp1 anim start
wait .5
$my_exp2 anim start
wait .5
$my_exp3 anim start

etc...

You'll have to experiment with the different animated fx explosions to see which ones you like the best. Give them targetnames. Some explosions have to be turned off in prespawn with "$my_exp1 anim stop", but only if you see them going off when the map first loads.

Also, some explosions have their own sound and some don't--the animate_fx_explosion-mine does for sure. You can also adjust the scale of the entity.
Tom Trude,

Image
User avatar
Jack Ruby
General
Posts: 1443
Joined: Fri Feb 07, 2003 12:20 am
Location: london

Post by Jack Ruby »

Fantastic, it worked first time.

Yet another favor I owe you Tom,

Cheers :)
Philip II of Macedon sent a message to Sparta:
"If I win this war, you will be slaves forever."
The Spartan ephors sent back a one word reply: "If".
User avatar
Jack Ruby
General
Posts: 1443
Joined: Fri Feb 07, 2003 12:20 am
Location: london

Post by Jack Ruby »

During the axis win sequence, I have 4 axis and 3 allies, I also want to have some of the dead bodies under the tarps.

I have inserted them and given them a kv of
#set 30
$targetname enemyspawner

This is the same as the ai that spawn when the sequence starts.

The dead bodies are on show when the level loads, how can I make them only spawn when the animation plays ?
Philip II of Macedon sent a message to Sparta:
"If I win this war, you will be slaves forever."
The Spartan ephors sent back a one word reply: "If".
User avatar
Axion
Major General
Posts: 683
Joined: Mon Sep 29, 2003 5:14 am
Location: Northern California
Contact:

Post by Axion »

If you spawn the dead bodies from a script_origin, you can make them appear and disapper with $ enemyspawner hide and $enemyspawner show, I think.
"The work of a thousand years is nothing but rubble."
- Dr. Carl Goerdeler (1943)
Visit my mapping site: http://www.freewebs.com/axion9
Image
User avatar
Jack Ruby
General
Posts: 1443
Joined: Fri Feb 07, 2003 12:20 am
Location: london

Post by Jack Ruby »

Sorted :)

Needed to use a script_model rather than a static one with a targetname.

Now does anyone know the animation to get AI to raise their rifles to their shoulders ?

Right now they stand there and shoot but they are not aiming their rifles.

After they have shot it does this anim self anim 00A001_victory so I guess I just need to insert a new one in the line above this in my script.

Anyone know how to make them aim or at least raise the rifles ?

Also the allied guys have guns in their hands still, any way I can remove the guns ?
Philip II of Macedon sent a message to Sparta:
"If I win this war, you will be slaves forever."
The Spartan ephors sent back a one word reply: "If".
User avatar
tltrude
Chuck Norris
Posts: 4774
Joined: Sun Jul 07, 2002 4:03 am
Location: Oklahoma, USA
Contact:

global

Post by tltrude »

All of the AI animation scripts are in pak0.pk3/global. So, look for one that says "aim".
Tom Trude,

Image
Post Reply