custom obj finale script....

Post your scripting questions / solutions here

Moderator: Moderators

Post Reply
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

custom obj finale script....

Post by G3mInI »

First I will explain what I am trying to do. When all the radio bombs are set I want to freeze all players on the server (dedicated) and then teleport them to view each explosion and then call the command teamwin allies. Here is what I have so far:

Code: Select all

explode:
	for (local.i = 1; local.i <= $player.size; local.i++)
	{
	local.suckers = $player[local.i]
	local.suckers takeall
	local.suckers nodamage
	local.suckers hide
	local.suckers physics_off
	freezeplayer
	local.suckers loopsound bombtick
	local.suckers stopwatch 5
	wait 5
	local.suckers stoploopsound bombtick
	
	local.suckers tele ( 568 304 72 )
	local.suckers.viewangles = ( 0.00 180.00 0.00 )
	wait 1
	$bmw_bike2_explosive playsound explode_tank
	$bmw_bike2_explosive remove
	$bmw_bike2 thread bike_killed
	
	wait 2
	local.suckers tele ( 216 -384 32 )
	local.suckers.viewangles = ( 0.00 270.00 0.00 )
	wait 1
	$bmw_bike1_explosive playsound explode_tank
	$bmw_bike1_explosive remove
	$bmw_bike1 thread bike_killed
	
	wait 2
	local.suckers tele ( 864 -368 16 )
	local.suckers.viewangles = ( 0.00 270.00 0.00 )
	wait 1
	$bmw_bike5_explosive playsound explode_tank
	$bmw_bike5_explosive remove
	$bmw_bike5 thread bike_killed
	
	wait 2
	local.suckers tele ( -96 720 72 )
	local.suckers.viewangles = ( 0.00 270.00 0.00 )
	wait 1
	$bmw_bike3_explosive playsound explode_tank
	$bmw_bike3_explosive remove
	$bmw_bike3 thread bike_killed
	
	wait .5
	exec global/earthquake.scr .23 4 0 0			// Shake the player's view
	exec global/earthquake.scr .23 4 0 0
	exec global/earthquake.scr .23 4 0 0
	
	wait .5
	local.suckers tele ( -736 656 0 )
	local.suckers.viewangles = ( 0.00 270.00 0.00 )
	wait 1
	$bmw_bike4_explosive playsound explode_tank
	$bmw_bike4_explosive remove
	$bmw_bike4 thread bike_killed
	
	local.suckers physics_on
	local.suckers show
	
	
	teamwin allies
	}

end

It all works well except that only the person in slot 0 is being teleported. All other players just freeze wherever they were standing. Can someone help me make this happen for all players ??

Thanks,
G3mInI
*Area51*G3mInI****Gen

http://www.area51moh.com
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Re: custom obj finale script....

Post by Rookie One.pl »

G3mInI wrote:

Code: Select all

freezeplayer
Here you go, that's why... Try

Code: Select all

local.suckers freeze
Not sure whether this will work, but sure this is the reason. :P
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

make this instead ;)

Code: Select all

for (local.i = 1; local.i <= $player.size; local.i++) 
   { 
   local.suckers = $player[local.i]
you're incrementing the local.i in the local class, not the array attatched to the player you're trying to edit, ;)

Code: Select all

