Jump to content

Recommended Posts

I created a mission in the Eden Editor and I wanted to add a little script which is going to allow me to access the virtual Arsenal in anytime I want, anywhere through the scroll wheel, and another little script which is going to disable the fatigue system and thus I could have infinite stamina.

Here is the code:(the  file is saved in the mission folder[Documents])

Init.sqf

player addAction ["Aresenal", {["Open",true] spawn BIS_fnc_arsenal;}]; 
player enableFatigue False;   
player addEventHandler ["Respawn", {player enableFatigue false}];

So here is my problem, the script works just great in the editor when I test the mission. but when I try to host a server[not a dedicated server] It doesn't work.

I'm not really good at ArmA3 scripting I'll be so happy if someone could just tell me what code should I use and where do I need to put it.

I'll be happy if someone could help me, thanks...

:down:

 

 

Share this post


Link to post
Share on other sites

 

The player addEventHandler ["Respawn", {player enableFatigue false}]; is singleplayer only. Use 

player addMPEventHandler ["MPRespawn", {_player = _this select 0; _player enableFatigue false; _player addAction ["Open Arsenal", {["Open",true] spawn BIS_fnc_arsenal}];}];

instead. The addaction isn't carried over after respawn. Also replace the player with this when using the init line.

Spoiler

 

A bit more advanced:

To remove the arsenal action from the old body you can use:


this addMPEventHandler ["MPRespawn", {
    params ["_player","_corpse"];
    _player enableFatigue false;
    _player addAction ["Open Arsenal", {["Open",true] spawn BIS_fnc_arsenal}];
    removeAllActions _corpse;
}];

Make the addAction available only to the unit:


this addMPEventHandler ["MPRespawn", {
    params ["_player","_corpse"];
    _player enableFatigue false;
    [_player, ["Open Arsenal", {["Open",true] spawn BIS_fnc_arsenal}]] remoteExec ["addAction",_player];
    removeAllActions _corpse;
}];


 

I don't have the resources to test in MP atm. Worked in hosted editor server though.

Btw if someone knows the difference between enableStamina and enableFatigue please share your knowledge.

Share this post


Link to post
Share on other sites
3 hours ago, killzone_kid said:

works for me

 

4 hours ago, 7erra said:

 

The player addEventHandler ["Respawn", {player enableFatigue false}]; is singleplayer only. Use 


player addMPEventHandler ["MPRespawn", {_player = _this select 0; _player enableFatigue false; _player addAction ["Open Arsenal", {["Open",true] spawn BIS_fnc_arsenal}];}];

instead. The addaction isn't carried over after respawn. Also replace the player with this when using the init line.

  Reveal hidden contents

 

A bit more advanced:

To remove the arsenal action from the old body you can use:



this addMPEventHandler ["MPRespawn", {
    params ["_player","_corpse"];
    _player enableFatigue false;
    _player addAction ["Open Arsenal", {["Open",true] spawn BIS_fnc_arsenal}];
    removeAllActions _corpse;
}];

Make the addAction available only to the unit:



this addMPEventHandler ["MPRespawn", {
    params ["_player","_corpse"];
    _player enableFatigue false;
    [_player, ["Open Arsenal", {["Open",true] spawn BIS_fnc_arsenal}]] remoteExec ["addAction",_player];
    removeAllActions _corpse;
}];

 

 

 

 

I don't have the resources to test in MP atm. Worked in hosted editor server though.

Btw if someone knows the difference between enableStamina and enableFatigue please share your knowledge.

the disableFatigue actually works for me in multiplayer, the arsenal doesn't.

btw the difference between stamina and fatigue is big. stamina is your abillity to run ans fatigue and the stuff you carrying. if you disable fatigue its like running with nothing on you.(faster)

Share this post


Link to post
Share on other sites

Have you tried

13 hours ago, 7erra said:

Make the addAction available only to the unit:


this addMPEventHandler ["MPRespawn", {
    params ["_player","_corpse"];
    _player enableFatigue false;
    [_player, ["Open Arsenal", {["Open",true] spawn BIS_fnc_arsenal}]] remoteExec ["addAction",_player];
    removeAllActions _corpse;
}];

