Jump to content

Put coins on AI?


Recommended Posts

Somethimes it happens when checking wallets of DZMS AI's:

You took <NULL>  coins, ID says <NULL>!

All coins on screen are gone only solution -> relog

Anyone a solution for this?

 

I use this code in my DZMSAISpawn.sqf:
    //Zupa Currency
     _cash = round(random 20) * 100; // number between 0 and 20 00
    _unit setVariable["cashMoney",_cash,true];

Link to comment
Share on other sites

  On 12/22/2014 at 8:08 AM, Skymaster2015 said:

Somethimes it happens when checking wallets of DZMS AI's:

You took <NULL>  coins, ID says <NULL>!

All coins on screen are gone only solution -> relog

Anyone a solution for this?

 

I use this code in my DZMSAISpawn.sqf:

    //Zupa Currency

     _cash = round(random 20) * 100; // number between 0 and 20 00

    _unit setVariable["cashMoney",_cash,true];

 

Same here.

Link to comment
Share on other sites

  On 12/29/2014 at 3:06 AM, Gr8Boi said:

Then you guys are not using the Souls Hive. Change the variable to the SC version you are using

 

My bad, I left out the part about using SC 3.0 and a default hive. The null only comes up when looting coins from DZMS AI.  I haven't seen or heard problems with coins and DZAI or WAI. The only thing I can see different when looting coins from DZMS AI, is there's no name assigned to the AI unit.

 

Correction:  It seems to only cause problems with DZMS and WAI.  Works flawless with DZAI

Link to comment
Share on other sites

  • 2 weeks later...
  • 2 weeks later...
  On 8/19/2014 at 7:13 AM, Zupa said:

 

change

		_unit enableAI "TARGET";
		_unit enableAI "AUTOTARGET";
		_unit enableAI "MOVE";
		_unit enableAI "ANIM";
		_unit enableAI "FSM";
		_unit setCombatMode ai_combatmode;
		_unit setBehaviour ai_behaviour;
		removeAllWeapons _unit;
		removeAllItems _unit;
		_unit addweapon _weapon;

to 

		_unit enableAI "TARGET";
		_unit enableAI "AUTOTARGET";
		_unit enableAI "MOVE";
		_unit enableAI "ANIM";
		_unit enableAI "FSM";
		_unit setCombatMode ai_combatmode;
		_unit setBehaviour ai_behaviour;
		removeAllWeapons _unit;
		removeAllItems _unit;
		_unit addweapon _weapon;

                // Soul Hive
		_unit setVariable["CashMoney",5000,true];
                // 999 Hive
                _unit setVariable["headShots",5000,true];

Or how much cash u want, i put 5000 now, change that number to your likings

 

 

If u want like random generated cash try this:

 

Between 0 to 20000 ( always +1000)


		_unit enableAI "TARGET";
		_unit enableAI "AUTOTARGET";
		_unit enableAI "MOVE";
		_unit enableAI "ANIM";
		_unit enableAI "FSM";
		_unit setCombatMode ai_combatmode;
		_unit setBehaviour ai_behaviour;
		removeAllWeapons _unit;
		removeAllItems _unit;
		_unit addweapon _weapon;


                _cash = round(random 20) * 1000; // number between 0 and 20 000

                // Soul Hive
		_unit setVariable["CashMoney",_cash ,true];
                // 999 Hive
                _unit setVariable["headShots",_cash ,true];

Zupa will this work with your new coin system: Single Currency 3.0 & Storage DEFAULT HIVE ( No global banking).

Link to comment
Share on other sites

  • 2 months later...

to stop the null message I used
 
 

  Quote

//give coin
_coinsRandom = random 1;
if (_coinsRandom <= 0.5) then {
_cash = round(random 20) * 5; // number between 0 and 100
_unit setVariable["CashMoney",_cash ,true];
} else {
_cash = 0;
_unit setVariable["CashMoney",_cash ,true];
};
//end of coins

Link to comment
Share on other sites

  • 2 months later...
  On 1/20/2015 at 5:41 PM, Thug said:

Zupa will this work with your new coin system: Single Currency 3.0 & Storage DEFAULT HIVE ( No global banking).

I am trying to add this to my server as well,. I have the latest wai and,dzsm and dzai, I have only added what kat has added for the wai system . I get this is the Rpt for the wai system 3:03:07   Error Undefined variable in expression: mission_announce

 3:03:07 File z\addons\dayz_server\modules\Construction.sqf, line 171
 3:03:08 Error in expression <tnumber = count _position;
 
