Simple AI Tutorial (no rMod or DayZ_Factions)

Pretty sure they are both Gear as far as AI load goes

class FoodMRE : FoodEdible {
scope = public;
count = 1;
bloodRegen = 800;

class ItemTrashToiletpaper : CA_Magazine {
scope = public;
count = 1;
Thanks awesome! What about the Pistachios and the trail mix??
 
class FoodPistachio : FoodEdible {
scope = public;
count = 1;
bloodRegen = 100;

class FoodNutmix : FoodEdible {
scope = public;
count = 1;
bloodRegen = 100;

I don't see why you would not be able to give them a crossbow, but I have not done it myself.

Should just be in add_unit_server.sqf
Code:
        _gunnerSkin = "BAF_Soldier_MTP";
        _gunnerRifle = "Crossbow";
        _gunnerAmmo = "BoltSteel";
        _gunnerAmmoCount = 10;
        _gunnerGear = ["ItemBandage"];
        _gunnerWeapons = ["ItemMatchbox"];
 
Gary,

What do you mean by you and your group? If you mean players, they are classified as West (unless you're a bandit). The friendliness of the factions is handled in the set_unit_faction.sqf.

Code:
waitUntil{initialized};
//0Day
createCenter east;
createCenter resistance;
//Survivors
WEST setFriend [RESISTANCE,.7];
WEST setFriend [EAST,0];
//AI Units
RESISTANCE setFriend [WEST,.7];
RESISTANCE setFriend [EAST,0];
//AI Units 2
EAST setFriend [WEST,0];
EAST setFriend [RESISTANCE,0];

Anything above .6 makes that group friendly to yours, setting the AI to West or Resistance in this case would make them friendly to you/ Which faction they are is set in the init.sqf in the spawn line.

Code:
...
//_faction - The type of faction you want this unit to adhere to. 0: RESISTANCE, 1: EAST, 2: WEST. Factions loyalties are set in scripts\set_unit_faction.sqf
_aispawn = [[12961.4,5411.83,0.002],100,1,1,1,0,7,10,2,12] execVM "scripts\add_unit_server.sqf";
                                              ^this number handles the faction

That arrow may bot be as lined up as I thought - it's the number before the 7 in this case.
 
I don't see why you would not be able to give them a crossbow, but I have not done it myself.

Should just be in add_unit_server.sqf
Code:
        _gunnerSkin = "BAF_Soldier_MTP";
        _gunnerRifle = "Crossbow";
        _gunnerAmmo = "BoltSteel";
        _gunnerAmmoCount = 10;
        _gunnerGear = ["ItemBandage"];
        _gunnerWeapons = ["ItemMatchbox"];
[/quote]

I did this
case 7 : {
_sniperSkin = "Villager1";
_sniperRifle = "Remington870_lamp";
_sniperAmmo = "8Rnd_B_Baneli_Pellets";
_sniperAmmoCount = 3;
_sniperGear = ["FoodRawBacon"];
_sniperWeapons = ["ItemCompass"];
_gunnerSkin = "Survivor2_DZ";
_gunnerRifle = "Crossbow";
_gunnerAmmo = "WoodenArrow";
_gunnerAmmoCount = 10;
_gunnerGear = ["ItemBandage","FoodPistachio"];
_gunnerWeapons = ["ItemMap"];
_militiaSkin = "Bandit1_DZ";
_militiaRifle = "Colt1911";
_militiaAmmo = "7Rnd_45ACP_1911";
_militiaAmmoCount = 3;
_militiaGear = ["ItemSodaPepsi"]; // Additional gear (does not include tools or guns)
_militiaWeapons = ["ItemMatchbox"]; //Additional Guns and Tools
};
and when I tried to search his inventory my game froze up and stopped responding??
 
I pasted the gunner bit into my config and it works, are you sure it's this unit that is causing the freeze?
 
Sarge, looking through your code I see the random unit types get random weapon types, but do you have a way to load them with custom item's and gear? Am I just not seeing the spot where this happens?

Included in the next release :_) Due this eve.
 
Endlessboyz,

On the vanishing AI thing, change the addMPEventhandler and the MPKilled lines in add_unit_server.sqf to addEventHandler and Killed, bit more about this on page 26.
 
Gary,

What do you mean by you and your group? If you mean players, they are classified as West (unless you're a bandit). The friendliness of the factions is handled in the set_unit_faction.sqf.

Code:
waitUntil{initialized};
//0Day
createCenter east;
createCenter resistance;
//Survivors
WEST setFriend [RESISTANCE,.7];
WEST setFriend [EAST,0];
//AI Units
RESISTANCE setFriend [WEST,.7];
RESISTANCE setFriend [EAST,0];
//AI Units 2
EAST setFriend [WEST,0];
EAST setFriend [RESISTANCE,0];

Anything above .6 makes that group friendly to yours, setting the AI to West or Resistance in this case would make them friendly to you/ Which faction they are is set in the init.sqf in the spawn line.

Code:
...
//_faction - The type of faction you want this unit to adhere to. 0: RESISTANCE, 1: EAST, 2: WEST. Factions
loyalties are set in scripts\set_unit_faction.sqf
_aispawn = [[12961.4,5411.83,0.002],100,1,1,1,0,7,10,2,12] execVM "scripts\add_unit_server.sqf";
 
                                              ^this number handles the faction

That arrow may bot be as lined up as I thought - it's the number before the 7 in this case.

how does it decipher the difference between me and other players tho? Id like to have a faction protecting my base against other players who have made my admin base a primary target.
 
To clarify a bit more...is there a way to enter players names or ID's so that I could have a group of AI friendly to me but completely hostile to all others? This way I could enter my base without them shooting at me but they'd kill all other players that try to enter?
 
One last question: is there a way to change an AI faction or add a group of AI as dogs instead of soldiers. Pack of dogs that randomly attack would be cool!
 
About above^. Can anyone tell me if the AI can be set to protect one player while having absolute hate for others? I'd like to set that up for both myself and offer it to those who donate to the server. Thanks in advance!
 
Gary all players are West by default, and you can make AI either EAST or RESISTANCE at the moment with this add-on, as such any changes would affect the way AI treated any player char, that being said it may be possible to code a list of units that the ai is individually friendly to, I don't know how you would do that.
 
Tha
Gary all players are West by default, and you can make AI either EAST or RESISTANCE at the moment with this add-on, as such any changes would affect the way AI treated any player char, that being said it may be possible to code a list of units that the ai is individually friendly to, I don't know how you would do that.

Thank you for the reply! I'm not sure even where to begin with this. If anyone wanted to play with this idea and share, that would be awesome! Thanks again!
 
How exactly do I get the zombies to react to the AI's gunshots?? I'm sure I did exactly what orcthrasher said and alls it seemed to accomplish was make my AI's vanish??
 
Back
Top