Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
You see this question Sarge?
Also, 1 more question:
Could I set up an eventHandler so that when someone kills one of my AI that it gives them a survivor kill or bandit kill and reduces their humanity? so that they can become bandits from killing AI?
How would I set this up? Do I just add the event handler to the units init?Yepp that works. I have a EH for the killed event running on the AI, where i handle that stuff. you will need to figure out who killed the NPC, if it was a player, and then if player = survivor or bandit.
By this you can then substract humanity from player and bandit survivors. About the kill counter i am not sure, would need to check. but i assume that's a variable on the player, so you should be able to adjust it.
//Support
_man2heli = _groupheli createunit [_soldiertype, [(_rndpos select 0) - 30, _rndpos select 1, 0], [], 0.5, "NONE"];
_man2heli addMagazine _patrol_magazine_name;
_man2heli addWeapon _patrol_weapon_name;
_man2heli addMPEventHandler ["MPkilled", {Null = _this execVM "addons\SARGE\SAR_aikilled.sqf";}];
_man2heli action ["getInTurret", _heli,[0]];
[_man2heli] joinSilent _groupheli;
It's done in a big file with tons of conditionals based on input, but here's 1 specific:can you paste the code snippet where you define your units ?
mine e.g. looks like
Code://Support _man2heli = _groupheli createunit [_soldiertype, [(_rndpos select 0) - 30, _rndpos select 1, 0], [], 0.5, "NONE"]; _man2heli addMagazine _patrol_magazine_name; _man2heli addWeapon _patrol_weapon_name; _man2heli addMPEventHandler ["MPkilled", {Null = _this execVM "addons\SARGE\SAR_aikilled.sqf";}]; _man2heli action ["getInTurret", _heli,[0]]; [_man2heli] joinSilent _groupheli;
case 1 : {
_ailoadout=[_resistanceSniperRifle,_resistanceSniperAmmo];
_resistanceSniperSkin createUnit [_unitpos, _aiGroup,"null = [this] execVM 'scripts\unit_init.sqf'"];
_aiunit enableAI "TARGET";
_aiunit enableAI "AUTOTARGET";
_aiunit enableAI "MOVE";
_aiunit enableAI "ANIM";
_aiunit enableAI "FSM";
_aiunit allowDammage true;
_aiunit setCombatMode "RED";
_aiunit setBehaviour "COMBAT";
//clear default weapons / ammo
removeAllWeapons _aiunit;
//add weapon
_aiwep = _ailoadout select 0;
_aiammo = _ailoadout select 1;
_aiunit addMagazine _aiammo;
_aiunit addweapon _aiwep;
_gearCount = count _resistanceSniperGear;
for [{z = 0},{z < _gearCount-1},{z = z + 1}] do {
_currentItem = _resistanceSniperGear select z;
_aiunit addMagazine _currentItem;
};
//set skills
for [{_i=0},{_i<10},{_i=_i+1}] do {
_totalSkill = (floor(random _skillRemainder)+_baseSkill)/10;
_aiunit setSkill [_aiSkills select _i,_totalSkill];
};
};
private["_ai","_killer"];
_ai = this select 0;
_killer = this select 1;
_humanity = _killer getVariable ["humanity",0];
_killer setVariable ["humanity",_humanity-1000];
_kills = _killer getVariable ["humanKills",0];
_killer setVariable ["humanKills",_kills+1];
You don't have to edit it. You just go into your install folder, and then into the map that you're using (labeled as @DAYZMAP) and pull the pbo from there, open it, pull the file and put it into your scripts folder, and then add that line that I said into the very bottom of the file, and add the new line into your mission init.
zombie_generate.sqf:
Pull this file from your Dayz_code.pbo and then add the following code at the very bottom.
for me it is G:\Steam\common\Steamapps\Arma2\@DayZOring\Dayz_code.pbo..Have no idea where you're coming from then dude..
Code:zombie_generate.sqf: Pull this file from your Dayz_code.pbo and then add the following code at the very bottom.
On my server, I only have access to the battle eye scripts and @Bliss , which contains the dayz_server.pbo and no other files. In my mission pbo , there is no dayz_code , your statement above says to get this file from the dayz_code.pbo, which I don't have. No offence , but that tutorial is pretty hard to follow and seems to be coming from the "so you already know this stuff, right?" way of doing things! which defeats a tutorials purpose for me.
Also, if you're going to mention the tutorial to other people, please provide the link to the thread as most people wouldn't have the time to scroll back 15 pages just to find what you're talking about.. lol
Code:private["_ai","_killer"]; _ai = this select 0; _killer = this select 1; _humanity = _killer getVariable ["humanity",0]; _killer setVariable ["humanity",_humanity-1000]; _kills = _killer getVariable ["humanKills",0]; _killer setVariable ["humanKills",_kills+1];
Does that look right for what I would put in the event handler file? it said that MPKiller returns [unit,killer].
for me it is G:\Steam\common\Steamapps\Arma2\@DayZOring\Dayz_code.pbo..
Don't look on your server, it's on your local PC. Go to your LOCAL arma 2 installation folder, go in to the map you're using, and find the pbo there.
It just moves the file to your mission folder (which makes your mission larger unfortunately) so that you can edit it. What you're doing causes your zombies to become part of the ENEMY side, which means they are hated by everyone capable of hating.Now I get it.. Thanks Sycosis, that makes more sense now.
Now can you explain how this effects the main server and the other clients ?
Also, is there a way to use this detection thing to detect if there are zombies around like it does for bandits? That would mean I could get rid of this zombie_generate.sqf file and just have the ai themselves convert the zombies rating.
_killer setVariable ["humanity",_humanity-1000,true];you will need to check if the killer was a AI or a player. you will also need to check if a survivor or a bandit was killed (no reduction for bandit kills)
you will need to make the setvariable global (3. parameter set to true), and you might need to want to call a player_sync.
Out of curiousity, could I spawn a zombie where an AI is killed?
I have a faction of AI walking around with the same skins as zombies (though the living version). Could I do something in this event handler that checks the outfit that the unit is wearing, and spawn the corresponding zombie, and remove the body of the AI? I know nothing about zombie generation, so I don't know if you can spawn the specific zombie types, or their standing/laying position.
I think that would be a funny mechanic if you shot a unit and then he died and came back as a zombie in like 5 minutes.
_killer setVariable ["humanity",_humanity-1000,true];
like that? How do I call a player sync?
How would I use your script to check if it's them? Would I do (position _ai) nearEntities [[zZombieBase],_detectRange];?grinthat was my point from the very beginning
The Zombie class you want to look for is called zZombie_Base.
Either you combine these classes in one script, or you run 2 different scripts (i have 2 different ones ... otherwise my heli patrols at the coast would attack all zombis there, which i didnt want. I want them to only shoot at bandits)
My infantry is running the script that detects Zombs and bandits (my AI bandits are the same classes as player bandits).