for ($player[local.i] = 0; $player[local.i] <= $player[i].size; $player[local.i]++) 
   { 
   local.suckers = $player[local.i]
should work.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

Thanks. Looks like that did it incrementing player and not local i.

Peace out,
G3mInI
*Area51*G3mInI****Gen

http://www.area51moh.com
Rookie One.pl
Site Admin
Posts: 2752
Joined: Fri Jan 31, 2003 7:49 pm
Location: Nowa Wies Tworoska, Poland
Contact:

Post by Rookie One.pl »

lizardkid wrote:

Code: Select all

for ($player[local.i] = 0; $player[local.i] <= $player[i].size; $player[local.i]++) 
   { 
   local.suckers = $player[local.i]
should work.
WHAT??????? :shock:
You're assigning an integer value of zero to a player with local.i index which is most probably NIL and then you increase the integer value!!! You expect this to work??? :x

Gemini, your loop was perfectly correct... :roll:
lizardkid wrote:you're incrementing the local.i in the local class, not the array attatched to the player you're trying to edit
But that's just what you've got to do! Local.i is just the index of an element in the $player array, and this for loop is perfectly correct! You cannot increase the array! :x
Admin
Image
Image
Honour guide me.

here's my stuff - inequation.org | here's where I work - thefarm51.com
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Why bother you can do all that with a camera . There is a tutorial in the SDK here is some of it , look under script documentation

Camera Tutorial

To spawn a camera from script use the following command:

spawn Camera targetname MyCamera

To spawn a camera in your map, use a func_camera:

cuecamera cameraName [switchTime]
Switch to the specified camera. If switch time is specified and you are not already in camera view, the camera will smoothly transition from the third person camera to this camera
cueplayer [switchTime]
Switch back to third person mode. If switchtime is specified, than camera will switch over that period of time.


Other useful scripting commands for cinematics:

freezeplayer
Freezes the player wherever he is standing

releaseplayer
Release the player after he has been frozen
Image
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

I have never been successful at making a camera for a server side stock map script. That is what this is all for. I am just having problems targeting all players on a dedicated server.

The only player that gets the commands applied to is any person that is in slot 0. Everybody else just sort of stands where they last were. No errors in console either. Have no idea why the for loop I had wont pick up all players but it doesnt. It only picks up the very firtst player in slot 0.

G3mInI
*Area51*G3mInI****Gen

http://www.area51moh.com
lizardkid
Windows Zealot
Posts: 3672
Joined: Fri Mar 19, 2004 7:16 pm
Location: Helena MT

Post by lizardkid »

Rookie One wrote:
lizardkid wrote:

Code: Select all

for ($player[local.i] = 0; $player[local.i] <= $player[i].size; $player[local.i]++) 
   { 
   local.suckers = $player[local.i]
should work.
WHAT??????? :shock:
You're assigning an integer value of zero to a player with local.i index which is most probably NIL and then you increase the integer value!!! You expect this to work??? :x

Gemini, your loop was perfectly correct... :roll:

But that's just what you've got to do! Local.i is just the index of an element in the $player array, and this for loop is perfectly correct! You cannot increase the array! :x
no, you're incrementing the array individual that's used, you're using the for loop to decide which player is going to be affected by the code.

his loop was using the local class, not the $player class. you cannot reference the $player[local.i] through local.i. it's trying to take a private variable from a totally separate class.

.
You're assigning an integer value of zero to a player with local.i index which is most probably NIL and then you increase the integer value!!! You expect this to work???
the value is of no importance, i could have assigned it a value of -666 and it would have had no difference, jsut more player number to sort through.
FYI yes, there is a client 0, that's the default one to get targeted by script and rcon. arrays start at 0 unless the coder increments it at start of the array, which they didn't.
integers can and are 0 a lot of times, NIL is a #define for 0, and increasing it is a way of sorting throguh all the players i nthe server.
Gemini, your loop was perfectly correct... :roll:
i like to think that if it doesn't work it isn't correct.
Moderator

۞
Abyssus pro sapientia
Olympus pro Ignarus
۞

AND STUFF™ © 2006
Grassy
First Lieutenant
Posts: 221
Joined: Sun Aug 22, 2004 11:36 am

Post by Grassy »

I aggree with BD, much easier to do it with cameras, no need to mess with player arays.
Here is an axample of how to get a camera in a map and looking at your object of interest. And this all DOES work server side btw.

Code: Select all

  Allies_win:

  forcemusic aux2 aux2  //play allies music
  
  $player nodamage //this only works on player in slot 0
  $player hide   //this only works on player in slot 0
  freezeplayer   //this only works on player in slot 0
  drawhud 0      //clear hud with no icons
  level ignoreclock 1 //ignore the roundlimit timer
  //letterbox .5   // make the screen letter box size if you want

/**
spawn an origin I like to do this as it sets up the origin and angles for  the camera, you could do all the origins at the start of the map and just refer to their targetnames if you wanted to.
**/

  local.ori = spawn script_origin
  local.ori.origin = ( 496.65 2732.65 820.64 )
  local.ori.angles = ( 16.99 -80.68 0.00 )

  //spaw a camera at the above origin
  local.camera = spawn func_camera origin local.ori.origin angles local.ori.angles

  // the area of view the camera see's
  local.camera fov 90 1  

  //if your camera target is animated you can track it with this command
  local.camera watch $bomber
 
  // swap to the camera using the above values
  local.camera cut

  // activate the camera
  cuecamera local.camera 

  // time value to watch the movie
  wait xx  
 
  //call the teamwin command for the end of round
  teamwin allies
	
end
For multiple camera scenes just spawn your script_origins and cameras and cut to each one in turn, thats how I would do it. Much simpler and less code.
Grassy
User avatar
bdbodger
Moderator
Posts: 2596
Joined: Tue Feb 25, 2003 7:34 am
Location: canada
Contact:

Post by bdbodger »

Well I just did this in mohdm2 and it worked but I was the only player and it was not a dedicated server but I don't think that matters .

spawn Camera targetname mycamera origin ( -1502 -868 60) angles ( 0 90 0 )

wait 20

cuecamera $mycamera

wait 10

cueplayer
Image
User avatar
G3mInI
First Lieutenant
Posts: 187
Joined: Sat Jun 29, 2002 3:49 am

Post by G3mInI »

Thanks a lot for the help guys. I will use the camera way for sure now. I am moving tomorrow so will be offline for about a week or so, but when I get back I will post my results with this.

Again thanks,
G3mInI
*Area51*G3mInI****Gen

http://www.area51moh.com
Post Reply