Jump to content

Recommended Posts

14 hours ago, iV - Ghost said:

save the money

 

With a variable and add a onPlayerRespawn.sqf to load , add to your inventory

Share this post


Link to post
Share on other sites

I have tried with a respawn EventHandler in the initPlayerLocal.sqf but doesn't work.

Maybe I have to save the money in the onPlayerKilled.sqf and give the player back in the eventHandler or onPlayerRespawn.sqf?

 

That was the not working eventHandler:

player addEventHandler ["Respawn", {

    // VARIABLES
    params ["_newBody", "_oldBody"];
  
  
    // SAVE HEROS MONEY
    private _money = _oldBody getVariable "Heros_L_Money";
    _newBody setVariable ["Heros_L_Money", "_money"];
  
  
    // DELETE PLAYER CORPSE
    deleteVehicle _oldBody;
	
}];

 

  • Like 1

Share this post


Link to post
Share on other sites
6 hours ago, iV - Ghost said:

onPlayerKilled.sqf

 

To save the money when you are killed :

 

Create an onPlayerKilled.sqf and add:

missionNamespace setVariable ["GF_Save_Her_L_Money", Her_L_Money];

and create an onPlayerRespawn.sqf and add:

missionNamespace getVariable "GF_Save_Her_L_Money";
Her_L_Money = GF_Save_Her_L_Money;

 

Share this post


Link to post
Share on other sites

OK thanks so far. But will this variable not be overwritten if another player gets killed?

  • Like 1

Share this post


Link to post
Share on other sites
36 minutes ago, iV - Ghost said:

But will this variable not be overwritten

 

To be honest , i don't have any idea !

But since it is onplayerespawn it should be fine .

Can you test this?

Share this post


Link to post
Share on other sites
4 hours ago, iV - Ghost said:

I will test it.

 

 

Would you like to check also for this?

 

onPlayerKilled.sqf

missionNamespace setVariable ["GF_Save_Her_L_Money", Her_L_Money, false];

 

onPlayerRespawn.sqf

missionNamespace getVariable ["GF_Save_Her_L_Money", false];
Her_L_Money = GF_Save_Her_L_Money;

 

  • Thanks 1

Share this post


Link to post
Share on other sites

The missionNamespace is global. If you wanna use it you have to create a own variable for every player.

You can add the UID or something else.

 

But it looks like you can do this with the profileNamespace.

 

 

 

onPlayerKilled.sqf

// SAVE MONEY
profileNamespace setVariable ["TAG_yourVariable", Her_L_Money];

 

onPlayerRespawn.sqf

// LOAD MONEY
Her_L_Money = profileNamespace getVariable "TAG_yourVariable";

 

 

Thanks for helping.

  • Thanks 1

Share this post


Link to post
Share on other sites

Is there anyway to pause the mod during a mission?

 

Thanks!

Share this post


Link to post
Share on other sites

i would like to add mre´s & drinks from ace3, is it possible and how can i archieve that? Thanks a lot for your help

Share this post


Link to post
Share on other sites

@heros I would be happy to pick up development of this Mod if you would like to hand it off. We're using it in DeadandZ and I occasionally see others with requests for additions that could be considered.

Share this post


Link to post
Share on other sites

Sorry for reviving a very old thread but...

For any of those looking to create a "data base" For saving the variables of this mod you can use playernamespace save to accomplish such.

initplayerlocal.sqf: 
 

sleep 5;
[] execVM "persistency db\savedb.sqf";
private ["_player"];
_player =_this select 0;
waitUntil {!isNull _player};
//Heroes Survive persistentcy system:
//Hunger
if (isnil {profileNamespace getVariable "Her_L_Hunger"}) then {
    profileNamespace setVariable ["Her_L_Hunger", 100];
};
_profile = (profileNamespace getVariable "Her_L_Hunger");
Her_L_Hunger = _profile;
//thirst
if (isnil {profileNamespace getVariable "Her_L_Thirst"}) then {
    profileNamespace setVariable ["Her_L_Thirst", 100];
};
_profile = (profileNamespace getVariable "Her_L_Thirst");
Her_L_Thirst = _profile;
//Temperature
if (isnil {profileNamespace getVariable "Her_L_BodyTemp"}) then {
    profileNamespace setVariable ["Her_L_BodyTemp", 37];
};
_profile = (profileNamespace getVariable "Her_L_BodyTemp");
Her_L_BodyTemp = _profile;

 

(optional) create a folder named "Persistency db" and place these two scripts inside of it.

autosave.sqf:
 

//Persistent Values:
_Hunger = Her_L_Hunger;
profileNamespace setVariable ["Her_L_Hunger", _Hunger];
sleep 0.1;
_Thirst = Her_L_Thirst;
profileNamespace setVariable ["Her_L_Thirst", _Thirst];
sleep 0.1;
_TemperatureH = Her_L_BodyTemp;
profileNamespace setVariable ["Her_L_BodyTemp", _TemperatureH];

savedb.sqf:

 

[] spawn {
    waitUntil {!isNull(findDisplay 46)};

    (findDisplay 46) displayAddEventHandler ["KeyDown", {
        if(_this select 1 == 1) //ESC key
        then {

[] execVM "Persistency db\autosave.sqf";
        };
    }];
};

 

keep in mind this system saved upon ESC key being pressed, so if a player is leaving your server or session once they press "ESC" it should save these vars. Also, you should keep the sleeper because HS on scenario start / load it enforced starting parameters and can overwrite the playernamespace save.

Thanks to @Sgt Bombadil and @pierriMGi for the help.

  • Like 2
  • Thanks 2

Share this post


Link to post
Share on other sites

If any of you are using HS with the Ravage mod and want Ravage zombies to cause infection (a fever that will need to be treated with antibiotics)

You can easily do so by making any sqf file you want to be named for example we'll do infection.sqf

infection.sqf:
 

player addEventHandler ["Dammaged",
{
	params ["_unit", "_selection", "_damage", "_hitIndex", "_hitPoint", "_shooter", "_projectile"];
if ((alive player) && (_shooter isKindOf "zombie")) then {
	_time = time + 180; 
	[_time] spawn {
		private ["_TimeA"];
		_TimeA=_this select 0;
		waitUntil {(!alive player) or (time > _TimeA)};
		if (alive player) then {Her_L_Fieber = true};
	};
};
}];


Once the script is added to your infection.sqf file just place it wherever you want in your mission root folder and call it via [] execVM "infection.sqf";

This will add a fever to the player 3 minutes after being struck by a zombie see _time = time + 180; ^^

All you need is regular antibiotics to cure being infected.

Cheers! 🍻

  • Like 1
  • Thanks 1

Share this post


Link to post
Share on other sites

here is a GitHub I made dedicated to Crafting / survival / etc features for Heros' Survive mod:

https://github.com/TenuredCLOUD/Heroes-Survive-Added-actions-Crafting-etc....git

I am still working on this, but figured I'd push an early release if anyone wanted to use this stuff in the meantime.

Cheers! 🍻

  • Thanks 3

Share this post


Link to post
Share on other sites

Since all links to this mod are officially obsolete, I have made a GitHub repository for the mod:

Heros Survive Github repository

None of the files are edited, they are all official, nothing has been touched and is from the last remnants of the official download link on this thread on the first page. I'd like to see this mod continue to live since Heros worked so hard on this and many enjoyed his work. With Armaholic being shut down I'd like to preserve as many older mod authors work that we possibly can.

🍻

  • Thanks 1

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

×