Infistar and profileNamespace issues..

UrbanSkaters

Valued Member!
Anyone know why this works for all users (normal and admin):
Code:
allMyKeys = profileNamespace getVariable ["VehicleKeys",[]];
allMyKeys = allMyKeys + [_keySelected]; //_keySelected is set further up in the script!
profileNamespace setVariable ["VehicleKeys",allMyKeys];



But this doesn't work:
Code:
ZedKills = profileNamespace getVariable ["ZedKillsTotal",0];
_zedKillss = player getVariable["zombieKills", 0];
ZedKills = ZedKills + _zedKillss;
profileNamespace setVariable ["ZedKillsTotal",ZedKills];


The first block of code works for admin and normal users, it saves the variable and loads it fine.

The second block of code works for admins fine, but only loads the variable for normal players (not save it).

AllMyKeys is an array of the users keys, in case anyone is going to ask. I've tied it to the Find my vehicle script, so that only players who have keys saved in this private "keycode list" can locate their vehicles and open it without a key in their inventory. It works fine, for all users. But that zedkills total count is puzzling, as it only seem to work for admins :(
 
Last edited:
Are you trying to make zedkills persist through death? or just making a tracker to keep track of total kills? I use a lot of profilenamespace stuff with infistar and haven't had any issues.
 
Tracker. I want to keep the normal zed kill per player counter and have a second one that shows total kills over all lives. It works fine for me and other admins. The keycode system works for all players and I even have one that does changes to the humanity that works for everyone. It's just this zedkill one. I've changed the naming convention and even tried without zed in it.. lol, it's a mystery :)
 
Last edited:
The thing is. The only place where things are different for me and the other admins, is in the Infistar settings. If I remove myself from Infistar admins, the code doesn't work. Add myself back and the code works. So it's definately Infistar, I've no doubts about that.
 
I've had sever different issues with Infistar that people have had with code I've shared. I don't use Infistar, but I looked at their version and tried to make it work. I finally gave up. Everything I did that 'should' of worked didn't change things and ended up with the exact same issue you are having.

My final conclusions was choose to use this code or choose Infistar.
 
Haven't tested this but this is something that I would do

Code:
// Permanent Zedkill tracking in profilenamespace
[] spawn {

    // Not sure if necessary but don't waiting for variable to be defined.
    waituntil {!isnil {player getVariable["zombieKills",0]}};

    // checking if namespace variable exists
    _zedkill = profileNamespace getVariable "ZedKillsTotal";
    if (isnil "_zedkill") then {
        // Set to 0 if Namespace doesn't exist
        profileNamespace setVariable ["ZedKillsTotal",0];
    };


    while {true} do {
        // get current zed kills
        _zedKillss = player getVariable["zombieKills", 0];
      
        // wait till zedKillss not equal to current kills
        waituntil {_zedKillss != player getVariable["zombieKills", 0]};
      
        // current zed kills minus old zed kills (get overall increase in kills)
        _zedKillss = player getVariable["zombieKills", 0] - _zedKillss;
      
        // get value of current namespace variable
        _zedkill = profileNamespace getVariable "ZedKillsTotal";
      
        // namespace variable value + overall increase
        _zedkill = _zedkill + _zedKillss;
      
        // assign new value to profilenamespace
        profileNamespace setVariable ["ZedKillsTotal",_zedkill];
      
        //save profilenamespace
        saveProfileNamespace;
    };
};
 
Last edited:
Thanks for that , that's pretty much what I did as well (but your code feels like it know what its doing more than mine does). Thanks again for your help, haven't tried it yet as we chucked the project for now and settled for a faction based scoring system instead. As a new player you choose whether you're going to work towards your bandit or hero rank, then the server rewards you negative or positive humanity per zed / AI kill based on your choice. Haven't had issues with that namespace yet :p
 
Inkko, I have a question that you might know the answer to.

I have a profilenamespace for factions and I'd I can alter the humanity for zed kills using this, by having the localeventkill sqf in the mission pbo and running locally. However, I want to have this same profilenamespace variable available for AI kills with DZMS . So if you're a bandit faction, you get negative humanity and hero faction you get plus humanity.

Do you know how I can get that to work? I haven't figure out how to send this to the server yet. Hope that made sense btw.
 
I think I understand what you mean but not 100% sure. So you want the DZMS AI to give +/- humanity depending on their faction? This is what I came up with if that is so...

With the factions profilenamespace just add a player setvariable for the faction as well then you should be able to getvariable factions serverside in the adding of humanity for DZMS AI kills. That is how I would do it. So the profilenamespace is a perm holder and the setVariable is a temp holder for just scripting purposes where code isn't run on the specific client needing the humanity change.

Alternatively you could make a publicvariableeventhandler for the humanity part of the DZMS code. Then use publicvariableclient to send the humanity info to the player and can use profilenamespace that way.
 
By their faction, if you mean the players faction, then yes , spot on :)

So if i'm getting this right. I can set :
player setVariable ["myFaction","BANDITS"];

