Jump to content
  • 0

How to add another value.


Namindu

Question

Ok, so I been waiting to add another trader, but one that does not use Humanity, uses a VIP system. Briskly if a player played a certain amount of time, he can get in as a VIP. And it basically has four level, (Frist being 0).

 

Now, I made another column under 'player_data' in the data base called 'PlayerVIP' and set everyone to 0 by default. Then I edit a section of code to look like this:

        if (s_player_parts_crtl < 0) then {
 
 
 
            // get humanity
 
            _humanity = player getVariable ["humanity",0];
 
            _traderMenu = call compile format["menu_%1;",_traderType];
 
 
 
            //get VIP Level
 
            _viplevel = player getVariable ["PlayerVIP","0"];
 
            
 
            // diag_log ("TRADER = " + str(_traderMenu));
 
            
 
            _low_high = "low";
 
            _humanity_logic = false;
 
            if((_traderMenu select 2) == "friendly") then {
 
                _humanity_logic = (_humanity < -5000);
 
            };
 
            if((_traderMenu select 2) == "hostile") then {
 
                _low_high = "high";
 
                _humanity_logic = (_humanity > -5000);
 
            };
 
            if((_traderMenu select 2) == "hero") then {
 
                _humanity_logic = (_humanity < 5000);
 
            };
 
            if((_TraderMenu select 2) == "VIP0") then {
 
                _humanity_logic = (_viplevel = 0);
 
            };
 
            if((_TraderMenu select 2) == "VIP1") then {
 
                _humanity_logic = (_viplevel = 1);
 
            };
 
            if((_TraderMenu select 2) == "VIP2") then {
 
                _humanity_logic = (_viplevel = 2);
 
            };
 
            if((_TraderMenu select 2) == "VIP3") then {
 
                _humanity_logic = (_viplevel = 3);
 
            };
 
            if(_humanity_logic) then {
 
                _cancel = player addAction [format[localize "STR_EPOCH_ACTIONS_HUMANITY",_low_high], "\z\addons\dayz_code\actions\trade_cancel.sqf",["na"], 0, true, false, "",""];
 
                s_player_parts set [count s_player_parts,_cancel];
 
            } else {

From what I can tell, it’s not able to find/get the value for _VIPlevel from the database. How do I get it to find it?

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0

You are using two variables of trademenu, _traderMenu & _TraderMenu.

Also you've got getVariable ["PlayerVIP","0"]; instead of getVariable ["PlayerVIP",0]; (notice the quotes!).

 

Not entirely sure this is the problem but you have some inconsitency there.

Link to comment
Share on other sites

  • 0
_viplevel = player getVariable ["PlayerVIP","0"]; 

The above will work assuming you have already populated the player object with the PlayerVIP variable value containing the PlayerVIP value from the database. You will have to find and use the 500 or 505 custom query's to get the data from the database.

Link to comment
Share on other sites

  • 0

Its up to you. If you know how to use custom queries to get and set the value I can't see any issue with it being in that table except for hiccups in future upgrades. I personally would create a new table and use that if possible as you can just export/import the table and that way you are leaving the epoch tables in the format the devs intended. That way your custom table can hold any kind of information and you can simply record the players UID against the information you want to store just like the player_data and character_data tables.

 

P.S - If you have any documentation or any links on how to use custom queries, I would love to know how to do it as well and would be greatly appreciated.

Link to comment
Share on other sites

  • 0

If self_actions is broken then there is probably a syntax or logic error somewhere. First, do it in steps rather than 1 giant leap armstrong :P

 

This would be my work flow -

 

1) Get/Set the database values.

2) Then attach it to the player and test retrieving it.

3) Make the required changes to the trader file.

 

Always use isNil ("MY_VARIABLE") to test if it gets it as well as diag_log to spit out the values to the rpt file.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
  • Discord

×
×
  • Create New...