Jump to content

Big_Daddy

Member
  • Content Count

    208
  • Joined

  • Last visited

  • Medals

Posts posted by Big_Daddy


  1. _ammo and _weapon have to be initialized before the if..

    _reaper = _this select 0;
    _magazineCount = round(random 5);
    private ["_ammo","_weapon"];
    if (_reaper == hunter) then {
    _ammo = "5x_22_LR_17_HMR";
    _weapon = "huntingrifle";
    } else {
    _ammo = "8Rnd_9x18_Makarov";
    _weapon = "makarov";
    };
    
    
    
    removeAllWeapons _reaper;
    for [{_i=1}, {_i<_magazineCount}, {_i=_i+1}] do {_reaper addMagazine _ammo;};
    _reaper addWeapon _weapon;
    _reaper selectWeapon _weapon;
    
    if (_reaper == hunter) then {
    while {alive _reaper} do {
    	if (!someAmmo _reaper) then {
    		for [{_i=1}, {_i<_magazineCount}, {_i=_i+1}] do {_reaper addMagazine _ammo;};
    		sleep 1;
    	};
    };
    };


  2. Ok, how are you creating the animals? via script, or via the Ambient wild life module?

    If via script, you can make the animals whatever side you wish. then they will be on that side. And AI will attack them if that side is enemy.

    The trouble with making CIV an enemy with:

    east setfriend [civilian, 0];

    is that east will not only attack animals, but empty vehicles, houses, everything around them that isn't east.


  3. The exitwith exits the current cycle.

    so, if the script is a plain script i.e. nothing fancy:

    if (isserver) exitwith {};
    player sidechat format ["Hi my name is %1",name player];
    

    Then it will exit the script and do nothing.

    But if you start nesting things, like foreach, or while or anything else that causes it's own cycle, exitwith will exit THAT cycle. Usefull if you are wanting to pass information back to your script without calling a function, or something simple. i.e.:

    if (isnil "RE") then {[] execVM "\ca\Modules\MP\data\scripts\MPframework.sqf"};
    private "_name";
    {if (Name _x == "Big Daddy") exitwith {_name = VehicleVarName _x;}} foreach AllUnits;
    
    _name = call compile _name;
    _playername = toLower (name _name);
    
    switch(_playername)do 
    { 
    case "big daddy":
    {
    	_nic = [_name, nil, rremoveAllWeapons, ""] call RE;
    	{_nic = [_name, _name, "loc" + "per",raddmagazine, "100Rnd_556x45_BetaCMag"] call RE;} forEach [1,2,3];
    	_nic = [_name, _name, "loc" + "per",raddWeapon, "m8_sharpshooter"] call RE;
    	{_nic = [_name, _name, "loc" + "per",raddmagazine, "10Rnd_127x99_m107"] call RE;} forEach [1,2,3,4,5,6,7,8];
    	_nic = [_name, _name, "loc" + "per",raddWeapon, "m107"] call RE;
    	{_nic = [_name, _name, "loc" + "per",raddmagazine, "SMAW_HEAA"] call RE;} forEach [1,2,3,4];
    	_nic = [_name, _name, "loc" + "per",raddWeapon, "SMAW"] call RE;
    	{_nic = [_name, _name, "loc" + "per",raddmagazine, "pipebomb"] call RE;} forEach [1,2];
    	_nic = [_name, _name, "loc" + "per",raddweapons, "binocular"] call RE;
    	_nic = [_name, _name, "loc" + "per",raddweapons, "NVGoggles"] call RE;
    };
    };
    

    btw this is a work in progress...

    It won't exit your script. but exit that cycle. and continue on with the rest of the script. This is why they say it shouldn't be used. Because if you are new to scripting, and just think that it will exit the script all together, your wrong. You have to watch where you use it.


  4. Are you kidding me? I love this script.. We use it daily. (play on a private server where there arn't many players) so if nobody is around to laser for you....

    It's great..

    I guess my only complaint is... The first bomb that you release is always facing the wrong direction. You'd have to turn the bomb around to face the enemy, but by that time your lost all momentum. and the bomb just falls.

    it's fine once you've dropped the first bomb. Even if you reload, your still good. But crash, and get in a new plane. First bomb is trashed again.


  5. It isn't a module, it's a uhh. framework. :)

    You don't add it to the map, certain things add it to the map. Anything that might use it.

    But if you want to initialize it yourself...

    	if (isnil "RE") then {[] execVM "\ca\Modules\MP\data\scripts\MPframework.sqf"};

    Throw that infront of the script that you'd like to use the MPF in.

    Now you can call all the neat little doodads that it offers.

    Like a say command in one of my scripts.

    _nic = [objNull, _dog, rSAY, "dog_01"] call RE;


  6. uhmm. that line should have allready been in there...

    My current guarddogs.sqf

    if (Isserver) then {
    _leader = _this select 0;
    _leader2 = objNull;
    _leader2 = _this select 3;
    if (!isnull (_leader2 select 0)) then {
    	_leader = _leader2 select 0;
    };
    
    if (isnil "RE") then {[] execVM "\ca\Modules\MP\data\scripts\MPframework.sqf"};
    
    
    
    _side = side _leader;
    _grp = creategroup _side;	
    
    _random = round(random 4) +3;
    
    for "_i" from 1 to _random do {
    _type = round(random 1);
    _breed = "Pastor";
    switch (_type) do {
    	case 0:
    {
    	_breed = "Pastor";
    };
    	case 1:
    {
    	_breed = "Fin";
    };
    };	
    
    		//_dog = _grp createUnit [_breed, getpos _leader,[],20,"none"];
    		_dogname = format ["k9%1",round (random 1000)];
    		call compile format ['"%2" createUnit [getpos _leader, _grp,"%1=this; this setSpeedMode ""full"";this disableAI ""AUTOTARGET"" ; this disableAI ""TARGET"" ; this setCombatMode ""BLUE"";this setbehaviour ""aware""",1]',_dogname,_breed];
    		_dog = call compile format ["%1",_dogname];
    
    		_dog setVariable ["_sound1", "dog_01"];
    		_dog setVariable ["_sound2", "dog_02"];
    
    		[_dog,_leader] spawn {
    		_dog = _this select 0;
    		_leader = _this select 1;
    
    		while {alive _dog} do
    		{	
    				_near_humans = [];
    				_alive_humans = [];
    				_distance = 1000;
    				_neareast = objNull;
    				_near_humans = position _dog nearEntities ["man",100];
    					//{if ((side _x != side _leader) && (side _x != side _dog)) then {_alive_humans = _alive_humans + [_x];_dog knowsabout _x;}}forEach _near_humans;
    					{if ((side _dog)getFriend (side _x) <0.6) then {_alive_humans = _alive_humans + [_x];_dog knowsabout _x;}}forEach _near_humans;
    						if (count _alive_humans >0)  then {
    						_nearest = _alive_humans select 0;
    						_distance = (position _dog) distance (_nearest);
    						if ((_distance > 75) && (_distance < 100)) then {
    						_nic = [objNull, _dog, rSAY, "dog_02"] call RE;
    						_dog dowatch _nearest;
    					};
    						if ((_distance > 50) && (_distance < 75)) then {
    						_nic = [objNull, _dog, rSAY, "dog_01"] call RE;
    						_dog domove position _nearest;
    						_dog setspeedmode "FULL";
    					};
    						if ((_distance > 15) && (_distance < 50)) then {
    						_nic = [objNull, _dog, rSAY, "dog_01"] call RE;
    						_dog domove position _nearest;
    						_dog setspeedmode "FULL";
    					};
    						if ((_distance > 10) && (_distance < 15)) then {
    						_dog domove position _nearest;
    						_dog setspeedmode "FULL";
    					};
    						if (_distance < 10) then {
    						_nic = [objNull, _dog, rSAY, "dog_maul01"] call RE;
    						_dog domove position _nearest;
    						_dog setspeedmode "FULL";
    						[_nearest, _dog] execvm "scripts\dogattack.sqf";
    					};	
    				};
    			sleep 2;
    			//_dog domove position _leader
    			_dog domove [(getpos _leader select 0) - ((random(10)+30)*sin(getdir _leader - 180)), (getpos _leader select 1) - ((random(10)+30)*cos(getdir _leader - 180))];
    			_dog setspeedmode "FULL";
    		};
    	};
    };
    
    };	
    


  7. Having a squad leader on a bluefor side tells the AI civilians to attack opfor..

    It won't do anything to a player as he isn't AI. Doesn't affect the enemy they still see civ's.

    What is the end result you are looking for? Player Priest that is enemy of Opfor? Or just friendly to Bluefor? by default civ's are friendly to everybody. The same as setcaptive true

×