?

Share this post


Link to post
Share on other sites
1 hour ago, 7erra said:

Have you tried

?

yep, It doesn't work.

My commands are good and they are not showing any error compare to the other code you mention here.

the only problem I'm facing is that I can't get it to work in multiplayer, only in the editor...

btw all the scripts, I put them in a file called init.sqf in the mission folder if thats matter, should I write them in another directory?

Share this post


Link to post
Share on other sites
15 hours ago, killzone_kid said:

works for me

Where did you put the script?

and does It work for you in multiplayer?
singleplayer isn't the problem, they are working just fine...

 

 

***Edit: I rewrote my problem, hoping It will be more clear this time, I'd be happy if you will check it :)

Share this post


Link to post
Share on other sites

Ah yes the init.sqf is only runs on the server. Create a initPlayerLocal.sqf and put your commands there

Share this post


Link to post
Share on other sites

7erra, I'm sorry to have to call you out, but so far almost all infos you provided are false.

init.sqf runs on both server and client. initPlayerLocal.sqf runs on client only, initServer.sqf runs on server only.

"RESPAWN"-EVH is not singleplayer only. The difference between "RESPAWN" and "MPRESPAWN" is that MPRESPAWN can be added even if unit is not local to the caller.

enableFatigue is the legacy command for the abandoned fatigue system. enableStamina is the new way to go.

  • Like 1

Share this post


Link to post
Share on other sites

the fact is player addAction... needs a player, so initPlayerLocal.sqf is a good way also (no need to wait until player).

this addAction is never permanent and needs an EH Respawn, or onPlayerRespawn.sqf  (running also at start if no respawnOnstart = -1 in description.ext)

 

Share this post


Link to post
Share on other sites
1 hour ago, belbo said:

init.sqf runs on both server and client

Yes, but it's only executed on mission start. It's not JIP compatible and is more reilable as @pierremgi explained. But hey still learning and I will never stop ;) Thanks

Share this post


Link to post
Share on other sites
2 hours ago, 7erra said:

Yes, but it's only executed on mission start. It's not JIP compatible [...]

The init.sqf is executed on the client only if the client JIPs. It is executed after the initPlayerLocal.sqf in multiplayer environment - and you don't have to divide between isServer and hasInterface or even !isServer && !hasInterface stuff. See: https://community.bistudio.com/wiki/Initialization_Order

 

Share this post


Link to post
Share on other sites

Mission start(s)....

Very confusing! Hosted/dedicated server launching time of the mission? not only. all Local JIP "mission start"s also. And, obviously, not at the same time (in real life) because for the time command... (despite the BIKI description, I always read the same result on both hosted/JIPed watch debug console... No sure to understand).

 

Anyway, init.sqf, but also mission.sqm (with all unit fields, edited triggers...) , will also run at the JIP mission local start. The reason why you will run all the init fields at JIP. Then, you can "reset" any scripted loadout (for example) with an init field without localization caution.

 

Try on an hosted + client home net if you can. And test some codes, for JIP, in an init field like hint format ["hello %1", name player]; (E.L. command)

(Then, commands like time , serverTime in debug consoles.... pfffff!)

Good afternoon!

Share this post


Link to post
Share on other sites

Guys I appreciate all the help from you but I have to mention that I'm not really good at ArmA 3 scripting, and everything you say here, I'm having a hard time understanding what to do.

It will be awesome if someone just tell what code to put and where in the most simple way.

 

btw It is a hosted server, not a dedicated server, sorry I had to mention it before.

