Jump to content
bong oh

Saving Gear When go out Trigger Location.

Recommended Posts

My mission flow 

1. First Respawn to Custom Loadout to set editor

2. buy the weapon, gear from box.

3. When go out from base, equipment saved(just assigned item /(not ammo, medkit etc.. )

4. and when respawn, start to gear saved

 

So, my first step is making trigger

west/not present/repeat/

on Condition

_unit = _this select 0;
[_unit, [_unit, "assignedItem"]] call BIS_fnc_saveInventory;

and make

 

onPlayerRespawn.sqf

_unit = _this select 0;
[_unit, [_unit, "SavedInventory"]] call BIS_fnc_loadInventory;

 

 

yup..I was expecting that this would not work.

I have no idea how to import and store each player's assignedItem with the trigger.

Can anyone tell me about this mechanism?

 

Share this post


Link to post
Share on other sites

I think you can place the first script in the intPlayerServer.sqf  where each player will have this action.Though and maybe if player not present in trigger area then your code.The problem is you implemented a complex system in your mission and we need the repo to understand what is your intention

 

Share this post


Link to post
Share on other sites
15 minutes ago, Spriterfight said:

I think you can place the first script in the intPlayerServer.sqf  where each player will have this action.Though and maybe if player not present in trigger area then your code.The problem is you implemented a complex system in your mission and we need the repo to understand what is your intention

 

umm. I don't know how to show repo...for instance, announce sqf in mission folder?

 

init.sqf

YOU_fnc_account =
{	params [["_caller", objNull, [objNull]], ["_amount", 0, [0]]];
			
	private	_account = _caller getvariable "YOU_account";
	
	_caller setvariable ["YOU_account", _account + _amount];
if (_amount < 0) then {
			systemChat format ["%1 POINT 사용!", _amount] 
		} else {
			if (_amount > 0) then {
			systemChat format ["%1 POINT 획득!", _amount]
			};
		};
	systemChat format ["Balance $%1", _account+ _amount];
};

_unit = _this select 0; 
[_unit, [_unit, "SavedInventory"]] call BIS_fnc_saveInventory;


//all trait unlock
player setUnitTrait ["engineer",true];
player setUnitTrait ["medic",true];

initPlayerLocal.sqf


["InitializePlayer",[player,true]]call BIS_fnc_dynamicGroups;

// When killed, bring _unit,_killer to Server
{
	_x addEventHandler["Killed",
	{
		_unit = (_this select 0);
		_killer = (_this select 1);
		pKilled = [_unit, _killer];		
		publicVariableServer "pKilled";
	}];
}forEach allUnits;

initServer.sqf

//calculate Distance bonus and increase _killer's account
["Initialize"] call BIS_fnc_dynamicGroups;

"pKilled" addPublicVariableEventhandler
{
	private ["_data"];
	private _bonus =0;

	_data = (_this select 1);
	_unit = (_data select 0);
	_killer = (_data select 1);
	_cID = owner _killer;
	_distance = _unit distance _killer;
	if(side _killer == side _unit) then{
	[_killer,-100] call You_fnc_account;
	};
//	hint str _distance;
	if(_distance<100) then
	{
		_bonus=0;
	};
// each kill range over 100m bouns will increase 10
	if(_distance>=100) then{
		_bonus=(_distance/100)*10;
		_bonus=[_bonus,0] call BIS_fnc_cutDecimals;
		hint format ["+거리 보너스 : %1", _bonus];
	};
	_bonus=_bonus+100;
	[_killer,_bonus] call You_fnc_account;
//	pClient = bonus;
//	_cID publicVariableClient "pClient";
};

onPlayerRespawn.sqf

_unit = _this select 0;
[_unit, [_unit, "SavedInventory"]] call BIS_fnc_loadInventory;

onPlayerOut.sqf

_unit = _this select 0;
[_unit, [_unit, "assignedItem"]] call BIS_fnc_saveInventory;

 

umm that is all sqf in my mission folder

 

 

 

 

 

 

Share this post


Link to post
Share on other sites
32 minutes ago, bong oh said:

umm. I don't know how to show repo...for instance, announce sqf in mission folder?

 

init.sqf


YOU_fnc_account =
{	params [["_caller", objNull, [objNull]], ["_amount", 0, [0]]];
			
	private	_account = _caller getvariable "YOU_account";
	
	_caller setvariable ["YOU_account", _account + _amount];
if (_amount < 0) then {
			systemChat format ["%1 POINT 사용!", _amount] 
		} else {
			if (_amount > 0) then {
			systemChat format ["%1 POINT 획득!", _amount]
			};
		};
	systemChat format ["Balance $%1", _account+ _amount];
};

_unit = _this select 0; 
[_unit, [_unit, "SavedInventory"]] call BIS_fnc_saveInventory;


//all trait unlock
player setUnitTrait ["engineer",true];
player setUnitTrait ["medic",true];

initPlayerLocal.sqf



["InitializePlayer",[player,true]]call BIS_fnc_dynamicGroups;

// When killed, bring _unit,_killer to Server
{
	_x addEventHandler["Killed",
	{
		_unit = (_this select 0);
		_killer = (_this select 1);
		pKilled = [_unit, _killer];		
		publicVariableServer "pKilled";
	}];
}forEach allUnits;

initServer.sqf


//calculate Distance bonus and increase _killer's account
["Initialize"] call BIS_fnc_dynamicGroups;

"pKilled" addPublicVariableEventhandler
{
	private ["_data"];
	private _bonus =0;

	_data = (_this select 1);
	_unit = (_data select 0);
	_killer = (_data select 1);
	_cID = owner _killer;
	_distance = _unit distance _killer;
	if(side _killer == side _unit) then{
	[_killer,-100] call You_fnc_account;
	};
//	hint str _distance;
	if(_distance<100) then
	{
		_bonus=0;
	};
// each kill range over 100m bouns will increase 10
	if(_distance>=100) then{
		_bonus=(_distance/100)*10;
		_bonus=[_bonus,0] call BIS_fnc_cutDecimals;
		hint format ["+거리 보너스 : %1", _bonus];
	};
	_bonus=_bonus+100;
	[_killer,_bonus] call You_fnc_account;
//	pClient = bonus;
//	_cID publicVariableClient "pClient";
};

onPlayerRespawn.sqf


_unit = _this select 0;
[_unit, [_unit, "SavedInventory"]] call BIS_fnc_loadInventory;

onPlayerOut.sqf


_unit = _this select 0;
[_unit, [_unit, "assignedItem"]] call BIS_fnc_saveInventory;

 

umm that is all sqf in my mission folder

 

 

 

 

 

 

You pack the mission in a zip and upload to a drive.This will help us reproduce the error

Do you use any mod?

 

Thank you!

Share this post


Link to post
Share on other sites

@bong oh,

Here's a method of saving and retrieving the current weapon,

Spoiler

to save,


_wpn = currentWeapon _unit;
_unit setVariable ["YOU_currentWeapon", _wpn];

to load,


_wpn = _unit getVariable "YOU_currentWeapon";
_unit addWeapon _wpn;

 

 

Or the entire loadout,

Spoiler

to save,


_unitData= getUnitLoadout _unit;
_unit setVariable ["YOU_savedLoadout", _unitData];

to load,


_unitData= _unit getVariable "YOU_savedLoadout";
_unit setUnitLoadout _unitData;

 

Have fun!

  • Like 3

Share this post


Link to post
Share on other sites
13 minutes ago, Spriterfight said:

You pack the mission in a zip and upload to a  drive

 

A repro (as in, "reproduction") is a simple mission file that uses no mods (or only those explicitly necessary) and contains only as many units/objects/etc. required to reproduce the relevant error.

Share this post


Link to post
Share on other sites
9 minutes ago, Spriterfight said:

You pack the mission in a zip and upload to a  drive.Are those characters korean?it would be also good if you translate it with// so we can understand what is going there.

Do you use any mod?

 

Thank you!

Well ...It's a little embarrassing to show it to others, but I'll upload

drive :https://drive.google.com/file/d/1YeR_1qVlyXWaxYEcKqT1ECLEioMGiypH/view?usp=sharing

mod category : https://steamcommunity.com/sharedfiles/filedetails/?id=2242163538

Share this post


Link to post
Share on other sites
5 minutes ago, Harzach said:

 

A repro (as in, "reproduction") is a simple mission file that uses no mods (or only those explicitly necessary) and contains only as many units/objects/etc. required to reproduce the relevant error.

 Thank you for your explanation.! try put away all mod

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

×