PDA

View Full Version : Prevent unit from having a primary.



Fluffy
Aug 22 2010, 15:18
Hi everyone,i have created a mission where a unit can only have a RPG-7 and no primary weapons.

I don't want people to pick it up when i play it in co-op.Is there any commands that can make the unit not pick up the weapon?

Regards,
Fluffeh

Grimes [3rd ID]
Aug 22 2010, 15:25
In the init line of the unit inside the editor-



this removeWeapon "weapon_class_name_here";


That will remove the primary weapon initially. I think that's what you're asking? Or are you asking about picking up the weapon DURING the mission?

Fluffy
Aug 22 2010, 15:28
I Want people to be unable to pick it up During the mission.Like if the unit picks up a primary,the command will do a check and immediately force the unit to drop the primary or something like that :).

Grimes [3rd ID]
Aug 22 2010, 15:43
class Sensors
{
items=9;
class Item0
{
position[]={8758.8115,320.79752,5652.4702};
a=10000;
b=10000;
rectangular=1;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
expCond="animationState player == ""amovpercmstpslowwrfldnon_gear"" or animationState player == ""amovpercmstpsraswrfldnon_gear""";
expDesactiv="remove primaryWeapon player; hintSilent ""Primary Removed"";";
class Effects
{
};
};


Toss that trigger into your mission .sqm. Not sure if the 'remove primaryWeapon player;' will work, but thats the general idea.

Fluffy
Aug 23 2010, 09:34
Can't seem to get the script the work,i save it as a .sqs.I then place it in the mission folder.
Then i open up ArmAII then type this execVM "dropprimary.sqf"; and it gives me the following error "Type Script,Exepected Nothing".

CarlGustaffa
Aug 23 2010, 10:10
As he says, it's part of the mission itself. Put it in mission.sqm under sensors, and possibly reduce the coordinates (/1000) to ensure it shows up on any map, not just the big ones.

If you're afraid of messing up (and you should be in this case), take a backup of your mission.sqm first.

Fluffy
Aug 23 2010, 11:27
I placed it in the mission.sqs under sensors and it gives me an error about classitem already defined or something like that,i changed the class items but it still gives me the error.

Here is my Sensors

class Sensors
{
items=9;
class Item0
{
position[]={8758.8115,320.79752,5652.4702};
a=1000;
b=1000;
rectangular=1;
activationBy="ANY";
repeating=1;
interruptable=1;
age="UNKNOWN";
expCond="animationState player == ""amovpercmstpslowwrfldnon_gear"" or animationState player == ""amovpercmstpsraswrfldnon_gear""";
expDesactiv="remove primaryWeapon player; hintSilent ""Primary Removed"";";
class Effects
{
};
};
items=3;
class Item1
{
position[]={9172.1816,442.31223,4713.623};
activationBy="EAST";
interruptable=1;
age="UNKNOWN";
expActiv="m1 switchmove ""ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_Ohara"";m2 switchmove ""ActsPsitMstpSnonWunaDnon_sceneNikitinDisloyalty_cooper""";
class Effects
{
};
};
class Item2
{
position[]={9187.792,446.83746,4699.9375};
activationBy="EAST";
interruptable=1;
age="UNKNOWN";
class Effects
{
titleType="TEXT";
titleEffect="PLAIN DOWN";
title="You are Low on Ammo so use it wisely,fire only when nescissary we want the ammo only not all of them dead";
};
};
class Item3
{
position[]={9250.5195,425.29916,4443.6152};
a=250;
b=250;
activationBy="EAST";
activationType="EAST D";
interruptable=1;
age="UNKNOWN";
class Effects
{
};
};
};
};

Regards,
Fluffeh.

CarlGustaffa
Aug 23 2010, 11:32
Items = 9? I only count 4. Which is why I think it is generally a bad idea to post code directly from mission.sqm, and why I advised on the backup :)

Bon
Aug 23 2010, 11:44
its a bit dirty, though, but simple: in the unit's init line goes


_nul = this spawn {while{alive _this} do {_this removeWeapon (primaryWeapon _this); sleep 1}}

Since the removeWeapon command does not return any errors when there is an inappropriate weapon to remove, you can drop a check and force a unit to lose it's primary weapon on each second.

Fluffy
Aug 23 2010, 11:47
Thanks for the help Carl,i got it in game and tested it out i picked up a SCAR and it still didn't force me to drop it or anything?Do you know why?

@<hidden> i tried out your code but it gives me the Type Script,Expected nothing error.

Bon
Aug 23 2010, 11:57
sry I forgot the "_nul = ..." at the beginning. see my edit

Fluffy
Aug 23 2010, 12:07
Thank you very much bon and everyone else that helped me too :D.I finally got it working using bon's code.Thanks again everyone :).

Regards,
Fluffeh