Page 1 of 1
custom obj finale script....
Posted: Fri Jan 28, 2005 4:23 pm
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
Re: custom obj finale script....
Posted: Fri Jan 28, 2005 5:11 pm
by Rookie One.pl
Here you go, that's why... Try
Not sure whether this will work, but sure this is the reason.

Posted: Sat Jan 29, 2005 3:45 am
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.
Posted: Sat Jan 29, 2005 5:47 am
by G3mInI
Thanks. Looks like that did it incrementing player and not local i.
Peace out,
G3mInI
Posted: Sat Jan 29, 2005 7:12 am
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??????? 
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???
Gemini, your loop was perfectly correct...
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!

Posted: Sat Jan 29, 2005 10:51 am
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
Posted: Sat Jan 29, 2005 3:53 pm
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
Posted: Sat Jan 29, 2005 9:21 pm
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??????? 
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???
Gemini, your loop was perfectly correct...
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!

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...

i like to think that if it doesn't work it isn't correct.
Posted: Sun Jan 30, 2005 12:46 am
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
Posted: Sun Jan 30, 2005 12:49 am
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
Posted: Sun Jan 30, 2005 2:33 am
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