Jump to content
Sign in to follow this  
Spudgunner

How do I shoot a unit by script

Recommended Posts

I'm making a intro movie where I need to ensure a unit gets killed by a single sniper shot who is unseen to the viewer & its target. The way I'm doing it, some shots miss or the target unit is aware of the sniper and the effect is ruined. I can't set the behaviour of the target unit to careless as that only works for groups. Is there a better way to ensure 100% accuracy and instant kill? Perhaps there is a way to script it like some scenario's do when the player goes into instant kill zones.

Share this post


Link to post
Share on other sites

targetUnit setDamage 1;

That'll just outright kill them instantly, might as well use that if you're never going to see the sniper. Combine it with a sound cue (either from a trigger effect or added later if this is for a video) of a gunshot.

this setBehaviour "CARELESS";

should work for an individual unit as well.

Share this post


Link to post
Share on other sites
targetUnit setDamage 1;

That'll just outright kill them instantly, might as well use that if you're never going to see the sniper. Combine it with a sound cue (either from a trigger effect or added later if this is for a video) of a gunshot.

this setBehaviour "CARELESS";

should work for an individual unit as well.

Thanks! SetBehaviour works now :confused:. Although an Instant kill with setDamage is the best idea. How would I access the default sound for a sniper rifle to use with one of the playsound commands. Is there a list of all the sounds file names?

Share this post


Link to post
Share on other sites

Think the best would be open the weapon-PBOs and check the config file(s) for the firing sound of the specific weapon you want.

Share this post


Link to post
Share on other sites
Think the best would be open the weapon-PBOs and check the config file(s) for the firing sound of the specific weapon you want.

I found the sniper sound in Sounds/Weapons/Rifles and some wss files for sniper shots (i.e. sniper_single_03.wss). I'm not clear how to proceed to make them available to play. Do I need to create my own CfgSounds in description.ext? Or are those sounds already available to play. As far as I can tell, the CfgSounds is probably only require for sound manipulation or new sounds. Where is this config file that already has this information.

I had a stab at my own CfgSounds from a template, but I'm kind of blundering around in the dark atm.

class CfgSounds
{
sounds[]={sniper_single_03};

class rifles {
name="sniperShot";
sound[]={"sounds\Weapons\rifles\sniper_single_03.wss", db+0, 1.0};
titles[]={};
};

};

EDIT: I tried cfgSound + trigger approach but each time the file is not found. I even placed the exported sound folder & wss file in my mission folder but the same happens, although I don't think I have to place the sounds in the mission folder since they should already be available. Any ideas?

EDIT 2: It looks like playSound can't play the wss file format. I'm really stuck here :confused:

Edited by Spudgunner
made a mistake

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  

×