OFPEC Forum
Addons & Mods Depot => OFP - Addons & Mods General => Topic started by: KTottE on 17 Jul 2003, 14:54:17
-
Well now, lets say I make a weapon, and every time my guy has the weapon in his hands he gets an action. And this action executes a script.
So, how do I fix this in the config.cpp?
And it's nothing to do with animations or anything, it just fires a normal script.
-
class UserActions
{
class TEST
{
displayName="bla";
position="???";
radius=18100;
condition="player hasWeapon ""blablabla""";
statement="this exec ""myscript.sqs""";
};
}
-
Thanks a million mate, only two questions:
What's position do?
What form is radius in and what does it do?
I guess radius is how far out the action is to be available?
If so, is it in meters, centimeters, ofp-units or sunshine units :)
-
Well I never added a user action to a soldier, so I dunno which is a valid position, but maybe check out the commented config.cpp's and see which position BIS choose. The position is the name of some model section which will be the center of the action, i.e. the distance will be measured from there. This really doesn't make sense for a soldier, I know, but imagine you have a huge airplane, and you want to add an action "open door" to its cargo door. Then you'd like to make the option pop up only when the player is close to the cargo door, and not when he's, say, close to the cockpit. Thats what it is good for ;)
radius is the maximum distance from where some other player would be able to trigger this action. Make this as small as possible! I noticed the BAS delta's option to lower the googles sometimes pops up when a soldier gets really close to the player. Setting a very small radius will probably avoid this.
Oh, and ofp usually measures stuff metrically, i.e. meters, seconds, kilograms.
-
ok, figured as much. Hm, you could probably just name a selection and have the position as that, right?
Then I can name a part of the gun "tehuberl33tpos" and just have position set as that ;D
And as for radius, it'll be smaaaaall. Because I also hate the fact that you can fire other people's goggles with the BAS units.
edit
I'd be happy if it weren't for the fact that it's not working :(
class UserActions
{
class switchScope
{
displayName="Switch optics";
position="zbran";
radius=1;
condition="player hasWeapon ""KTE_M4Bi_AC""";
statement="[this] exec ""switchBiScope.sqs""";
};
};
That's what I have now, KTE_M4Bi_AC is a valid weapon, and this action is supposed to be attached to it, problem: Nothing shows up in the action menu. I've tried with replacing the double quotes with { and }, I've tried setting condition to nothing (empty) and true. Could it be my "position" that's farking things up?
Or maybe the radius is too small?
edit2
Right, found out that OFP doesn't like you adding actions to weapons, so I had to do a unit-addon as well.
Anyway, now I've got another problem.
Everything works 100%, except when I select one of the weapons, I get two actions. I've checked through the config.cpp, and there's only one entry for this, so I'm wondering what could cause it.