Jump to content
Sign in to follow this  
Melmarkian

Create a bullet-object and give it a target?

Recommended Posts

Hey,

I am currently try to create an effect in a cutscene where someone gets a sniper shot and you see the shot through the bulletcam-script by Big Dawg KS (thanks for your work!).

But there is a problem:

The Sniper doesn´t hit the target with the first shot and the scene looks weird if he has to shoot 3-4 times before hitting. Are there any tricks to give an AI soldier super skills for some time? Or is there any way to create a bullet and give it a target? I can get the name of the bullet through a fired eventhandler, but I don´t know how to works with it.

Share this post


Link to post
Share on other sites

Either you can try using setSkill or setSkill array to make him a godlike shot, but it still won't get rid of mechanical inaccuracy in the weapon for example, and possible deficiencies in AI.

If that isn't enough what you could try doing is to catch the bullet with a fired eventhandler and setVectorDir and setVelocity it to a perfect path, but now it is starting to get pretty complex.

If it wasn't for the bullet cam it could easily be faked, but following the bullet it doesn't allow for the 'cheap' solutions.

Share this post


Link to post
Share on other sites

Thanks!

The setvelocity is a bit too complex for just a single scene at the moment. I will try it in the future.

For now i will just use an hidden second sniper very close to the target.

Share this post


Link to post
Share on other sites

yes unfortunately setskill really doesnt improve a snipers accuracy (well it does, but at 300m and further, they wont hit much) and if its with ace it makes things worse..

Share this post


Link to post
Share on other sites

@Melmarkian....

I just knocked this up for you.....I have been working with vectors so it wasn't too hard. Demo here.

In the demo move the heli-pad (the sniper) around... as long as the heli-pad is not too far away the target should be hit.

Call with :-

nul = [target,vsniper] execVM "vsniper.sqf";

The stuff in bold is the start and end heights for the shot. You may want to adjust this.

vsniper.sqf

/* 

A Virtual Sniper - by Twirly (March 2011)
Call with : nul = [target,vsniper] execVM "vsniper.sqf";

Where:-
target ...is your target :)
vsniper ...is some object where the bullet will originate.

*/

private ["_target","_vsniper","_dx","_dx","_dis",_ang","_z1","_z2","_z","_elev","_vel","_bullet"];

_target = _this select 0;
_vsnipr = _this select 1;

_dx = ((getpos _target) select 0) - ((getpos _vsnipr) select 0);
_dy = ((getpos _target) select 1) - ((getpos _vsnipr) select 1);

_dis = sqrt(_dx^2+_dy^2);
_ang = _dx atan2 _dy;

_z1 = (getPosASL _target select 2) + [b]1.5[/b];
_z2 = (getPosASL _vsnipr select 2) + [b]0.5[/b];

_z = _z1 - _z2;

_elev = (atan (_z/_dis) mod 360);

_vel = [(1000 * (sin _ang)),(1000 * (cos _ang)),1000 * sin (_elev)];

_bullet = "B_12Gauge_74Slug" createVehicle [((getpos _vsnipr) select 0),((getpos _vsnipr) select 1),0.5];
_bullet setVelocity _vel;

---------- Post added at 12:02 PM ---------- Previous post was at 10:22 AM ----------

EDIT:

Try using "G_40mm_HE" for the projectiles....or a chicken. They work. The chicken misses tho' for some reason...but passes at 1000m/sec! LOL!

Edited by twirly
Clarity

Share this post


Link to post
Share on other sites
The chicken misses tho' for some reason...but passes at 1000m/sec! LOL!
hillarious

Share this post


Link to post
Share on other sites

Great!

It works even with a cow, but shooting animals doesn´t inflict damage.:)

Thanks for your work twirly!

Share this post


Link to post
Share on other sites

@Melmarkian....

No worries man. I made it into a full fledged script and submitted it here.

The idea was thanks to you my friend. Stay cool.

Share this post


Link to post
Share on other sites
Great!

It works even with a cow, but shooting animals doesn´t inflict damage.:)

Couldnt you just use a "exploding cow"?

Using the distance to target at a meter or so to spawn in a bomb or something at the cows location when it reaches it target?

Would probably be extremely funny. :)

PSXOeqwbrEo

Share this post


Link to post
Share on other sites

You can attach an LGB to the cows belly easily!

Share this post


Link to post
Share on other sites

Just for the fun:

The same mission but it shoots a cow which explodes when it reaches the target.

AND you can shoot exploding cows with radio alpha. Just point at your target and trigger the radio.

http://www.mediafire.com/?doahqz5252ugad7

It takes a few seconds before the next cow is loaded. I wanted to slow the cow down a bit, but I really don´t understand how the velocity stuff works.

Edited by Melmarkian

Share this post


Link to post
Share on other sites

LOL... the cow even ricochets.

The speed/velocity is set with the numbers in bold. It's in metres per second.

_vel = [([b]1000[/b] * (sin _ang)),([b]1000[/b] * (cos _ang)),[b]1000[/b] * sin (_elev)];

Share this post


Link to post
Share on other sites
Just for the fun:

The same mission but it shoots a cow which explodes when it reaches the target.

AND you can shoot exploding cows with radio alpha. Just point at your target and trigger the radio.

http://www.mediafire.com/?doahqz5252ugad7

It takes a few seconds before the next cow is loaded. I wanted to slow the cow down a bit, but I really don´t understand how the velocity stuff works.

lol, i smell the coming of cow artillery :D :D

would be epic to see cows falling and exploding on some enemies

Share this post


Link to post
Share on other sites

This script seems to have problems with static ammo types like the Metis which has an ammo class name of M_AT13_AT

the rounds seems to always miss.

Edited by abdecken

Share this post


Link to post
Share on other sites
LOL... the cow even ricochets.

_vel = [([b]1000[/b] * (sin _ang)),([b]1000[/b] * (cos _ang)),[b]1000[/b] * sin (_elev)];

:D:D:D:D

I love ArmA

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  

×