Then on the serverside in the AI is killed script I could use:
player getVariable "myFaction";

Is that what you're saying? I'm still learning this stuff myself, so if I've got that right then I'm finally getting this variables thing :p
 
By their faction, if you mean the players faction, then yes , spot on :)

So if i'm getting this right. I can set :
player setVariable ["myFaction","BANDITS"];

Then on the serverside in the AI is killed script I could use:
player getVariable "myFaction";

Is that what you're saying? I'm still learning this stuff myself, so if I've got that right then I'm finally getting this variables thing :p

Code:
if (DZMSMissHumanity) then {
       _faction = _player getVariable "myFaction";
       if (_faction == "BANDITS") then {
        _player setVariable ["humanity",(_humanity + DZMSCntHumanity),true];
       } else {
       _player setVariable ["humanity",(_humanity - DZMSCntHumanity),true]; //double negative = +? no idea if arma will do this tho
       };   
};
 
Yeah, I was just being lazy with my reply. Anyway, can't thank you enough for helping me get my head around this. I'm learning something new everyday thanks to people like yourself. Cheers :D
 
This isn't working. I've tried a variant of it using just the switch and keeping the default score function for both. But it doesn't effect the humanity at all (doesn't add / change it). I'm going to play with it again tonight when my server is empty. I'll let you know if I find the reason .

Code:
if (DZMSMissHumanity) then {
       _faction = _player getVariable "myFaction";
       if (_faction == "BANDITS") then {
        _player setVariable ["humanity",(_humanity + DZMSCntHumanity),true];
       } else {
       _player setVariable ["humanity",(_humanity - DZMSCntHumanity),true]; //double negative = +? no idea if arma will do this tho
       };   
};
 
Odd. It returns Scalar Nan for _humanity . But It's definitely a number ?

_humanity = _player getVariable["humanity", 0];
Odd. It returns Scalar Nan for _humanity . But It's definitely a number ?

_humanity = _player getVariable["humanity", 0];
I'm about to go to bed but I will try adding something to my DZMS when I wake up. I'll add like a if you're hero give + humanity and if bandit add - humanity and see how that goes. Pretty much the same concept as what you're doing just using the default humanity variable.
 
Odd. It returns Scalar Nan for _humanity . But It's definitely a number ?

_humanity = _player getVariable["humanity", 0];
I dont see the original complete code posted anywhere so just have to guess what looks wrong here. But you are retrieving your "humanity" variable from a local variable _player rather than the player object?
 
I'm about to go to bed but I will try adding something to my DZMS when I wake up. I'll add like a if you're hero give + humanity and if bandit add - humanity and see how that goes. Pretty much the same concept as what you're doing just using the default humanity variable.

I think something is borked . since playing around with these namespaces etc , I notice that the DZMS config file isn't being called anymore. The AI have rocket launchers , which I've disabled in the config. So I'm just going through trying to figure out what has broken. I've gone right back to a build before I started playing with profilenamespaces and it's still the same (i.e not using any custom code with the AIkill script). Can't pin down when this started either.. lol

All looks normal in the logs (you know it's going to be one of those days lol):

Code:
15:54:44 [DZMS]: DZAI Found! Using DZAI's Relations!
15:54:44 [DZMS]: Currently Running Version: 1.1FIN
15:54:44 [DZMS]: Mission and Extended Configuration Loaded!
15:54:44 [DZMS]: lingor Detected. Map Specific Settings Adjusted!
15:54:44 [DZMS]: DayZ Epoch Detected! Some Scripts Adjusted!
15:54:44 [DZMS]: Loading ExecVM Functions.
15:54:44 [DZMS]: Loading Compiled Functions.
15:54:44 [DZMS]: Loading All Other Functions.
15:54:44 [DZMS]: Mission Functions Script Loaded!
15:54:44 [DZMS]: Minor Mission Clock Starting!
15:54:44 [DZMS]: Mission Marker Loop for JIPs Starting!


Edit: and the winner is....

Code:
18:24:59 Error in expression < _player getVariable "myFactionAI";
if (_faction == "BANDIT") then {
_humanity =>
18:24:59   Error position: <_faction == "BANDIT") then {
_humanity =>
18:24:59   Error Undefined variable in expression: _faction

The variable is set, I've got a local debug running and it's getting the results. Just seems that the server isn't ?



This is in my init.sqf, it works for the zombie kill humanity and even for the badge in the GUI. The zombie kills are dealt with locally with a custom killscript .. fyi.
Code:
myFaction = profileNamespace getVariable "Faction"; //Set in my variables file with all the other variables! 
	switch true do 
        {
 	case (myFaction == "BANDIT"):{player setVariable ["myFactionAI","BANDIT"]};
	case (myFaction == "HERO"):{player setVariable ["myFactionAI","HERO"]};  
	default
	{
	player setVariable ["myFactionAI","HERO"];
        };
						 
						};
 
Last edited:
Back
Top