Jump to content
Crimson Mage

[Help] Rolling Sleeves Script

Recommended Posts

Hi,  I have made a uniform reskin and I would like to have an addaction  that rolls the sleeves. Right now I have it so that it will replace the uniform to the rolled sleeves version but the items don't copy over. Here is what I have so far

 

player setVariable["_uniformstuff",UniformItems player];
sleep 2;
removeUniform player;
sleep .1;
player forceAddUniform "marpat1_CamoRS";
sleep .1;
player setVariable["_uniformityitems",toString ["_uniformstuff"]];
sleep .3;
player addItemToUniform (player getVariable["_uniformityitems",[]]);

 

I probably have butchered that script. I don't have much experience in scripting. Also how could I put that inside of my mod so that it will only appear when wearing that uniform? Any help is greatly appreciated!

Share this post


Link to post
Share on other sites

I'm not sure what you are trying to with the setVariable and toString stuff, it is not necesary if this is in a single script, and in your case doesn't work.

I've simplified your script a bit. You should look into the forEach command in the wiki, it's very useful!

 

_items = uniformItems player;
player forceAddUniform "marpat1_CamoRS";
{player addItemToUniform _x;} forEach _items;

 

I'm not a modder though, so I do not know how to make equipping the uniform automatically give you the action...

Share this post


Link to post
Share on other sites

I don't know about the modded way either but you can do this:

player addAction ["Roll up sleeves", {
	_items = uniformItems player;
	player forceAddUniform "uniform_classname_long";
	{player addItemToUniform _x;} forEach _items;
}, [], 1.5, false, true, "", "uniform _this == ""uniform_classname_short"""];

player addAction ["Roll down sleeves", {
	_items = uniformItems player;
	player forceAddUniform "uniform_classname_short";
	{player addItemToUniform _x;} forEach _items;
}, [], 1.5, false, true, "", "uniform _this == ""uniform_classname_long"""];

Where "uniform_classname_short" is your rolled up version and "_long" the opposite one. This is certainly not the smoothest way since the condition is evaluated each frame but better than nothing. Put this in the onPlayerRespawn.sqf because addAction has to be added  again after respawn. NOT TESTED.

Share this post


Link to post
Share on other sites

You don't need to use "_" in the  variable name when using setVariable command.

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

×