if(_aitype == "Hero") then {
_unitGroup = createGro>
 3:03:08   Error position: <== "Hero") then {
_unitGroup = createGro>
 3:03:08   Error Generic error in expression
 3:03:08 File z\addons\dayz_server\WAI\compile\spawn_static.sqf, line 32
 3:03:08 Error in expression <= time;
_unarmed = false;
 
if(_aitype == "Hero") then {
_unitGroup = createGro>
 3:03:08   Error position: <== "Hero") then {
_unitGroup = createGro>
 3:03:08   Error ==: Type Bool, expected Number,String,Object,Side,Group,Text,Config entry,Display (dialog),Control,Team member,Task,Location
 3:03:08 File z\addons\dayz_server\WAI\compile\spawn_group.sqf, line 42
 3:03:08 Error in expression <= time;
_unarmed = false;
 
if(_aitype == "Hero") then {
_unitGroup = createGro>
I would put in spoiler but I am not sure how.
Link to comment
Share on other sites

  • 6 months later...
  On 12/5/2014 at 6:11 AM, kat said:

WAI:

 

spawn_group.sqf

 

Find

call {
      if(_aitype == "hero")         exitWith { _unit setVariable ["Hero",true]; _unit setVariable ["humanity", ai_remove_humanity]; };
      if(_aitype == "bandit")     exitWith { _unit setVariable ["Bandit",true]; _unit setVariable ["humanity", ai_add_humanity]; };
      if(_aitype == "special")     exitWith { _unit setVariable ["Special",true]; _unit setVariable ["humanity", ai_special_humanity]; };
     };

Replace with

call {
      if(_aitype == "hero")  exitWith { _unit setVariable ["Hero",true]; _unit setVariable ["humanity", ai_remove_humanity]; _unit setVariable ["cashMoney", ai_hero_amount]; };
      if(_aitype == "bandit")  exitWith { _unit setVariable ["Bandit",true]; _unit setVariable ["humanity", ai_add_humanity]; _unit setVariable ["cashMoney", ai_bandit_amount]; };
      if(_aitype == "special")  exitWith { _unit setVariable ["Special",true]; _unit setVariable ["humanity", ai_special_humanity]; _unit setVariable ["cashMoney", ai_special_amount]; };
     };

on_kill.sqf

 

Add

_playerCoins    = _player getVariable["cashMoney",0];
_unitCoins      = _unit   getVariable["cashMoney",0];
Under
_banditkills    = _player getVariable["banditKills",0];
_humankills     = _player getVariable["humanKills",0];

Add

if (ai_coin_award) then {
     _player setVariable ["cashMoney",(_playerCoins + _unitCoins),true];
};

Under

if (ai_humanity_gain) then {
     _gain = _unit getVariable ["humanity", 0];
     call {
        if (_unit getVariable ["Hero", false]) exitWith { _player setVariable ["humanity",(_humanity - _gain),true]; };
        if (_unit getVariable ["Bandit", false]) exitWith { _player setVariable ["humanity",(_humanity + _gain),true]; }; 
        if (_unit getVariable ["Special", false]) exitWith { if (_humanity < 0) then { _player setVariable ["humanity",(_humanity - _gain),true]; } else { _player setVariable ["humanity",(_humanity + _gain),true]; }; };
    };
};

Config.sqf

 

Add

ai_coin_award = true;
ai_hero_amount = 200;
ai_bandit_amount = 200;
ai_special_amount = 300;

Change the values to what you want. 

 

Under

ai_special_humanity = 150;

If your using an older version of SC then change 'cashMoney' to 'headShots'

 

Expand  

This is works perfectly.

 

Thanks

Link to comment
Share on other sites

  • 3 weeks later...
  On 12/5/2014 at 6:11 AM, kat said:

WAI:

 

spawn_group.sqf

 

Find

call {
      if(_aitype == "hero")         exitWith { _unit setVariable ["Hero",true]; _unit setVariable ["humanity", ai_remove_humanity]; };
      if(_aitype == "bandit")     exitWith { _unit setVariable ["Bandit",true]; _unit setVariable ["humanity", ai_add_humanity]; };
      if(_aitype == "special")     exitWith { _unit setVariable ["Special",true]; _unit setVariable ["humanity", ai_special_humanity]; };
     };

Replace with

call {
      if(_aitype == "hero")  exitWith { _unit setVariable ["Hero",true]; _unit setVariable ["humanity", ai_remove_humanity]; _unit setVariable ["cashMoney", ai_hero_amount]; };
      if(_aitype == "bandit")  exitWith { _unit setVariable ["Bandit",true]; _unit setVariable ["humanity", ai_add_humanity]; _unit setVariable ["cashMoney", ai_bandit_amount]; };
      if(_aitype == "special")  exitWith { _unit setVariable ["Special",true]; _unit setVariable ["humanity", ai_special_humanity]; _unit setVariable ["cashMoney", ai_special_amount]; };
     };

on_kill.sqf

 

Add

_playerCoins    = _player getVariable["cashMoney",0];
_unitCoins      = _unit   getVariable["cashMoney",0];
Under
_banditkills    = _player getVariable["banditKills",0];
_humankills     = _player getVariable["humanKills",0];

Add

if (ai_coin_award) then {
     _player setVariable ["cashMoney",(_playerCoins + _unitCoins),true];
};

Under

if (ai_humanity_gain) then {
     _gain = _unit getVariable ["humanity", 0];
     call {
        if (_unit getVariable ["Hero", false]) exitWith { _player setVariable ["humanity",(_humanity - _gain),true]; };
        if (_unit getVariable ["Bandit", false]) exitWith { _player setVariable ["humanity",(_humanity + _gain),true]; }; 
        if (_unit getVariable ["Special", false]) exitWith { if (_humanity < 0) then { _player setVariable ["humanity",(_humanity - _gain),true]; } else { _player setVariable ["humanity",(_humanity + _gain),true]; }; };
    };
};

Config.sqf

 

Add

ai_coin_award = true;
ai_hero_amount = 200;
ai_bandit_amount = 200;
ai_special_amount = 300;

Change the values to what you want. 

 

Under

ai_special_humanity = 150;

If your using an older version of SC then change 'cashMoney' to 'headShots'

 

Expand  

anybody know how to make the coins random with this method.  I've been trying for a few days now and cant figure it out lol

Link to comment
Share on other sites

		if (!_unarmed) then {
			for "_i" from 1 to _mags do {
				_unit addMagazine _magazine;
			};
			_unit addweapon _weapon;
			_unit selectWeapon _weapon;
			_cash = round(random 20) * 100; // number between 0 and 20 000
            _unit setVariable["CashMoney",_cash ,true];
		};

^^^^^^^^ WAI

	//Add the behaviour
	_unit enableAI "TARGET";
	_unit enableAI "AUTOTARGET";
	_unit enableAI "MOVE";
	_unit enableAI "ANIM";
	_unit enableAI "FSM";
	_unit setCombatMode "RED";
	_unit setBehaviour "COMBAT";
	_cash = round(random 20) * 100; // number between 0 and 20 000
	_unit setVariable["CashMoney",_cash,true];

^^^^^^^^^ DZMS

 

That's how mine is, much easier :)

Link to comment
Share on other sites

i agree its much easier, this is what  i had previously. the only issue is i get the "null" option when picking up coins. and anything a player does after that, doesnt save.  And they can take advantage of the bug if they know what they are doing.

The method above gives you the coins when you kill the ai, just like humanity.  Would stop the check wallet bug.  But i need it a random number lol

Link to comment
Share on other sites

Ok so it pays off to be persistent lol.  I managed to get the random coins given to you when killing an AI, just like the humanity.

This is meant to try and stop the null coins issue when checking wallets.

I use single currency 2.0. so the variables might be different for other versions of single currency.

For WAI, do this

  Reveal hidden contents

For DAZI, do this

  Reveal hidden contents

For DZMS do this

  Reveal hidden contents

Its been tested it works.  I have not tested this for the long range with a base of players. Only on my test server.

For being able to change the range or random coins given, alter what is in bold

_money = round(random 20) * 500;      20 * 500.  So basically the max is 10 000. 250 would be 5000 max

Now as for being able to check your own wallet and players wallets i would suggest this fix by KoTaS

it removes the check wallet option from AIs and you only get the option for players

 

Also if you have plot 4 life i would suggest reading my post in that thread just bellow his, just need to change one variable.

Thanks to Zupa and team for the amazing coin script. Thanks Kotas for your check wallet fix. and thanks to the creators of the AI systems (sry i dont know all the names and i know they've been passed around a bit lol, but TY)

on a side note. Im not a coder by any means. i copy and pasted some code and changed variables. If someone with experience can shed light if it can be done cleaner please let me know.

Duke

Link to comment
Share on other sites

  • 6 months later...
  On 8/6/2016 at 3:07 AM, Bricktop said:

Old post I know - I just reinstalled DZAI and can't figure out how to add the coin ...

Tried and failed x3 - Could someone sort me out here?

What code and where would I put it to add random (1000-20000) coin to DZAI patrols.

Thanks for any help!

 

https://gist.github.com/anonymous/4e1e92199d9f777f0bdb4fc66f654aaa

Expand  

Under:

if ((getNumber (configFile >> "CfgMagazines" >> _magazine >> "count")) < 8) then {_unit addMagazine _magazine};

Try pasting this:

_aicash = round(random 100) * 197;
_unit setVariable["cashMoney",_aicash ,true];

 

Link to comment
Share on other sites

  On 8/6/2016 at 3:33 AM, BigEgg said:

Under:

if ((getNumber (configFile >> "CfgMagazines" >> _magazine >> "count")) < 8) then {_unit addMagazine _magazine};

Try pasting this:

_aicash = round(random 100) * 197;
_unit setVariable["cashMoney",_aicash ,true];

 

Expand  

Thanks @BigEgg! 

Testing on next reset ...

 

EDIT - WORKS PERFECT!! - 

anyone using DZAI this method works to add coins to your patrols.

Thanks again BigEgg ~

BigBigEgg

Link to comment
Share on other sites

  On 8/6/2016 at 4:49 AM, Bricktop said:

Thanks @BigEgg! 

Testing on next reset ...

 

EDIT - WORKS PERFECT!! - 

anyone using DZAI this method works to add coins to your patrols.

Thanks again BigEgg ~

BigBigEgg

Expand  

Do you still use the check wallet option? If so do you have issues with coins saying NULL?

Link to comment
Share on other sites

I do use check wallet but don't seem to have any issues with NULL -

However my players have been mentioning a negative value in coins like (-75k) or (- 750k)

I can use infistar to give them coins back but this is becoming quite the problem lately ...

Looking for information on the now 

Link to comment
Share on other sites

  On 8/7/2016 at 7:18 PM, Bricktop said:

I do use check wallet but don't seem to have any issues with NULL -

However my players have been mentioning a negative value in coins like (-75k) or (- 750k)

I can use infistar to give them coins back but this is becoming quite the problem lately ...

Looking for information on the now 

Expand  

my post just above your first post explains how to remove the check wallet option from AIs, and when you kill AIs it automatically gives you coins.  Since i changed that, i havnt had issues with negative coins or the NULL issue.

Link to comment
Share on other sites

  • 4 months later...

Hello

i would ask You for help :) I add coins into AI (theduke option from few post above - it's working perfectly!) on kill but it would be cool when person who killed AI got some message with amount of coins he got for kill. I tried add info in script in file fn_countkills.sqf by adding one line:

  Reveal hidden contents

Not lucky - not working, no msg :)

 

For me fine would be when person who killed AI got Message: "(Unit name) was killed" add here something like this: "(Unit name) was killed. You gain XX coins bounty." 

 

I tried to find in files/code place where is line for this (Unit name was killed) and i didnt found it :( Could some one show me? Or help with above?

 

Of course above is only for DZAI, for Wicked AI isnt any message for killing, it's possible to add this too? 

 

Im using only epoch server files, 1.0.5.1,

Wicked AI 2.2.0 - https://epochmod.com/forum/topic/15671-release-wicked-ai-220/

Single Currency Banking 1.1 - https://epochmod.com/forum/topic/15177-release-single-currency-banking-11/

DZAI - http://opendayz.net/threads/dzai-visual-installation-guide.18447/

 

Link to comment
Share on other sites

  • 3 months later...
  On 4/7/2017 at 9:00 PM, DY357LX said:

Anyone managed to add coins to DZAI using @salival's ZSC for Epoch 1.0.6.1 files?

Expand  

Yep sure. It's easy. Here you go:

Go to server.pbo\DZAI\compile\ai_setup_loadout.sqf

Search for this line:

if ((getNumber (configFile >> "CfgMagazines" >> _magazine >> "count")) < 8) then {_unit addMagazine _magazine};

Add this below:

_cash = round(random 20) * 100;
_unit setVariable[Z_moneyVariable,_cash,true];

That's a random number of coins between 0 and 2000. If you want more just change the 20 behind the "random".

Link to comment
Share on other sites

  On 4/8/2017 at 6:56 PM, DAmNRelentless said:

Yep sure. It's easy. Here you go:

Go to server.pbo\DZAI\compile\ai_setup_loadout.sqf

Search for this line:

if ((getNumber (configFile >> "CfgMagazines" >> _magazine >> "count")) < 8) then {_unit addMagazine _magazine};

Add this below:

_cash = round(random 20) * 100;
_unit setVariable[Z_moneyVariable,_cash,true];

That's a random number of coins between 0 and 2000. If you want more just change the 20 behind the "random".

Expand  

I would do it in ai_death.sqf instead so you're only broadcasting the unit having coins if it dies. Saves unnecessarily sending stuff over the network

 

Maybe before this: https://github.com/oiad/DZAI/blob/master/DZAI/compile/ai_death.sqf#L83

Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
  • Advertisement
×
×
  • Create New...