I just load the mission which is btw very small (just a helicopter and 8 players to choose from[playable slot] and the rest I'm doing with the MCC mode & zeus ingame)

 

thanks you I really appreciate all the help

Share this post


Link to post
Share on other sites

in initPlayerLocal.sqf:

player addAction ["Arsenal", {["Open",true] spawn BIS_fnc_arsenal}]; 
player enableStamina false;   
player addEventHandler 
[	"Respawn",
	{	player enableStamina false;
		player addAction ["Arsenal", {["Open",true] spawn BIS_fnc_arsenal}];
	}
];

 

  • Like 1

Share this post


Link to post
Share on other sites
3 hours ago, Lucullus said:

in initPlayerLocal.sqf:


player addAction ["Arsenal", {["Open",true] spawn BIS_fnc_arsenal}]; 
player enableStamina false;   
player addEventHandler 
[	"Respawn",
	{	player enableStamina false;
		player addAction ["Arsenal", {["Open",true] spawn BIS_fnc_arsenal}];
	}
];

 

stamina is working great (there isn't stamina), arsenal doesn't work as usual.

I found a method to make a virtual arsenal through the scroll wheel via the ARES mod (add full arsenal to object) and It is working great but after you respawn It doesn't work anymore.

there is a way to do that and I know that, about 2 month ago I played in a server with that option...

Share this post


Link to post
Share on other sites
On 13.5.2017 at 9:26 PM, aviv13467 said:

I created a mission in the Eden Editor and I wanted to add a little script which is going to allow me to access the virtual Arsenal in anytime I want, anywhere through the scroll wheel, and another little script which is going to disable the fatigue system and thus I could have infinite stamina.

 

What's wrong with Virtual Arsenal?

If you want to access VA from object, then...

yourNamedObject addAction ["Arsenal", {["Open",true] spawn BIS_fnc_arsenal}]; 
player enableStamina false;
player addEventHandler ["Respawn",{player enableStamina false}];

 

Share this post


Link to post
Share on other sites
20 hours ago, Lucullus said:

 

What's wrong with Virtual Arsenal?

If you want to access VA from object, then...


yourNamedObject addAction ["Arsenal", {["Open",true] spawn BIS_fnc_arsenal}]; 
player enableStamina false;
player addEventHandler ["Respawn",{player enableStamina false}];

 

I'm the object I guess lol

what I wanted to do is that I can access the VA in anytime anywhere.

anyway thanks.. at least the stamina script works...

Share this post


Link to post
Share on other sites
34 minutes ago, pierremgi said:

this addon. You don't need to use all other features. But, for evident reason, disabled on dedicated.

If there is a mode which allow it, there is got to be a script to make it possible too without mods...

I can download the mod but I prefer keeping everything simple. tbh I think I would just make one VA which is accessible through a ammo box as I did before and make everything more realistic.

Share this post


Link to post
Share on other sites

So, Lucullus sent you the good way for Arma vanilla. If you have mods interfering with action menus, it's impossible, most of the time.

Share this post


Link to post
Share on other sites
On 5/16/2017 at 9:42 PM, pierremgi said:

So, Lucullus sent you the good way for Arma vanilla. If you have mods interfering with action menus, it's impossible, most of the time.

Is there any chance that the MCC Sandbox is interfering with that? because there is a self-arsenal option.

Share this post


Link to post
Share on other sites
35 minutes ago, aviv13467 said:

Is there any chance that the MCC Sandbox is interfering with that? because there is a self-arsenal option.

Just test your mods, one after one.... and make some choices when not compatible.

Share this post


Link to post
Share on other sites
On 5/16/2017 at 10:30 AM, aviv13467 said:

If there is a mode which allow it, there is got to be a script to make it possible too without mods...

I can download the mod but I prefer keeping everything simple. tbh I think I would just make one VA which is accessible through a ammo box as I did before and make everything more realistic.

waituntil {!(IsNull (findDisplay 46))};//this line might not be necessary depending on where you insert this script
(findDisplay 46) displayAddEventHandler ["KeyDown",{
	if ((_this select 1) == 199) then {
			if (true) then {
			["Open",true] spawn BIS_fnc_arsenal;
		};
		
	};
		
}];

Here is a script that allows you to open the Virtual Arsenal from any position using the "Home" key.

 

If you'd like to change the "Home" key to a different key, alter the value "199" to any "DIK code" representing your desired key.

 

A list of all of the "DIK codes" can be found here.

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

×