OFPEC Forum

Editors Depot - Mission Editing and Scripting => Arma2 - Editing/Scripting Resources Beta Testing & Submission => Topic started by: haroon1992 on 19 Feb 2010, 14:24:45

Title: [OBSOLETE!] pls see Customizable Zombie Simulation instead!
Post by: haroon1992 on 19 Feb 2010, 14:24:45
NEW VERSION (Version 1.85) IS UPLOADED!
See changelog for several fixes.
The zombies seemed to be much faster in deciding which victim to hunt in this version.
(of course if in mode 2)
Lag will be greatly reduced (even though I haven't received anything about lag problem)
 :good:

All features are listed in the readme.
And the readme also contains various available customizables.
Feel free to customize everything you can with the script.


Credits :
Haroon1992
Mathias_Eichinger (for the idea)
Thanks To :
Evil_Echo (for his advice on array problem and other problems)
Dead3yes(for his advice on array problem and other problems)
Mandoble(for his advice on the problems and for being the first to test my script) :clap:
_h(for his superb advice on using the Private command) :clap:

As the function's in beta stage, feedback is higly appreciated.
I hope you guys give it a try.
There's an example mission in the package with which you can test the script without
extra procedures.(just drop it into your missions folder and preview it in mission editor,Utes)

Full contents of readme.txt is too long to post here.
Here's the behaviour section of the readme.Enjoy!

zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
BEHAVIOUR (ZOMBIES)
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

Note : Forgive the badly written english.

HUNTING
zzzzzzzzzz
- zombies start to hunt victim if the victim is in the specified distance from them.
(eg. if the distance is set to 50m, zombies will hunt victim if the victim is within 50m from them)
They will stop hunting if victim is out of that specified range.
- zombies will not follow/hunt victims who are in aircrafts
- zombies will not follow/hunt victims who are in water, instead of following, they'll wait for the victim to come back to land
 (They'll go here and there at the beach groaning with anger and if the victims has not come back within the specified time,the
  zombies will flee to their home)
- The zombies will NOT hunt victims who are within a specified distance(specified by you) from any fearobjects.
(Look FLEEING for info about FearObjects)



ATTACKING
zzzzzzzzzzzzz

- the damage the zombies will inflict upon victims can be modified (individually for each zombies)
- The zombie will scratch (random animation out of 2 available) the victim if he and the victim are within the specified
distance. (the default value is around 3,which is also a bit random,it maybe 2.8 or 3.2,etc)
- The victim will not get dammaged if he is quick enough to flee away from the zombie when it starts to scratch.



AFTER DEATH OF VICTIM
zzzzzzzzzzzzzzzzzzzzzzzzzzz

- the zombie will EAT (random getting healed animation) the Victim.
NOTE : if another alive victim is too close or closer to the zombie than the dead victim, he will instead,hunt the alive victim.

- the position of the zombie will be slightly random, and the zombie will be SETPOSED within about 2 meters from the dead body,
in order to avoid overlapping of zombies around the victim.
(But this might produce a little annoyance as the zombies are SETPOSED around the body)

- the body of victim will sink into the ground ("HIDEBODY" addaction,can be DISABLED via Global Variable)after about 12secs from the time the zombie eats.
- After finished eating, the zombies will turn to another victim (if present and is within specified range),else they will just
  remain there,standing until another victim gets close (if present).



FLEEING
zzzzzzzzzz

- you have to specify an array of objects which the zombies will fear.
(for example, [machinegun1,searchlight1,tank1,fire1,grunt2,etc])
- and the distance between the zombie and any of the object,which if within that distance, the zombie will flee to their hide-out/home (this also
need to be specified)
- the fleeing process is like this :
 if the zombie encounters any objects that are in the fearobjects array(above array) and he will flee to the home (ONLY ONE OBJECT
CAN BE SPECIFIED AS HOME YET) and after it reaches HOME, he will wait for about 15 secs(can be modified) and then return back to the place where
he had encountered the fear object (but not too close) and seach for the victim and if found the victim, hunt him,otherwise,just
stand there.
In the above procedure, you can change one thing, that is :
whether the zombie flees to home until he reachs the home (ignoring any victims he encounters on the way home!)
or flee to home but stop if he encounters any victim who is not within the specified distance from the fear object.


zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz
BEHAVIOUR (VICTIMS)
zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz

FLEEING
zzzzzzzzzzz

-The Victims will flee from the zombies if they gets close.
(this function can also be disabled by setting a certain variable to false,see global parameters)

-The victims which have guns will shoot back to the zombies.(They'll also throw grenades to them)
For me, its fun watching the fighting of victims and zombies!
NOTE : this can also be disabled, See global parameters in readme.

-------------------------------------------------------------------------

Change Log

v1.85
Code: [Select]
-Fixed : Many instances of the functions were running.
 -Fixed : Variable Errors (mostly Local ones , due to the lack of private)
 -New Option : You can now check how many instances of the functions are running by setting a variable to TRUE(Variable : Hz_Show_Instances)
 -New .SQF Script : h_keepUp.sqf, to keep the shooters rating up.(So that he won't be considered renegade.)
 -Changed : Debugger now only shows no. of Zs left,no. of Vs left,Victim array and states of global variables.
 -A few more .sqf script(which do minor things ,so are not explained)
v1.8
-Changed : Method for finding nearest victim, now its really hunting the nearest Victim.
-Fixed : Victims without weapons were trying to engage zombies.(and saying "Negative" too :) )
-Fixed : Found some unused variables(local) in the script.Removed them.
-Fixed : Variable name errors.(_h_feardis being _h_fear_dis etc)
-Fixed : Zombies fleeing to home at the start of the mission as there's no victim to hunt.
-Fixed : Zombies are sometimes scratching other zombies.
-Fixed : Victims sometimes fleeing from other victims.
-Several other fixes including layout,changing waitUntils to while dos for performance,etc.

-New .SQF Script : h_nearestObject.sqf,for detecting the nearest object in an array.(I don't want to use BIS default functions,because they need the Function Module)
-New Option : Hz_HideBody, now you can define whether the zombies hide to body of victim or not.
-New Option : Hz_Hunt_Distance,now you can define the distance required between zombie and victim for the zombie to hunt that victim.
-Other : Many new customizables are added,see ReadMe for more info.(eg. Dis needed btwn V and Z for V to shoot Z)

v1.6
-New Option : Hz_Victim_Flee,toggle the victim to flee or stand still.
-New Option : Hz_Shoot,make victims with weapons to shoot the zombies or not.
-New Option : Hz_Pause_Hunt,now you can pause the script for your desired time(in seconds)
-New .SQF Script : h_victim_shoot.sqf, now the victims will shoot the zombies within 60meters.
-New Argument : Now you can define the damage caused by the zombie upon the victim.

My apologies ,  :confused:
This is as far as I remember.......
As this is my first script,I didn't know that I should keep track on my changes.
Now I forgot what i did in the earlier versions. :(
But I think most of your aren't that interested in changelogs,right?
ALL of the scripts features are listed in the ReadMe.So you won't miss a thing. :)


Known Issues :
- Victim Fleeing is still not perfect.
(If you want to help fix me in this problem,just open up the h_nearestObject.sqf Function and
please take your time inspecting any errors in it, that function is called every 2 seconds )
Please report any issues you found.

Regards,
Haroon1992
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 07 Jun 2010, 18:00:18
New version uploaded!  :D
Title: Re: Haroon1992's Zombie Script
Post by: Mandoble on 07 Jun 2010, 22:47:05
Interesting concept, and it seems to work well. I'm not any zombie expert, but I would say they should be quite reluctant to die.
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 08 Jun 2010, 04:23:20
Have you tested it?
I think making them hard to die concerns with their config.
(Because in general , three shot and he's dead)

(But maybe I should add an eventhandler killed to check it and restore his health.
I am going to test on this thing today)
One thing, is the Killed eventhandler MP Compatible?
(but my script currently seemed to be not mp compatible...)
One more question :
the following's a local variable in the zombie script .
_h_waitTime=5+round random 10;

(will the value of that variable for the same Zombie the same in all clients? (and server if it's not dedicated server?)

Well,this thread's not meant for questions but I just don't want to open another thread with the  name "Zombie Script Questions" lol.

Thanks for reporting Mandoble.
Regards,
Haroon1992
Title: Re: Haroon1992's Zombie Script
Post by: Mandoble on 08 Jun 2010, 09:23:55
Yes, I've tested it and I can kill any zombie with a single shot, just like killing a civilian.

"Killed" EH is executed only there where the killed unit is local. And no, your _h_waitTime var will have different values values in every client or server as the random command will result in different values.
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 08 Jun 2010, 10:53:56
EDIT : simplified the post(i am still not good at English)
this following line is in the main script,

Code: [Select]
{[zombie,_x] spawn FleeFunction;} foreach victimarray;
and each zombie is spawning that function.
If there's 8 zombies, and 9 victims.
72 instances of the function will be produce.
(each victim gets their own 8 instances each have different zombies)

flee.sqf(fleefunction)
Code: [Select]
_zom=_this select 0;
_vic=_this select 1;
fleeing things
To avoid the function being being spawned 72 times (in this case)
It should only spawn for the number of victims. (9 times in this case)
So i must add each zombies into an array (probably a global variable,eg . H_Zombies_Array=[zombies] )
And i must find another place to execute the function.(not the main script)

I am stuck with how to do that...  :confused:

I think i've been asking too many help from the forums (sorry this is my first sqf script so I still need to learn a lot of things,especially making it mp compatible)

Thanks for reading,
Haroon1992
Title: Re: Haroon1992's Zombie Script
Post by: Mandoble on 08 Jun 2010, 11:33:23
Yes, creating a global array of zombies would be a way better solution, so each victim uses this array to determine where to flee. BTW, not sure which criteria you are using, but basically the victim:
1 - Must has some level of knowledge about a zombie in order to flee from it (knowsabout).
2 - Must be able to flee from any zombie, not only from these attacking the victim. That is, if the victim knows the location of 3 zombies and one of them is attacking him, the victim should not flee in the directions where the other two zombies are. But also, if a zombie is attacking the victim, and while the victim runs away, the victim locates another zombie (not attacking him) even closer than the attacking one, the victim should be fleeing from both.
3 - Not sure if already implemented, but the victim might also flee towards there were there are other friendlies that are not fleeing. This might result as a natural movement, if a person is in danger he tries to flee towards another known and friendly person that can support him and that is not in danger too. For example, a unarmed civilian would try to flee to get closer from a group of friendly armed civilians as long as these civilians are not being attacked too.
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 08 Jun 2010, 12:00:54
Yes, you suggestion was a great one.
But i think i need something (like a function) to make them flee like you've said.
I heard CSL has a function that performs like this :
pass three positions ,return the position 100m from each of that three positions.
maybe that would come it handy( though i need to modify it a bit).

As of yet, the victims are fleeing from the nearest zombies.
(They just flee to about 8 m infront of the zombie,but as there is minimum delay and not waituntils if the victim encounters another zombie in the direction he is fleeing he immediately flees to 8m towards of that zombie again.)
That is Unrealistic...!
I'm gonna do what you've said after i fixed the several functions running problem.

Thanks for your advices mandoble!  :clap:
Regards,
Haroon1992
Title: Re: Haroon1992's Zombie Script
Post by: Mandoble on 09 Jun 2010, 01:47:42
For the victims, you can use the method of "most comfortable area".
Lets suppose the fleeing victim can move only in 8 directions when fleeing away (N, NE, E, ...).
You need to calculate the "comfortable" number for each for these positions which might be 20m to the N, 20m to the NE, 20m to the E, etc.
To calculate that comfortable numer for each position to get the array of known zombies (these with a knowsabout > 0.1 for example) closer than 40m to the victim, and for each position its comfortable factor is the sum of the distances of all these zombies to the corresponding fleeing position plus the current one. Then, the optimum position is that with the greatest number. At the end, you have 9 position (the current one + 8 ) and you have the safest one. Of course, you can also substract instead of add, the distances to known friendly units that might help the fleeing one to have as result a more equilibrated best position. You can run this every 10 seconds for every potential victim.
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 09 Jun 2010, 18:19:25
The new version is up!
No more extra instances!   :angel:

Quote
For the victims, you can use the method of "most comfortable area".
I think i quite don't understand what you meant.

I've written something like this and result is sometimes better and sometimes even worse!

private [ALL local variables];

//NOTE : Unnecessary parts are cut off.

_posy_check=[];
_fleeing_dis=20;
_dy=0;
_posy_selected=FALSE;

_posy=[(getpos _har_zombie select 0) + (_fleeing_dis * sin (getdir _har_zombie) - _dy * cos(getdir _har_zombie)), (getpos _har_zombie select 1) + (_fleeing_dis * cos (getdir _har_zombie) + _dy * sin(getdir _har_zombie)),0];

_posy_check=nearestObjects [_posy,["MAN"],40];
_har_zombie=[_har_victim,Hz_Zombie_Array,Hz_Hunt_Distance] call Hz_NearestToObject;
//Hz_Hunt_Distance is the hunting distance ,in the test,it was 100m
//value=[object,array] call Function, returns the element nearest to object.(element must be within defined //distance
while {! _posy_selected} do
{
   {
      while {_x distance _posy < 15} do
             {
         _posy=[(getpos _x select 0) + (_fleeing_dis * sin (getdir _x) - _dy * cos(getdir _x)), (getpos _x select 1) + (_fleeing_dis * cos (getdir _x) + _dy * sin(getdir _x)),0];
          sleep 0.05;
         };   
   }foreach _posy_check;
   sleep 0.05;
};
_har_victim move _posy;
//other stuffs

//_har_zombie is the current nearest zombie (It is update every approx. 1 second.)
Title: Re: Haroon1992's Zombie Script
Post by: Mandoble on 09 Jun 2010, 22:41:23
Happyness fleeing position checks

Code: [Select]
private["_victim", "_known_zombies", "_fleeing_positions", "_pos", "_max_happyness", "_best_fleeing", "_happyness"];

_victim = v1;
zombie_array = [z1, z2, z3];

while {alive _victim} do
{
   // First we get the array of zombies known by the potential victim
   _known_zombies = [];
   {
      if (((_victim knowsAbout _x) > 0) && (alive _x)) then
      {
         _known_zombies = _known_zombies + [_x];
      };
   } forEach zombie_array;


   // Now, if there are any known zombies
   if (count _known_zombies > 0) then
   {

      // 9 possible fleeing positions [current one, current one + 20m N, current one + 20m NE, etc]
      _fleeing_positions = [];
      _fleeing_positions = _fleeing_positions + [getPos _victim];
      {
         _pos = [(getPos _victim select 0) + (sin _x)*20, (getPos _victim select 1) + (cos _x)*20];
         _fleeing_positions = _fleeing_positions + [_pos];   
      } forEach [0, 45, 90, 135, 180, 225, 270, 315];

      // Now we get the position that gives more happyness to the victim (max distance to all known zombies)
      _max_happyness = 0;
      _best_fleeing = 0;
      for [{_i=0},{_i<9},{_i=_i+1}] do
      {
         _happyness = 0;
         {
            _happyness = _happyness + ((_fleeing_positions select _i) distance _x);
         } forEach _known_zombies;
 
         if (_happyness > _max_happyness) then
         {
            _best_fleeing = _i;
            _max_happyness = _happyness;
         };
      };

      if (_best_fleeing != 0) then
      {
         // If the best fleeing position is not the current one, the potential victim moves there
         _victim doMove (_fleeing_positions select _best_fleeing);
      };
   };

   Sleep 5;
};
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 10 Jun 2010, 06:50:03
The problem of the victim's sometimes not fleeing is FIXED.  :D
(It was caused by some variable errors)
The victims now flee smartly and in a more realistic way.
(I am also trying to make the positions around which have ally units to be the highest priority,
but there is problem,all victims are fleeing,so they might end up domoving to each other)

Now i have another problems
(In order to practically observe the problems, I've attached an example mission)  :yes:

I was trying to use the "KILLED" eventhandler instead of checking the zombie's damage in the script which produce a dying sound when the zombie's dead.
So, i disabled the original dead checking script and used my new script.

How I added the killed eventhandler(in the main script) :
Code: [Select]
_h_diezombie = ["nombiedies01","nombiedies02"];
_h_zom addEventHandler ["KILLED",{_this=_this+[_h_diezombie];nil=_this spawn Hz_Zombie_Killed}];


h_zombie_killed.sqf (launched by KILLED eventhandler)

Code: [Select]
//keeps the score up for the shooter
//so that he would not be considered renegade.
private ["_helihthing","_deadsounds","_killer","_man","_rand_deadsounds"];


_man = _this select 0;
_killer = _this select 1;
_deadsounds=_this select 2;//meant to be an array!
sleep 0.05;

_helihthing="HeliHEmpty" createvehicle position _man;
_helihthing setpos getpos _man;
_rand_deadsounds = _deadsounds select (floor random (count _deadsounds));

_helihthing say _rand_dead_sound;
sleep 0.05;
deletevehicle _helihthing;

if (_killer==_man) exitWith {};
if (not(_killer in Hz_Global_Victim_Array)) exitWith {};

_killer addRating 600;
//hint format ["%1\n%2",rating _killer,_rand_dead_sound];

Problem :
No sounds are played and when i hint formatted _deadsounds, if showed "any"
I also tried setting the _deadsounds like this in this script :
_deadsounds=["nombiedies01","nombiedies02"];
So i don't need to pass the array from the main script,but even that still didn't work.

And here's the original one i used for the dying sounds.
h_zombie_dead.sqf(original script)
This script is working perfectly,but I want to combine the dying sound with the scoring to minimize the
amount of script(i thought this might squeeze performance a bit in large scale missions)
Code: [Select]
//This script is part of Haroon's Zombie Script Pack
private ["_rand_zdead_sound","_helihthing","_zd","_helihthing"];
_zd=_this select 0;

waitUntil {not (alive _zd)};
_helihthing="HeliHEmpty" createvehicle position _zd;
_helihthing setpos getpos _zd;
_rand_zdead_sound = round random 3;
if(_rand_zdead_sound < 1.5) then
{
_heliHthing say "nombiedies01";
0 fadesound 0.8;
sleep 1;
15 fadesound 1;
}else
{
  _heliHthing say "nombiedies02";
  0 fadesound 0.8;
  sleep 1;
  15 fadesound 1;
  };
sleep 1;
deletevehicle _helihthing;

//script info
//makes the zombies shout when they dies.

The shooting script problem :
I've edited the shooting script so ,victims inside cars that can fire will fire at the zombies.
(for example, victim in a jeep with machine gun will shoot the zombies with it)
But they only target the zombies and stay like that until i shot their heads,why?
for additional info here's the actual script :

Code: [Select]
private ["_wcount","_i","_shoot_range","_h_victim","_h_zom","_behave","_speedm","_combat"];
//Count instances of this function
hz_num_shfunc=hz_num_shfunc + 1;
//INFO :
//This script makes victim who have Weapons engage the zombies.
//NOTE : The victims engage ALL zombies.And they shoot the zombie
//when its inside the specified radius.(See _shoot_range)

_h_victim=_this select 0;

_h_zom="";
_wcount=0;
_behave=behaviour _h_victim;
_combat=combatMode _h_victim;
_speedm=speedMode _h_victim;
//oooooooooooooooooooooooooooooooooooooooooooo
//CUSTOMIZABLE
//Set your desired shooting range for the Victims with weapons.
//(default value : Around 100 meters)

_shoot_range = 90 + round random 20;
//oooooooooooooooooooooooooooooooooooooooooooo


if (_h_victim==player) exitWIth {};
for [{_i=0},{_i<1},{_i=_i}] do
{
while {! Hz_Shoot}do
{
_wcount=_wcount+1;
sleep 1;
if (_wcount==500) exitWith {};
};
_wcount=0;
sleep 1;
if (not (alive _h_victim)) exitWith {hz_num_shfunc=hz_num_shfunc - 1};

if (Hz_Shoot) then
{
_h_zom=[_h_victim,Hz_Zombie_Array,Hz_Hunt_Distance] call Hz_Func_Nearesttoobject;
if ( primaryWeapon _h_victim != "" OR secondaryWeapon _h_victim != "" )then
{
if (alive _h_zom) then
{
if (speed _h_victim < 10) then
{
//Check knowsabout and hz_shoot(again)

if (Hz_Shoot AND _h_victim knowsAbout _h_zom > 0) then
{
if (vehicle _h_victim == _h_victim) then
{
_h_victim dotarget _h_zom;
sleep 2;
_h_victim dofire _h_zom;
sleep 2;
}
else
{
if (_h_victim==gunner vehicle _h_victim AND canfire vehicle _h_victim) then
{
_h_victim dotarget _h_zom;
sleep 4;
_h_victim dofire _h_zom;
sleep 2;
};
};
  };
};
};//if (alive _h_zom)
};//if (primary...)
};//if (hz_shoot)
};//for do


There are also other problems i'm facing now
(it seems like I was born to try solving problems and to spam the forums asking about problems :D  )

1. array1=[1,2,4], and how do i add [3] to the array so that i becomes array1=[1,2,3,4]
(how do i add an elements to the array's inner rooms,not the first or last rooms)

2. I checked a local variable _var 's type name with the following command,but failed ,why?
if (typeName _var=="ARRAY") then {hint "it is an array"};

Regards,
Haroon1992


Title: Re: Haroon1992's Zombie Script
Post by: Mandoble on 12 Jun 2010, 19:45:52
Code: [Select]
_h_diezombie = ["nombiedies01","nombiedies02"];
_h_zom addEventHandler ["KILLED",{_this=_this+[_h_diezombie];nil=_this spawn Hz_Zombie_Killed}];

_h_diezombie is a local var, when the event is trigger it will not be able to resolve its value.

Code: [Select]
_h_zom addEventHandler ["KILLED",{_this spawn Hz_Zombie_Killed}];

Code: [Select]
//keeps the score up for the shooter
//so that he would not be considered renegade.
private ["_helihthing","_deadsounds","_killer","_man","_rand_deadsounds"];


_man = _this select 0;
_killer = _this select 1;
_deadsounds= ["nombiedies01","nombiedies02"];
sleep 0.05;
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 13 Jun 2010, 16:56:51
The scirpt didn't work(no sounds are played,that's the only problem,other things working fine) even if i put _deadsounds=["nombiedies01","nombiedies02"]
as you've showed in your last Code :

I changed the eventhandler event line too as you said in your second Code:

Any ideas why I can't play sounds via a killed eventhandler?

To other guys :  Are you guys too much disappointed by my scirpt to give feedback?


Regards,
Haroon1992
Title: Re: Haroon1992's Zombie Script
Post by: Mandoble on 13 Jun 2010, 17:14:59
First, is your hint displaying at least correct data now?

And then, Killed is a local EH, and Say command has local effects only (BTW, better use Say3D command instead of say). That means that if your zombie is local to the server, the Killed EH will be executed only server side, and only the server will hear the say or say3D sound. To overcome that problem you may use:
Code: [Select]
_saycommand = format["this say3D (my_global_zombie_sounds select %1)", floor random (count my_global_zombie_sounds)];
_helihthing setVehicleInit _saycommand;
processInitCommands;
sleep 4;
deletevehicle _helihthing;
if (_killer==_man) exitWith {};
if (not(_killer in Hz_Global_Victim_Array)) exitWith {};

_killer addRating 600;
//hint format ["%1\n%2",rating _killer,_rand_dead_sound];

Also in your original code you have:
Code: [Select]
_helihthing say _rand_dead_sound;
sleep 0.05;
deletevehicle _helihthing;

That means that as soon as the heli object starts saying the sound, it is deleted and you will not hear any sound (sleep 0.05).
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 13 Jun 2010, 17:26:55
Oh....!
What the hell happened to my eyes?
I never realized that i've put sleep 0.05 and that will delete the thing!
(noob scriptor doing noob things!)

I need to learn much about the multiplayer scripting ( and i know only a few will use my script if it's not MP Compatible!)

If you could explain me about the following on what they does and why we have to do it like this ,
it would be a knowledge for me on this particular subject.

Quote
_saycommand = format["this say3D (my_global_zombie_sounds select %1)", floor random (count my_global_zombie_sounds)];
_helihthing setVehicleInit _saycommand;
processInitCommands;

Any ideas on that gunner not firing problem,why is he only engaging the zombie?
(the script for that is already quoted in my second last post)


Regards,
Haroon1992
Title: Re: Haroon1992's Zombie Script
Post by: Mandoble on 13 Jun 2010, 18:28:31
setVehicleInit (http://www.ofpec.com/COMREF/index.php?action=details&id=758&game=All)
processInitCommands (http://www.ofpec.com/COMREF/index.php?action=details&id=686&game=All)
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 17 Jun 2010, 16:45:34
Well,I am taking a break from the zombie script.
Meanwhile,I am learning multiplayer scripting.

Is there something like an example mission to demonstrate the fundamental scripting AND/OR complex scripting things in MP?

Code: [Select]
_man1=_this select 0;
_man2=_this select 1;

_man1 setVariable ["Arrived",FALSE];

_man1 domove getpos _man2;
waitUntil {_man1 distance _man2 < 15};

_man1 setVariable ["Arrived",TRUE];

if that variable's value transmitted globally to all clients?
Or is there any necessary thing to add?
(by the way,that's just an example)

I checked the OFPEC Multiplayer Mission Editing tutorial..
but I still quite not understand about it.
(maybe i don't have the required IQ to understand it  :D  )

And another thing is
how can i keep a random value fixed over all client.

_randy=random 10
suppose _randy is 5.93,how do i make so that it's value is 5.93 in all clients?
Or is the question i am asking correct?

I am also having trouble determining what type of script/functions are to be executed by the Server and which by the clients.

Regards,
Haroon1992
Title: Re: Haroon1992's Zombie Script
Post by: Mandoble on 17 Jun 2010, 17:46:34
With A2 setVariable has a third parameter, and it you set it to true, the value is broadcasted. But, might be it is not broadcasted to clients that join the game later.

veh setVariable ["var1", 12345, true];

PublicVariable can also be used for globals.
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 16 Aug 2010, 17:27:13

Finally, I got my hands back on one of my most complex projects....

namely, the crappy zombie simulation  :D

I am currently a bit busy my father's business and I have little to SCRIPT..

So I have no time to fully test my SCRIPTS (that is test for about an hour ,etc)

So I need help in testing possible errors of my script
(especially errors that might come when used for more than 30 minutes etc)

I hope there are people willing to help me in this...


New Version is : 0.9
Whats New in New Version ?

+
Advanced Victim fleeing(victims now acts smart and flee to the most suitable direction when there are multiple zombies near him
and
thanks to Mandoble for that!!!  :clap:

+
Many other fixes and improvements such as better response to victims etc.




Regards,
Haroon1992
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 28 Aug 2010, 16:21:16

Hi guys.....
Although i didn't get any feedbacks for my last post.
I manage to fix the problems myself.
Now its version 1.0!
And I changed the name from Cuztomizable Zombie Script to "Customizable Zombie Simulation"

My intention is to provide the community with an addon-free zombie simulation that can be customized by to user to their taste.

This version is not the public release but for beta testing only!
(I named it version 1.0 but its still in beta stage as no body has reported that the simulation is working fine.)

I hope you guys give back feedback this time.

The BIG thing left to do is to make this MP-Compatible, at which I sucks. :(

But I am confident that I will make it.Maybe in the following week.
(The problem is that i have never script for MP before and this thing is just too complicated for me to convert to MP)

INSTALLATION :


Put the folder CZS_Example.utes into your missions folder( which probably exists in My Documents\ArmA 2)


CHANGELOG  :

Code: [Select]
v1.0 (THIS VERSION!)


Fixed :

- Animals are also becoming zombies due to wrong classname check.
- Zombies getting stuck when near a dead victim who is inside a vehicle.
- Replaced nil with _nul/_dump for executing the scripts.
(Thanks to OFPEC thread for the correct usage of nil)


v0.9

Fixed :

- Zombies become idle after eating a victim.
- Vehicle gunners not engaging zombies.
- Sound was not played when a zombie dies.(Zombies were dying silently.)
- Sound was not played when a zombie is hit.
- Performance issues and possible looping problems.

Improvements :

- Victim Fleeing Script
(now have seperate fleeing distances, for infantry and for vehicles)
- Victim Shooting Script
(a victim at the gunner position of an armed light vehicle will fully engage the zombies)
- Global Variables concerning about "animations and sounds of victims and zombies" are now in the "h_init.sqf",so one can simply edit them in one place instead of going through multiple scripts to edit
- Brief info about what a script does, at the start of that script, as comments.

New Stuffs :

- Scoring System
(The score depends on the type of zombie and there are five types of zombies)
- Variable for Scoring System : hz_ShowScore
(When TRUE, will show:
type of zombie killed,score gained and current score of player victims as HINT
when a zombie is killed by a player victim.)


KNOWN ISSUES :

- Some zombies take some time before they attack a victim.
- Sometimes the zombies were scracthing (attacking) to wrong directions.
Title: Re: Haroon1992's Zombie Script
Post by: haroon1992 on 30 Sep 2010, 16:47:25
This thread should be closed.
I am starting a new thread with the new name.


Regards,
Haroon1992