Jump to content
Sign in to follow this  
oneisdown

way to make ai shoot higher up?

Recommended Posts

Is there a way i can have the enemy ai fire his weapon at a higher elevation when he fires? I am working on a flare script and all i need is something to make him fire about 20 meters higher than normal. Something maybe connected with do fire? 

Share this post


Link to post
Share on other sites

Creating an invisible or really small object like a cyan pointer which you delete afterwards is probably the best, in conjunction with something like forceWeaponFire to fire the flare muzzle. 

Share this post


Link to post
Share on other sites

You can use a fired eventhandler to intercept the projectile and alter its z velocity forcing it higher.  Here is an example that worked for forcing a rocket to travel higher:

rocketDude addEventHandler ["Fired", {
    _null = _this spawn {
        _missile = _this select 6;
        _vel = velocity _missile;
        _dir = direction _missile;
        _speed = speed _missile;
        _z_modifier = 10;
        _missile setVelocity [_speed * sin(_dir), _speed * cos(_dir), (_vel select 2)+_z_modifier];
    };
}];

The above is untested (I modified from a more complex example that does work), but I believe it is clean.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×