Jump to content

Rommel

Member
  • Content Count

    1225
  • Joined

  • Last visited

  • Medals

Posts posted by Rommel


  1. Hey all,

    I've been playing CWA a few times lately with some mates for nostalgic purposes; but for the life of us we could not find a download for the classic mission "Nogova Virus".

    This was pretty popular with the community, and if anyone has it, an upload to any file sharing site would be welcomed.

    edit: thanks to the community, here is an upload I found of all 4 missions: http://www.megafileupload.com/en/file/380560/coop-nogova-virus--all-4-missions--noe-zip.html

    edit2: they were found at this link to start with: http://www.usasquad.com/downloads/servermissions/


  2. @rommel

    Sorry for the newbness, when you say a loop or the player, how exactly would you implement that?

    Thanks

    *Argh my face*

    As I've been obligated to respond by a squad member; I must point you to sxp2high's response, which sums it up perfectly.

    Take a look at my files, I am also running a loop of course:

    while {true} do {
    sleep 10; // Autosave interval
    waitUntil {alive player};
    _saved = [] call btk_fnc_playerSave;
    };

    Would there be a way to also capture how many lives are left like the MSO does so when they re join they get the number of ,oives again untill reset or after 24 hours etc..?

    As sxp2high also mentioned, this is very simple to do with a few if statements and a tracked variable. What is a little more complex is doing this in an extensible, non-limiting way.

    Perhaps as inspiration, I'll give some insight on how nomad worked:

    if (isdedicated) exitwith {};
    
    waituntil {not isnull player};
    waituntil {!isMultiplayer || getplayeruid player != ""};
    
    [
    [
    	/*{deaths player} // handled by nomad */
    	{typeof player;},
    	{magazines player;},
    	{weapons player;},
    	{typeof (unitbackpack player);},
    	{getmagazinecargo (unitbackpack player);},
    	{getweaponcargo (unitbackpack player);},
    	{getposATL player;},
    	{damage player;},
    	{rating player;},
    	{score player;},
    	{viewdistance;},
    	{if(isnil "terraindetail")then{1;}else{terraindetail;};},
    	{getDir player;},
    	{rank player;}
    ],
    [
    	{
    		_dayspassed = 1 + time / 86400;
    		_maxLives = nomadRespawns * (nomadReinforcements * _dayspassed);
    		if (_this > _maxLives) then {_disconnect = true;};
    	},
    	{
    		if (typeof player != _this) then {_disconnect = true;};
    	},
    	{
    		{player removemagazine _x;} foreach (magazines player);
    		{player addmagazine _x;} foreach _this;
    	},
    	{
    		{player removeweapon _x;} foreach ((weapons player) + (items player));
    		{player addweapon _x;} foreach _this;
    		player selectweapon (primaryweapon player);
    	},
    	{
    		if (_this != "") then {
    			player addbackpack _this;
    			clearweaponcargo (unitbackpack player);
    			clearmagazinecargo (unitbackpack player);
    		};
    	},
    	{
    		for "_i" from 0 to ((count (_this select 0))-1) do {
    			(unitbackpack player) addmagazinecargo [(_this select 0) select _i,(_this select 1) select _i];
    		};
    	},
    	{
    		for "_i" from 0 to ((count (_this select 0))-1) do {
    			(unitbackpack player) addweaponcargo [(_this select 0) select _i,(_this select 1) select _i];
    		};
    	},
    	{player setposATL _this;},
    	{player setdamage _this;},
    	{player addrating (-(rating player) + _this);},
    	{player addscore (-(score player) + _this);},
    	{setviewdistance _this;},
    	{
    		setterraingrid ((-10 * _this + 50) max 1);
    		terraindetail = _this;
    	},
    	{player setdir _this;},
    	{player setunitrank _this;}
    ]
    ] call rmm_nomad_start; 

    Now, what should be apparent, is that this massive parameter list, is actually making use of the fact code can be data in SQF (a very powerful feature indeed!); and I have essentially passed in several lambdas which act as 'getters' and 'setters'.

    The 'getters' are the first array of functions, which must return some value.

    The return value from these functions are then stored in the player state.

    Upon re-connect, the second array (the `setters`) of first class functions are then called using those saved values as parameter `_this`, and the state restored based on the heuristics in those functions.

    Example?

    [
    [
    	/*{deaths player} // handled by nomad */
    	{getposATL player;},
    ],
    [
    	{}, // do nothing
    	{player setposATL _this;}
    ]
    ] call rmm_nomad_start; 

    This does the simplest functionality possible, it 'gets' the players position every update, then sets it upon re-connection.

    This design works great for mission makers who want full control over what happens where; and don't want to worry about the funky ArmA 2 network issues.

    I agree it is a code smell that nomad handles the special case for player respawn/deaths, and if you noticed it, there was also variable `_disconnect` injected into the major example above which can be used to force the player to be disconnected.

    Hope that helps.

    PS. As for the player not wanting their old data? Simple solution: Escape -> Respawn.


  3. I wrote a variant on this for my old 'MSO' several years ago, as 'Nomad', despite claims (like the above), the script itself is lightweight and uses as much traffic (if not less) as any network synchronous script in ACE or any other mod which does anything complicated.

    The traffic itself is controlled by how often the loop is run (1 second is perfectly fine, but if your really worried, >10).

    If you want to make it a bit more fancy, use a random sleep so that all players aren't synchronously all broadcasting their updates. However, this has been tested with upwards of 30 players on a low end connection and is not a real concern.

    The functionality as it was originally implemented is simple.

    A player maintains the following in a loop:

    _saveStatus = [_name, _position, _direction, _animationChecked, _damage];
    _saveGear = [_magazines, _items, _weapons, _backpack, _backpackWeapons, _backpackMagazines, _weaponOnBack, _currentMuzzle];
    
    _string1 = format ["%1_status", getPlayerUID player];
    _string2 = format ["%1_gear", getPlayerUID player];
    missionNamespace setVariable [_string1, _saveStatus];
    missionNamespace setVariable [_string2, _saveGear];
    publicVariable _string1;
    publicVariable _string2;
    

    Add a script which when the players starts playing (throw it in init.sqf) that checks for this variable, and if it exists, it runs a set of code which restores the players state from the above variables.

    Such as:

    _status = missionNamespace getVariable _string1;
    if (!isnil "_status") then {
        player setpos (_status select 1);
        player setdir (_status select 2);
        // etc
    };
    

    Simple. Not scary. Super easy. Not really necessary as an addon.


  4. This is something I use occasionally, its not perfect, but should give you an idea on how you could do it.

    rmm_action = player addaction ["Get weapon from back", CBA_fnc_actionArgument_path, [0, {_wob = secondaryWeapon player; if (_wob == "") then { _wob = player getvariable "RMM_WeaponOnBack"; player setvariable ["RMM_WeaponOnBack", ""]; player addweapon _wob; }; if (_wob == "") exitwith {}; player selectweapon _wob; }, false]];
    


  5. Hey guys,

    Sorry to bring up an old thread, but I've been fiddling with Object compositions and I've just run into a slight problem. I'm making it so on a certain vehicle, when you click the action 'Deploy FOB', the composition "Small Base" is built around the stryker.

    Now, I've got it to work perfectly with the stryker and have the composition built in the direction the stryker is facing, rather than the world's direction.

    The stryker is called "HQStry" and in init field;

    this addAction ["Deploy Base", "spawnfob.sqf"];

    spawnfob.sqf is;

    _d = getDir HQstry;
    _newObjs = [getPos HQstry, _d, "smallbase"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));

    Now the above works, there's no problems there. It's just when I make another one, say for a heli, and call it spawnheli and change HQstry to HQhawk. When I do that, follow everything exactly, it doesn't work. Does anyone know why? I'll give you the example;

    The blackhawk is called "HQhawk" and in init field;

    this addAction ["Deploy HeliBase", "spawnheli.sqf"];

    spawnheli.sqf is;

    _d = getDir HQhawk
    _newObj = [getPos HQhawk, _d, "heli_park_us1"] call (compile (preprocessFileLineNumbers "ca\modules\dyno\data\scripts\objectMapper.sqf"));

    Any idea why that wouldn't work the same as it does for the stryker?

    Assuming you have done *everything* you have said you have done; and correctly. My guess its the missing semi-colon after

    _d = getDir HQhawk

    Script errors enabled?


  6. Server: Object 5:0 not found (message 121)
    Cause: ?
    Solution: ?
    When this occurs it can be duplicated anything from a small number of entries to hundreds of times
    The object reference number and message number often changes
    

    The cause for this was quite commonly from throwing grenades, rockets, or anything that appears to be created on a fired event then deleted shortly after.

    Occurs also with createVehicleLocal objects that are forced global IIRC; maybe inter-related incidents.

    Solution? Don't play? :P; none known.


  7. South of where?

    A friend of mine is in Nagoya and they had no damage in the bay there, and my brother was in Kobe (he returned home today, though not because of the earthquake, but because he finished his school year and was supposed to come home today anyways) and there was no damage in Osaka or Kobe along the inland sea. His host brother lives in Okinawa and they had no tsunami there.

    You make it sound as if the whole thing is one big conspiracy, and the media is all lying to us.


  8. I'm not exactly wanting to dig up an old thread, but well I'm interested in the answer to a question.

    If theres a 15bit (32,767) max number of vertices, how many are actually drawn in the engine at any one time? Or is purely a per model constant... yet you mention DirectX?

    edit: 8bit... lol, I mean 15bit


  9. The respawn code works everytime for me.

    team_fnc_respawn = {
    _rsp = false;
    {
    	if ( (alive _x) && !(surfaceIsWater (getpos _x)) && (speed _x < 20) ) then {
    		if (vehicle _x == _x) then {
    			player setpos (_x modeltoworld [0,-2,0]);
    			_rsp = true;
    		} else {
    			player moveincargo (vehicle _x);
    			if (vehicle player != player) then {
    				_rsp = true;
    			};
    		};
    	};
    	if (_rsp) exitwith {};
    } foreach (units player);
    };
    
    player addeventhandler ["respawn", team_fnc_respawn];


  10. Then again, technically, if all the random data is seeded the same on all clients, and the physics engine reacts exactly the same on all clients you can get away with assuming a lot of things are the same on all clients. In practice that is a lot harder.

    Surely you could allow for the synchronization of some things? ArmA 2 doesn't perfectly synchronize anything outside of the players view distance, go on to a MP server and the discrepancies between clients can be several hundred meters with fast moving vehicles.


  11. That doesn't really make sense, assuming the player has inherited the event handler properly.

    Maybe put in a

    player globalchat "ran script"

    In the event code (ie before the foreach).

    That way you know if the script runs, and we can determine if its a problem with the code I gave you, or something on your end (ie you haven't set the respawn to BASE, or BIS aren't inheriting some of the newer EHs...

×