scripting question
Posted: Thu Feb 17, 2022 8:08 pm
So, I've downloaded an older anni script, and I'm trying to do a little scripting, but I'm a bit confused.
What my goal is, is to create a vehicle using the "fighter" as the base, and replace the normal rocket launchers on it with the stinger missile functionality.
Looking through the code of the stinger.cs file, I think I've located the bit of code I would need, but I'm not sure. Basically I'm trying to find the section that locks on to the target
Now the one thing I want to make sure, is that instead of locking onto a player, it will only lock on to a vehicle. To do this, I'm guessing I change this line: to this: .
If that is the case, would I simply have to change line 36: to ? Or would I need to add the above section of code to 1Fighter.cs?
What my goal is, is to create a vehicle using the "fighter" as the base, and replace the normal rocket launchers on it with the stinger missile functionality.
Looking through the code of the stinger.cs file, I think I've located the bit of code I would need, but I'm not sure. Basically I'm trying to find the section that locks on to the target
Code: Select all
function StingerImage::onFire(%player,%slot)
{
if($debug)
echo("?? EVENT fire "@Player::getMountedItem(%player,0)@ " player "@ %player @" cl# "@ Player::getclient(%player));
%AmmoCount = Player::getItemCount(%player, $WeaponAmmo[Stinger]);
if(%AmmoCount)
{
%client = GameBase::getOwnerClient(%player);
%clientName = Player::getClient(%player);
%clientId = Client::getName(%client);
%trans = GameBase::getMuzzleTransform(%player);
%vel = Item::getVelocity(%player);
if(GameBase::getLOSInfo(%player,1500))
{
%object = getObjectType($los::object);
%targeted = GameBase::getOwnerClient($los::object);
if(%object == "Player" || %object == "Flier")
{
%targetP = Client::getName(%targeted);
Client::sendMessage(%client,0,"Stinger lock acquired "@ %targetP @ "~wmine_act.wav");
Client::sendMessage(%targeted,0,"Stinger lock detected - " @ %clientId @ "~wono.wav");
Projectile::spawnProjectile("StingerMissile",%trans,%player,%vel,$los::object);
Annihilation::decItemCount(%player,$WeaponAmmo[Stinger],1);
}
else
{
Projectile::spawnProjectile("StingerRocket",%trans,%player,%vel,%player);
Annihilation::decItemCount(%player,$WeaponAmmo[Stinger],1);
}
}
else
{
Projectile::spawnProjectile("StingerRocket",%trans,%player,%vel,$los::object);
Annihilation::decItemCount(%player,$WeaponAmmo[Stinger],1);
}
}
else
Client::sendMessage(Player::getClient(%player),0,"Stinger out of ammo.~waccess_denied.wav");
}
Code: Select all
if(%object == "Player" || %object == "Flier")
Code: Select all
if(%object == "Flier")
If that is the case, would I simply have to change line 36:
Code: Select all
projectileType = ScoutMissile;
Code: Select all
projectileType = StingerAmmo