I've come back a bit to add another feature to my guided Sentinel rocket for Nightfire, and I wanted to implement limited steering abilities, so the rocket can't turn so fast. This would be a similar effect to using "ParseArg(player, "maxrotvel=50");" or something like that, except that has no effect on ppl who use the mouse.
I thought this thread had what I was looking for (SM's Missile Warrior mod), but that's not exactly the effect I was after.
Any ideas on how to accomplish this? "get new alignment, do some crazy vector math, and set the alignment to a percentage of the full one" (GBK, approx wording).
Here's the code I was using, in case it sparks any ideas (it seems to have no effect on the difficulty of the steering).
btw, I'm not currently concerned with MP compatibility, as NF is primarily a SP mod -- all MP concerns are secondary.
------------------
nytfyre m0d || f33l t3h p0w3r || t3h l0st c0gz || OMF > *
[This message has been edited by Darth Slaw (edited June 14, 2004).]
I thought this thread had what I was looking for (SM's Missile Warrior mod), but that's not exactly the effect I was after.
Any ideas on how to accomplish this? "get new alignment, do some crazy vector math, and set the alignment to a percentage of the full one" (GBK, approx wording).
Here's the code I was using, in case it sparks any ideas (it seems to have no effect on the difficulty of the steering).
btw, I'm not currently concerned with MP compatibility, as NF is primarily a SP mod -- all MP concerns are secondary.
Code:
# Jedi Knight Cog Script
#
# class_rocket2.cog
#
# JK Mod - Nightfire -- Sentinel Rockets (Guided)
#
# Class cog for rockets. Leaves smoketrail behind rocket and fires
# "flame" pars behind it, too. Animates flame texture on rocket.
# Also returns player to internal view if he's guiding rocket.
#
# This cog is a modified form of the default LEC 00_smoketrail.cog
# Runs on c/s flags to reduce lag
#
# Thanks to GBK and SaberMaster for inspiration on the hard-turning. -- if I ever get it to work, that is
#
# (C) 2004 JK Modification: Nightfire
# =======================================================================
flags=0x240
symbols
template smoke=+smoketrail local
template flames=+flametrail local
template explode=+rocket_exp local
template CameraTpl=+Zoom_Cam local
material flamemat=flames.mat local
material mat0=redstatic0.mat local
thing player local
thing rocket local
thing dummy local
int id local
int i local
model rocket0=rocket2-0.3do local
model rocket1=rocket2-1.3do local
model rocket2=rocket2-2.3do local
model rocket3=rocket2-3.3do local
model rocket4=rocket2-4.3do local
model rocket5=rocket2-5.3do local
model rocket6=rocket2-6.3do local
model rocket7=rocket2-7.3do local
model rocket8=rocket2-8.3do local
flex newx local
flex newz local
flex max=0.003 local
vector rocketlook local
vector ghostlook local
message created
message pulse
message removed
message damaged
message timer
end
# =======================================================================
code
# .......................................................................
created:
rocket = GetSenderRef();
player = GetThingParent(rocket);
SetThingPulse(rocket, 0.01);
SetTimerEx(0.5, 0, 0, 0);
MaterialAnim(flamemat, 10, 0x1);
MaterialAnim(mat0, 10, 0x3);
Return;
# .......................................................................
pulse:
rocket = GetSenderRef();
//player = GetThingParent(rocket);
player = GetLocalPlayerThing();
CreateThing(smoke, rocket);
CreateThing(flames, rocket);
rocketlook = GetThingLVec(rocket);
Dummy = FireProjectile(player, CameraTpl, -1, -1, '0 0 0', '0 0 0', 0, 0, 0, 0);
ghostlook = GetThingLVec(dummy);
newx = VectorX(ghostlook) - VectorX(rocketlook);
if(newx > max) newx = max;
if(newx < -max) newx = -max;
newz = VectorZ(ghostlook) - VectorZ(rocketlook);
if(newz > max) newz = max;
if(newz < -max) newz = -max;
Dummy = FireProjectile(player, CameraTpl, -1, -1, VectorSet(newx, 0, newz), '0 0 0', 0, 0, 0, 0);
SetThingLook(rocket, GetThingLVec(dummy));
SetThingVel(rocket, VectorScale(GetThingLVec(rocket), 2));
// if(player == GetLocalPlayerThing()) //local player == rocket's pilot
if(rocket != -1)
{
dummy = FireProjectile(rocket, CameraTpl, -1, -1, '0 0.042 0', '0 0 0', 0, 0, 0, 0);
AttachThingToThingEx(dummy, rocket, 0x6);
SetCameraFocus(0, dummy);
if(GetCurrentCamera() == 1) CycleCamera();
}
Return;
# .......................................................................
removed:
rocket = GetSenderRef();
SendMessage(GetInvCog(player, 7), user1);
for(i = 0; i < 9; i = i + 1) KillTimerEx(i);
CreateThing(explode, rocket);
SetThingPulse(GetSenderRef(), 0);
SetCameraFocus(0, player);
Return;
# .......................................................................
damaged:
SendMessage(GetInvCog(player, 7), user1);
for(i = 0; i < 9; i = i + 1) KillTimerEx(i);
Return;
# .......................................................................
timer:
id = GetSenderID();
if(id == 0)
{
ParseArg(rocket, "typeflags=0x24020c");
// SetTypeFlags(rocket, 0x24020c);
SetTimerEx(7.5, 1, 0, 0);
}
else if(id == 1)
{
SetThingModel(rocket, rocket0);
SetTimerEx(1.5, 2, 0, 0);
}
else if(id == 2)
{
SetThingModel(rocket, rocket1);
SetTimerEx(1.5, 3, 0, 0);
}
else if(id == 3)
{
SetThingModel(rocket, rocket2);
SetTimerEx(1.25, 4, 0, 0);
}
else if(id == 4)
{
SetThingModel(rocket, rocket3);
SetTimerEx(1.25, 5, 0, 0);
}
else if(id == 5)
{
SetThingModel(rocket, rocket4);
SetTimerEx(1.0, 6, 0, 0);
}
else if(id == 6)
{
SetThingModel(rocket, rocket5);
SetTimerEx(0.85, 7, 0, 0);
}
else if(id == 7)
{
SetThingModel(rocket, rocket6);
SetTimerEx(0.75, 8, 0, 0);
}
else if(id == 8)
{
SetThingModel(rocket, rocket7);
SetTimerEx(0.5, 9, 0, 0);
}
else if(id == 9)
{
SetThingModel(rocket, rocket8);
}
Return;
# .......................................................................
end------------------
nytfyre m0d || f33l t3h p0w3r || t3h l0st c0gz || OMF > *
[This message has been edited by Darth Slaw (edited June 14, 2004).]
May the mass times acceleration be with you.
![http://forums.massassi.net/html/biggrin.gif [http://forums.massassi.net/html/biggrin.gif]](http://forums.massassi.net/html/biggrin.gif)
![http://forums.massassi.net/html/wink.gif [http://forums.massassi.net/html/wink.gif]](http://forums.massassi.net/html/wink.gif)
