Jump to content
Sign in to follow this  
jassida

Create gun on ground with a non standard scope

Recommended Posts

Hi.

 

HOpefully pretty straightforward.

 

How do I add a nightstalker to a MAR-10 on the ground?

 

I can add the weapon and understand the init window, I just don't know what to type.

 

Tried this and it doesn't work:

 

this addPrimaryWeaponItem "optic_Nightstalker ";

 

thanks a lot

Share this post


Link to post
Share on other sites

I'm afraid there's no script command for that.

 

A hacky approach (like for most stuff in arma) would be to spawn a dummy unit,

add the weapon and custom scope to it,

then have it drop the weapon to the ground weapon holder using

_dummy action ["DropWeapon", _weaponholder, currentWeapon _dummy];

After dropping the weapon you can delete the dummy. The dummy also doesn't have to be near the weapon holder, you could basically spawn him at [0,0,0] off the map.

Gonna test this later today.

 

Cheers

Share this post


Link to post
Share on other sites
Guest

I'm afraid there's no script command for that.

 

A hacky approach (like for most stuff in arma) would be to spawn a dummy unit,

add the weapon and custom scope to it,

then have it drop the weapon to the ground weapon holder using

_dummy action ["DropWeapon", _weaponholder, currentWeapon _dummy];
After dropping the weapon you can delete the dummy. The dummy also doesn't have to be near the weapon holder, you could basically spawn him at [0,0,0] off the map.

Gonna test this later today.

 

Cheers

There could be another less "hacked" way, if you can return the weapon holder that contains the weapon you can use weaponCargoGlobal ans retrieve weapons as objects I believe. Ans then use the regular attachement commands

Share this post


Link to post
Share on other sites

Okay thanks guys.

 

Think I'll just leave the bits on the floor and make them up at the start of each mission as this is all beyond me currently.

Share this post


Link to post
Share on other sites

There doesn't seem to be any other way, since there's no (known to me) command that can return the ID of a weapon inside a container, only class names.

 

This has to be spawned with a sleep, so the dummy has actually time to drop the weapon.

There you go:

_weapon = "srifle_dmr_02_f";
_optics = "optic_Nightstalker";
_weaponpos = getposatl player;

SpawnWeaponOnGround = [_weapon,_optics,_weaponpos] spawn {
    params ["_weapon","_optics","_weaponpos"];
    _dummygroup = creategroup civilian;
    _dummy = _dummygroup createUnit ["B_soldier_F", [0,0,0], [], 0, "FORM"];
    removeAllWeapons _dummy;
    _dummy addWeapon _weapon;
    _dummy addPrimaryWeaponItem _optics;
    _dummyweaponholder = createVehicle ["GroundWeaponHolder", _weaponpos, [], 0, "CAN_COLLIDE"];
    _dummy action ["PutWeapon", _dummyweaponholder, "srifle_dmr_02_f"];

    uiSleep 1.5;

    deleteVehicle _dummy;
    deleteGroup _dummygroup;
    true
};

Enjoy

Share this post


Link to post
Share on other sites

There doesn't seem to be any other way, since there's no (known to me) command that can return the ID of a weapon inside a container, only class names.

 

This has to be spawned with a sleep, so the dummy has actually time to drop the weapon.

There you go:

_weapon = "srifle_dmr_02_f";
_optics = "optic_Nightstalker";
_weaponpos = getposatl player;

SpawnWeaponOnGround = [_weapon,_optics,_weaponpos] spawn {
    params ["_weapon","_optics","_weaponpos"];
    _dummygroup = creategroup civilian;
    _dummy = _dummygroup createUnit ["B_soldier_F", [0,0,0], [], 0, "FORM"];
    removeAllWeapons _dummy;
    _dummy addWeapon _weapon;
    _dummy addPrimaryWeaponItem _optics;
    _dummyweaponholder = createVehicle ["GroundWeaponHolder", _weaponpos, [], 0, "CAN_COLLIDE"];
    _dummy action ["PutWeapon", _dummyweaponholder, "srifle_dmr_02_f"];

    uiSleep 1.5;

    deleteVehicle _dummy;
    deleteGroup _dummygroup;
    true
};

Enjoy

Thanks very much...where do I put this...mission?

 

Where did you learn all this stuff?

 

I'm ok with a few things but just can't seem to push on and be comfortable with editing.

Share this post


Link to post
Share on other sites

Wherever you want to use it.

 

Most common procedure would be to make a file called "SpawnWeaponOnGround.sqf" inside your missions folder,

then paste the following into it:

 params ["_weapon","_optics","_weaponpos"];
    _dummygroup = creategroup civilian;
    _dummy = _dummygroup createUnit ["B_soldier_F", [0,0,0], [], 0, "FORM"];
    removeAllWeapons _dummy;
    _dummy addWeapon _weapon;
    _dummy addPrimaryWeaponItem _optics;
    _dummyweaponholder = createVehicle ["GroundWeaponHolder", _weaponpos, [], 0, "CAN_COLLIDE"];
    _dummy action ["PutWeapon", _dummyweaponholder, "srifle_dmr_02_f"];

    uiSleep 1.5;

    deleteVehicle _dummy;
    deleteGroup _dummygroup;
    true

Then from a trigger you could simply put this line in the onAct field:

_weapon = "srifle_dmr_02_f";
_optics = "optic_Nightstalker";
_weaponpos = getposatl player;

_spawnweap = [_weapon,_optics,_weaponpos] execVM "SpawnWeaponOnGround.sqf";

Many ways to do this but this is probably the most common one.

 

Cheers

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  

×