SPi writes...Quote:
OK. thanx for that. I know how to connect the vehiclenodes and vehnodes rotate (these I use for the helicopter) and i gave the targetnames the tut showed. But the tut was for a ground vehicle so there are some differences.
I had already gave the vehicletype and based on that the error showed up i guess. Cos when that Key/value did not exist there was an error with a null missing or somethink.(Just saying).
*Did you follow the basic tutorial on how to spawn vehicles?*
Is there a tut on how to spawn vehicles?I spawn them same way as actors.If wrong tell me.
the keys values of the hind (script/vehicle) are on the uploaded image.
I have set the hind speed 30-40
and set lookahead 1
Thats all for now. Let me know If somethink is wrong
Spawning vehicle is not the same as spawning AI. Vehicle has more aspects or KV to insert and the trigger is a little different. I never set speed on the hind or lookahead. It's always a vehicle node KV and mainly works for ground vehicles. If you say it works, then it works.
As for the shooting, that script 3st0nian give is short and concise, though I don't use it. I used part of it especially the last part, fire missile to specify the number of shots but there's an error when the vehicle dies or deleted b/c the vehicle no longer exist and you'll get constant errors.
So I stick to the script that I used so the whole shooting stops when the helicopter dies. And I just script one of the script_origin and use vehicledetachfrompath(); so whenever the helicopter gets to that path or node, it stops and you can let it shoot. Or you can use script_stopnode/1
Here's an alternative to shooting, though more complex but it gives a bit more flexibility. The script that was posted seemed to target one origin or struct but here you can have an array of targets. Though I am pretty sure you can target multiple targets with the script already posted. And you can have more functions for the one I used.
Example:
chopper thread abrams_targets_stuff(); // - done mind the name
Code:
heli_fight() //not needed for helicopters but for ground vehicles - good to have reference
{
level.enhelik = self;
self.ignoreme = true; //no need
self.IgnoreRandomBulletDamage = true; //no need
self waittill( "goal" );
self.a.rockets = 5000;
if ( isalive( level.enhelik ) )
{
self setentitytarget( level.enhelik );
attractor = Missile_CreateAttractorOrigin( level.enhelik.origin + ( 0, 0, 0 ), 5000, 500 );
//add_wait( ::_wait, 30 );
//do_wait_any();
if ( isalive( level.enhelik ) )
radiusdamage( level.enhelik.origin, 250, 5000, 2500 );
Missile_DeleteAttractor( attractor );
}
}
abrams_targets_stuff() //main one - dont mind the name
{
level.enhelik endon( "death" ); //stops when dead
level.timer = gettime();
wait( 0.1 );
targets = getentarray( "tathere", "targetname" ); //targets
level.enhelik thread abrams_aims_at_targets();
wait( 1.2 );
for ( ;; )
{
shots = randomintrange( 4, 7 );
for ( i = 0; i < shots; i++ )
{
self SetVehWeapon( "hind_FFAR" ); //set weapons
//self SetVehWeapon( "cobra_Sidewinder");
self fireWeapon();
wait( 2.1 );
}
wait( randomfloatrange( 2, 4 ) );
}
}
abrams_aims_at_targets()
{
level.enhelik endon( "death" ); //same
targets = getentarray( "tathere", "targetname" );
for ( ;; )
{
for ( i = 0; i < targets.size; i++ )
{
self setturrettargetent( targets[ i ] );
self waittill( "turret_on_target" );
wait( randomfloat( 6, 10 ) );
}
}
}
The code I used is the exact same as the source files released for the m1a1 tank shoot. Mostly, but for helicopter, it's best to specify the weapon type. Any weapon can be used. I tried cannon, turret, missiles, sidewinder, FFAR, etc. And more flexibility like mentioned.
Hope this helps.