McPimpin Posted August 19, 2014 Report Share Posted August 19, 2014 Would it be possible to put coins on AI for missions? Link to comment Share on other sites More sharing options...
peipo118 Posted August 19, 2014 Report Share Posted August 19, 2014 Just set the desired money variable on the AI when you spawn them in your mission :) Link to comment Share on other sites More sharing options...
Zupa Posted August 19, 2014 Report Share Posted August 19, 2014 What peipo set but explained abt more in detail. When u spawn the ai object thens et the variable: // _aiObject is the ai guy. _aiObject setVariable["CashMoney",5000]; Link to comment Share on other sites More sharing options...
YuriLowell Posted August 19, 2014 Report Share Posted August 19, 2014 Where would you put it in here for example? if (isServer) then { private ["_aitype","_mission","_aipack","_aicskill","_position","_unitnumber","_skill","_gun","_mags","_backpack","_skin","_gear","_aiweapon","_aigear","_aiskin","_skillarray","_unitGroup","_weapon","_magazine","_weaponandmag","_gearmagazines","_geartools","_unit"]; _position = _this select 0; _unitnumber = _this select 1; _skill = _this select 2; _gun = _this select 3; _mags = _this select 4; _backpack = _this select 5; _skin = _this select 6; _gear = _this select 7; _aitype = _this select 8; if (count _this > 9) then { _mission = _this select 9; } else { _mission = false; }; _aiweapon = []; _aigear = []; _aiskin = ""; _aicskill = []; _aipack = ""; _skillarray = ["aimingAccuracy","aimingShake","aimingSpeed","endurance","spotDistance","spotTime","courage","reloadSpeed","commanding","general"]; _unitGroup = createGroup east; _current_time = time; for "_x" from 1 to _unitnumber do { switch (_gun) do { case 0 : {_aiweapon = ai_wep_assault;}; case 1 : {_aiweapon = ai_wep_machine;}; case 2 : {_aiweapon = ai_wep_sniper;}; case "Random" : {_aiweapon = ai_wep_random call BIS_fnc_selectRandom;}; }; _weaponandmag = _aiweapon call BIS_fnc_selectRandom; _weapon = _weaponandmag select 0; _magazine = _weaponandmag select 1; switch (_gear) do { case 0 : {_aigear = ai_gear0;}; case 1 : {_aigear = ai_gear1;}; case 2 : {_aigear = ai_gear2;}; case 3 : {_aigear = ai_gear3;}; case 4 : {_aigear = ai_gear4;}; case "Random" : {_aigear = ai_gear_random call BIS_fnc_selectRandom;}; }; _gearmagazines = _aigear select 0; _geartools = _aigear select 1; if (_skin == "Random") then { _aiskin = ai_skin call BIS_fnc_selectRandom; } else { _aiskin = _skin; }; _unit = _unitGroup createUnit [_aiskin, [(_position select 0),(_position select 1),(_position select 2)], [], 10, "PRIVATE"]; [_unit] joinSilent _unitGroup; switch (_aitype) do { case "Bandit": { _unit setVariable ["humanity", ai_add_humanity, true]; }; case "Hero": { _unit setVariable ["humanity", -ai_remove_humanity, true]; }; }; if (_backpack == "Random") then { _aipack = ai_packs call BIS_fnc_selectRandom; } else { _aipack = _backpack; }; _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; if (sunOrMoon != 1) then { _unit addweapon "NVGoggles"; }; for "_i" from 1 to _mags do { _unit addMagazine _magazine; }; _unit addBackpack _aipack; { _unit addMagazine _x } foreach _gearmagazines; { _unit addweapon _x } foreach _geartools; switch (_skill) do { case "easy" : { _aicskill = ai_skill_easy; }; case "medium" : { _aicskill = ai_skill_medium; }; case "hard" : { _aicskill = ai_skill_hard; }; case "extreme" : { _aicskill = ai_skill_extreme; }; case "Random" : { _aicskill = ai_skill_random call BIS_fnc_selectRandom; }; default { _aicskill = ai_skill_random call BIS_fnc_selectRandom; }; }; { _unit setSkill [(_x select 0),(_x select 1)] } foreach _aicskill; ai_ground_units = (ai_ground_units + 1); _unit addEventHandler ["Killed",{[_this select 0, _this select 1, "ground"] call on_kill;}]; if (_mission) then { _unit setVariable ["missionclean", "ground"]; }; }; // Stops them from killing eachother when they fire.. _unitGroup setFormation "ECH LEFT"; _unitGroup selectLeader ((units _unitGroup) select 0); [_unitGroup, _position, _mission] call group_waypoints; diag_log format ["WAI: Spawned a group of %1 bandits at %2", _unitnumber, _position]; }; Link to comment Share on other sites More sharing options...
Zupa Posted August 19, 2014 Report Share Posted August 19, 2014 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]; keneano and Glenn 2 Link to comment Share on other sites More sharing options...
peipo118 Posted August 19, 2014 Report Share Posted August 19, 2014 Yepp :) Sry if i was a bit short before, i answered between classes and wanted to come back to it later :P But Zupa got that for me so thank you :) Link to comment Share on other sites More sharing options...
Chunk. No Captain Chunk. Posted August 19, 2014 Report Share Posted August 19, 2014 Someone should make a detailed tutorial for this. And make it an addon for DZMS / WAI along with Zupa's Single Currency. Made a post here about it: Thanks ZUPA! Glenn 1 Link to comment Share on other sites More sharing options...
Gr8 Posted August 21, 2014 Report Share Posted August 21, 2014 thanks for this Zupa Link to comment Share on other sites More sharing options...
rhammer2003 Posted September 24, 2014 Report Share Posted September 24, 2014 Hello, I have DZMS and WAI and DZAI running on my server I would like to give my AI gold coins but I am not sure what file I need to edit, I have looked for a file similar to the one above but do not see one anywhere, so I guess my question is, where do I change this? Link to comment Share on other sites More sharing options...
j0sty Posted October 12, 2014 Report Share Posted October 12, 2014 Hello, I have DZMS and WAI and DZAI running on my server I would like to give my AI gold coins but I am not sure what file I need to edit, I have looked for a file similar to the one above but do not see one anywhere, so I guess my question is, where do I change this? For WAI look for a file called "spawn_group.sqf" I don't use DZMS so I do not know what the file is named. Maybe for DZAI you can add the changes in the file called "fn_createGroup.sqf" Link to comment Share on other sites More sharing options...
Lazarus999 Posted October 26, 2014 Report Share Posted October 26, 2014 Pretty sure the file for DZMS is in the scripts folder and is called DZMSAISpawn.sqf :) Link to comment Share on other sites More sharing options...
Proximus Posted October 31, 2014 Report Share Posted October 31, 2014 Got it working on DZMS but i cannot find the right file for DZAI. Also is it possible to have some sort of chance in it, so not all the AI have coins on them? I did a DZMS mission (have _cash = round(random 20) * 100; to make the amount random) and was pretty rich after just one mission. Or should i just lower the _cash? Link to comment Share on other sites More sharing options...
Proximus Posted November 2, 2014 Report Share Posted November 2, 2014 Got it working on DZMS but i cannot find the right file for DZAI. Also is it possible to have some sort of chance in it, so not all the AI have coins on them? I did a DZMS mission (have _cash = round(random 20) * 100; to make the amount random) and was pretty rich after just one mission. Or should i just lower the _cash? Anyone? Link to comment Share on other sites More sharing options...
Rocu Posted November 3, 2014 Report Share Posted November 3, 2014 Also is it possible to have some sort of chance in it, so not all the AI have coins on them? Yes. Not hard at all. Take your script that adds coins, and add this around it: _coinsRandom = random 1; if (_coinsRandom <= 0.5) then { [your code here] }; So this has a 50% chance of adding coins to your AI. If you want to change it just change "0.5" to something else. Proximus 1 Link to comment Share on other sites More sharing options...
carl101 Posted November 7, 2014 Report Share Posted November 7, 2014 Anyone? for dzai the file you want is ai_setup_loadout.sqf in compile Link to comment Share on other sites More sharing options...
Proximus Posted November 7, 2014 Report Share Posted November 7, 2014 Should add it underneath this? //Add weapon, ammunition, and backpack _magazine = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") select 0; _unit addMagazine _magazine; _unit addWeapon _weapon; _unit selectWeapon _weapon; _unit addBackpack _backpack; if ((getNumber (configFile >> "CfgWeapons" >> _weapon >> "type")) == 2) then {_unit setVariable ["CanGivePistol",false]}; if ((getNumber (configFile >> "CfgMagazines" >> _magazine >> "count")) < 8) then {_unit addMagazine _magazine}; Link to comment Share on other sites More sharing options...
carl101 Posted November 8, 2014 Report Share Posted November 8, 2014 I added it under the backpack line and worked fine Link to comment Share on other sites More sharing options...
Proximus Posted November 8, 2014 Report Share Posted November 8, 2014 Can you share the part where you added it? Link to comment Share on other sites More sharing options...
carl101 Posted November 8, 2014 Report Share Posted November 8, 2014 //Add weapon, ammunition, and backpack _magazine = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") select 0; _unit addMagazine _magazine; _unit addWeapon _weapon; _unit selectWeapon _weapon; _unit addBackpack _backpack; _cash = round(random 20) * 300; // number between 0 and 20 000 // Soul Hive _unit setVariable["CashMoney",_cash ,true]; Proximus 1 Link to comment Share on other sites More sharing options...
Fuchs Posted November 11, 2014 Report Share Posted November 11, 2014 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]; Hi all! Does this also work for DZAI ? Link to comment Share on other sites More sharing options...
carl101 Posted November 11, 2014 Report Share Posted November 11, 2014 Fuchs, see my post just above Link to comment Share on other sites More sharing options...
Proximus Posted November 12, 2014 Report Share Posted November 12, 2014 Carl's post works on DZAI :D Link to comment Share on other sites More sharing options...
mimic Posted November 15, 2014 Report Share Posted November 15, 2014 How would I make it so players are rewarded with a specific amount of gold for killing an AI? Eg: 100 coins per kill I'm using WAI. Thanks! Link to comment Share on other sites More sharing options...
escortrally Posted December 4, 2014 Report Share Posted December 4, 2014 How would I make it so players are rewarded with a specific amount of gold for killing an AI? Eg: 100 coins per kill I'm using WAI. Thanks! Find the code that gives player humanity for killing ai's and add the "cashMoney" variable after it, just like you do with zombies. Link to comment Share on other sites More sharing options...
kat Posted December 5, 2014 Report Share Posted December 5, 2014 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' Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now