question for bdbodger....
Posted: Mon Aug 23, 2004 7:18 am
I am using both your strafe script and spotlight script in a server side mod. What I would really like to do is make a new spotlight script which when activated by a setthread command at a specific node in the strafe.scr, would activate the spotlight(s) and stay fixed on the plane that is flying by. I have tried unsuccesfully to modify both spotlight and the strafe scripts. I was and am very close but errors fill up console. I do get the beam to target the plane and follow it but when the plane leaves the level they keep on a shining. I tried to put a variable in to shut them off but didnt work and dont know why. To accomplish targeting the plane, in the strafe script I gave level.plane[local.i] a targetname. Then in spotlight script I tried to trace the targetname. However I get all kinds of errors stating trace is applied to null entity and index 2 out of range. Even though the lights are shining on the plane and following it. Another thing was that the spotlights were blinking on and off. So I'm guessing when the lights were off is where it was finding the null entities. I guess what I am asking is how do I properly target the plane in strafe.scr in my level.script. And then how would I make a spotlight follow that target. I thought it was going to be easy but ...quite opposite. I get real confused in spotlight.scr when you start calculating the vectors.
My latest attempt is as follows and it is ugly in console. And now the lights don't even move. I just keep trying things and now I cant even get back to having the spotlights move. They just stay fixed and stay on.
And here is where I gave the plane a targetname in strafe.scr and placed a variable to let me know when the bomb hits the target. Which is also when I want the spotlights to stop shining.
Here is where I added the variable to let me know when the bomb drops. Which does work for the other reason I needed to. It is accessible in my main level script.
Obviously probably to you this is not how to go about achieving this goal I have. But I wanted to give it a try. If you have any tips on how I can attain my goal I would appreciate it. And I fully understand if this is not something you want to dive into.
Peace,
G3mInI
My latest attempt is as follows and it is ugly in console. And now the lights don't even move. I just keep trying things and now I cant even get back to having the spotlights move. They just stay fixed and stay on.
Code: Select all
******************************************************************
while(1)
{
//local.range = 10240 //dont seem to need this but I bet its hurting me
local.groundtarget.origin = trace $bomber1.origin
local.s_vec = ( local.groundtarget.origin - local.spot.origin)
local.s_ang = vector_toangles(local.s_vec)
local.s_ang[1] = (local.s_ang[1] - 180)
local.s_ang[0] = (local.s_ang[0] * -1)
local.spot.angles = local.s_ang
local.spotlight.angles = ( 0 local.s_ang[1] 0 )
local.light.origin = local.spot.origin + local.spot.forwardvector * -8
local.light show
local.flare show
local.beam show
if(level.airstrike == 0)
{
wait 2
local.beam hide
local.light hide
local.flare hide
break
}
waitframe
if(local.spot.destroyed == 1)
break
}
end
******************************************************************And here is where I gave the plane a targetname in strafe.scr and placed a variable to let me know when the bomb hits the target. Which is also when I want the spotlights to stop shining.
Code: Select all
waitthread plane_init local.set 1 level.strafenode[local.set][1].planescale
level.plane[local.set] show
level.plane[local.set].targetname = bomber1 //added this line Here is where I added the variable to let me know when the bomb drops. Which does work for the other reason I needed to. It is accessible in my main level script.
Code: Select all
movedone:
self.movedone = 0
self waitmove
self.movedone = 1
level.airstrike = 0 // added this to help my main script out
endObviously probably to you this is not how to go about achieving this goal I have. But I wanted to give it a try. If you have any tips on how I can attain my goal I would appreciate it. And I fully understand if this is not something you want to dive into.
Peace,
G3mInI