Add money for killing AI

Add money for killing AI

« posted: Jan 26, 2018, 03:45 PM »
Is there anywhere where I can add money to the player when they Kill AI   ?

Cheers

Re: Add money for killing AI

« Reply #1 posted: Jan 27, 2018, 03:25 PM »
OK ignore all sorted out now they drop  a random amount of cash when i kill them  :)

Re: Add money for killing AI

« Reply #2 posted: Feb 14, 2018, 04:57 AM »
OK ignore all sorted out now they drop  a random amount of cash when i kill them  :)

I'll share what was recently shared with me =). You should provide the solution you discovered so that others can learn from it should they stumble upon this post. The internet is chocked full of "never mind" posts, with no solutions.

I'd love to know how you ended up solving this =)
"Fine! I don't need your stinkin' lab,I've got my own stinkin' lab!"
  • Offline OLB
  • Fresh Spawn
  • *
  • Posts: 11

Re: Add money for killing AI

« Reply #3 posted: Feb 15, 2018, 05:03 AM »
OK ignore all sorted out now they drop  a random amount of cash when i kill them  :)

I would also like to know what solved this.

Re: Add money for killing AI

« Reply #4 posted: Feb 16, 2018, 09:23 PM »
Yep sorry you are correct i should have said !

Well in the end I made my own missions and spawned in my own units so I do not use any of the standard missions as I wanted to use another random mission generator.

So all I needed to do was add a EH to all my units  - ( you could simply add a EH to the spawned units in wasteland as well just as easy)
something like this

Code: [Select]
_tmpUnit addEventHandler ["Killed", server_playerDied];
_tmpUnit addEventHandler [ "killed", { _this execVM "scripts\Aideath.sqf"; }];


Then in my scripts\Aideath.sqf  I have something like this  example

Code: [Select]

params [ "_civ", "_killer" ];

_dead= _this select 0;
_killer =_this select 1;


   _rand = floor (random 100);

    switch (true) do {
        case (_rand <= 40): {
_item = createVehicle ["Land_Money_F", getPosATL _dead, [], 1, "None"];
_item setDir random 360;
_random = floor (random 300);
_rand = _random + 150;

_item setVariable ["R3F_LOG_disabled", true, true];
_item setVariable ["cmoney", _rand, true];
_item setVariable ["owner", "world", true];
            };
        case (_rand <= 50): {
_item = createVehicle ["Land_Money_F", getPosATL _dead, [], 1, "None"];
_random = floor (random 250);
_rand = _random + 100;
_item setDir random 360;
_item setVariable ["R3F_LOG_disabled", true, true];
_item setVariable ["cmoney", _rand, true];
_item setVariable ["owner", "world", true];

            };
        case (_rand <= 80): {
  /// another random amount
            };

        case (_rand <= 95): {
  /// another random amount
            };
    };


Hope that helps :)