Jump to content

UNN

Member
  • Content Count

    1767
  • Joined

  • Last visited

  • Medals

  • Medals

Everything posted by UNN

  1. Well the cargo system will soon be ready for beta testing.
  2. As Dr_Eyeball said the parameters passed to the get in and out events tell you what position is being used. But I'm sure XEH will pass those parameters by default, but there may be some quirks with additional turrets? I haven't looked. There are two ways, either using user actions defined in an addons configs or managing them with scripts. Scripts are much more complex, first you have to grab all the relevant info. Turret hierarchy, Position selection name e.t.c Then use commands like selectionPosition, modelToWorld and distance e.tc. To decide if you want to display actions.
  3. Like I said in another thread, reduce the problem to something easier to handle. For example get this working first: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0; _weapon = _this select 1; _muzzle = _this select 2; _mode = _this select 3; _ammo = _this select 4; _AlertRadius=-1; _number=-1; _RandomFactor=-1; Player SideChat Format ["Weapon %1 Muzzle %2 Mode %3 Ammo %4",_Weapon,_Muzzle,_Mode,_Ammo]; ArraySilencedWeap=["M4A1SD","MP5SD","M9SD","AKS74UN","MakarovSD"]; ArraySilencedWeapFactor=[0.5,0.05,0.7,0.5,0.6]; ArraySilencedAmmo=["B_556x45_SD","B_9x19_SD","B_545x39_SD","B_9x18_SD"]; if !(_weapon in ArraySilencedWeap) then     {     _AlertRadius = 500;     _RandomFactor=1;     }     Else     {     If (_ammo in ArraySilencedAmmo) Then         {         _AlertRadius = 15;         _number = ArraySilencedWeap find format ["%1",_weapon];         _RandomFactor = ArraySilencedWeapFactor select _number;         }         Else         {         _AlertRadius = 70;         _number = ArraySilencedWeap find format ["%1",_weapon];         _RandomFactor = (ArraySilencedWeapFactor select _number) + 0.2;         };     }; Player SideChat Format ["AlertRadius %1 number %2 RandomFactor %3",_AlertRadius,_number,_RandomFactor]; Once you're are happy that everything is working as expected, add the next bit: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0; _weapon = _this select 1; _muzzle = _this select 2; _mode = _this select 3; _ammo = _this select 4; _AlertRadius=-1; _number=-1; _RandomFactor=-1; Player SideChat Format ["Weapon %1 Muzzle %2 Mode %3 Ammo %4",_Weapon,_Muzzle,_Mode,_Ammo]; ArraySilencedWeap=["M4A1SD","MP5SD","M9SD","AKS74UN","MakarovSD"]; ArraySilencedWeapFactor=[0.5,0.05,0.7,0.5,0.6]; ArraySilencedAmmo=["B_556x45_SD","B_9x19_SD","B_545x39_SD","B_9x18_SD"]; if !(_weapon in ArraySilencedWeap) then     {     _AlertRadius = 500;     _RandomFactor=1;     }     Else     {     If (_ammo in ArraySilencedAmmo) Then         {         _AlertRadius = 15;         _number = ArraySilencedWeap find format ["%1",_weapon];         _RandomFactor = ArraySilencedWeapFactor select _number;        }        Else        {        _AlertRadius = 70;        _number = ArraySilencedWeap find format ["%1",_weapon];        _RandomFactor = (ArraySilencedWeapFactor select _number) + 0.2;         };     }; Player SideChat Format ["AlertRadius %1 number %2 RandomFactor %3",_AlertRadius,_number,_RandomFactor]; _nearEnemies = position _unit nearObjects ["SoldierEB", _AlertRadius]; _cluelessEnemies = []; _otherEnemies = list OPFOR - _nearEnemies; { _x setBehaviour "SAFE"; _x setTargetAge "120 MIN"; } forEach _otherEnemies; { _distance = _x distance _unit; _Factor0 = 10*_RandomFactor + 1; _RandomFactor3 = _Factor0 - _distance _RandomFactor2 = 1 /_RandomFactor3; _Randomized = ceil (random _RandomFactor2); } forEach _nearEnemies; Player SideChat Format ["nearEnemies %1 otherEnemies %2",_nearEnemies,_otherEnemies]; Once that’s working ok, add the rest of your If statements into the nearenemies foreach loop. From the error you mentioned you're probably missing, or have an extra curly bracket in them. Edit: Removed a pointless bit of code from the example.
  4. UNN

    typeOf in array?

    To be honest, it's almost imossible for me to say. Apart from the fact you're using a mixture of sqs and sqf format commands in the same script. I can't see anything in the code you posted, that relates to creating pilots? Perhaps if you explained exactly what you want to do and how you want to do it. But the best thing to do when you hit problems, is reduce your script to it's simplest form. Then once you have a basic version working, start adding the extras.
  5. Yeah, it's a pain the forum code won't support tabs. I usually do a search and replace on my code with notepad, swapping each of the tabs for eight spaces. That error is caused by trying to select an array element that does not exist. Double check the results of your Find commands with sidechats, stored in the _number variable. Your code looks ok, you’re checking to see if the weapon is in the array before using find. But perhaps the Find command is somehow failing and returning -1 instead of a valid index?
  6. Well it's hard to read scripts posted as standard text without indents, so I can't say for sure it will help solve any problems. But I don't think scope is anything special to the sqf format, verses the sqs format, the same thing still applies. I just stuck my neck out and made an assumption
  7. Any local variable initially defined within {}, then referenced within separate {} or later on in the script, like _AlertRadius, _number and _RandomFactor. Need to be defined at the root of the script, to make them available to all the other scopes i.e {}. For example: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_unit = _this select 0; _weapon = _this select 1; _muzzle = _this select 2; _mode = _this select 3; _ammo = _this select 4; _AlertRadius=-1; _number=-1; _RandomFactor=-1; Note, all the local enemy variables, _nearEnemies, _cluelessEnemies and _otherEnemies are fine. As they are defined in the root or parent scope of the script, so by default they are available to all the child scopes, contained in the following {}. Do a search on the wiki for scope to get more info. Scope is a odd concept to get your head around if you’re new to programming. But if you add this line to the end of your script before making any other changes, and run it: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">{_x setBehaviour "SAFE"; _x setTargetAge "120 MIN"; } forEach _cluelessEnemies; Player SideChat Format ["_nearEnemies=%1 _cluelessEnemies=%2 _otherEnemies=%3 _AlertRadius=%4 _number=%5 _RandomFactor=%6",_nearEnemies,_cluelessEnemies,_otherEnemies,_AlertRadius,_number,_RandomFactor] Then add the suggestion I made above and run it again, you should see the difference?
  8. UNN

    typeOf in array?

    A couple of things you can change. For the new variables your creating within the script, you need to defined them first, the same way you did with _wt: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_vtyp = _this select 0; _crwt = _this select 1; _wpCR = _this select 2; _wp1 = _this select 3; _wp2 = _this select 4; _wp3 = _this select 5; _wp4 = _this select 6; _unit = _this select 7; _hpt = _this select 8; //Initialise local variables _bas=ObjNull; _Crep=ObjNull; _wt = 20; Do a search on the wiki for scope to get more info. Also seen as _vtype (type of vehicle) is already being passed as a parameter, you should be able to do this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (_vtyp in ["AV8B","AV8B2","UH60","UH60MG","A10","AH6","AH1W"]) then {_bas=basW;} else {if (_vtyp in ["Mi17","Mi17_MG","KA50","SU34B","SU34"]) then {_bas=basE;};}; And: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (_vtyp in ["AV8B","AV8B2","SU34","SU34B","A10"]) then {_CreP = _wpCR; _CreP setPos [(getPos _CreP select 0),(getPos _CreP select 1),+4500];} else {_CreP = _hpt; _wt = 30;}; Edit: Fixed typo in the variable name _vtyp
  9. UNN

    typeOf in array?

    If you run that example using exec then it works ok, if you run it with execVM then it returns errors. If you are using execVM and want to stick with it. Then write it like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If (typeOf _veh in ["AV8B","AV8B2","UH60","UH60MG","A10","AH6","AH1W"]) Then    {    _bas=basW;    }    Else    {    If (typeOf _veh in  ["Mi17","Mi17_MG","KA50","SU34B","SU34"]) Then        {        _bas=basE;        };     };
  10. Don't have the RAS addon, but a couple of things to try out. If you don't have the zamerny selection in the view-gunners LOD of the p3d, then try copying it in there. Try experimenting with some of the other destruction types. Or, if the parachute has ammo and fuel, then try removing all of those with a script from the killed event.
  11. I don't think you can avoid using a looping script. But you can set your loop to check for when the Time command returns 0. See the notes at the bottom of the linked page.
  12. Hi, I've only just realised that in Arma, when you repair a damaged vehicle in MP. The AI still refuse to get in once it's repaired. Tried it with the latest beta patch, still the same problem. Works fine in SP, anyone know of a work around for MP? Cheers
  13. I managed to take another look, it could be bit different from the OFP fix. SetDammage does work, only it has to be called before a repair truck flags an immobile vehicle, as able to move. I'm sure that never used to be the case in OFP? If you call the SetDammage command, the moment before a Repair truck sets a vehicle to CanMove, then it looks like it works out ok. Well that’s in theory...The timing of the clients and server can all be handled individually. It might be more about identifying when a vehicle is about to be set as mobile.
  14. If it's a specific element I usualy go with this method: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Array=[1,2,[A,B,C],3,4]; _Array Set [2,"DELETE"]; _Array=_Array-["DELETE"]; For removing your corpses you could do something like this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">for "_i" from 0 to ((Count _Array)-1) do    {    If !(Alive (_Array Select _i)) Then        {        _Array Set [_i,ObjNull];        };    }; _Array=_Array-[ObjNull];
  15. UNN

    Smoke Help

    You could try replacing this line: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_PS1 = "#particlesource" createVehicleLocal getpos _OBJ With these lines: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_PS1 = "#particlesource" createVehicleLocal getpos _OBJ _PS1 setPos (getpos _OBJ) Sometimes Arma automatically tries to positions objects so they don't collide. So you might have to reinforce the act. But _OBJ probably has to have it’s centre of gravity at the position you want. If it’s a smoke stack with a geometry LOD, then it’s a safe guess to say it doesn’t. If it doesn’t, then you could always adjust it with the modelToWorld command.
  16. This isn't the way I've done it in the past, so I can't say for sure. But your condition to launch the JIP script is this line: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">//JIP client if (T_JIP && T_INIT) then However T_INIT is set to true with this line: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">[] spawn { waitUntil { !(isNull player) }; T_INIT = true }; Because that line is executed with a spawn command, there may be some delay in T_INIT being set to true. So T_INIT could still be set to False when it hits your JIP check? If you used this line instead: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">waitUntil {!(isNull player)}; T_INIT = true; Then you can guarantee T_INIT has been set to the correct value before it executes the rest of the script. Not sure that will solve your problem, just something I noticed.
  17. UNN

    Home Guard WW2 addon

    Lol...Right, your names going in the book True, although I think they were mostly equipped with weapons from the same era to. I get the impression the Home Guard was looked on as a sort of Human shield, to give the regular Army time to mobilize?
  18. UNN

    Home Guard WW2 addon

    It may be a tube with a blade on the end, but they still don't like it up em As an exercise in moral boosting, the Home Guard may have had some merit. On a Battlefield, it's more like whole scale slaughter. I think there are more promising WW2 projects currently active on the forums, that might benefit from miscellaneous objects e.t.c But that’s just my opinion.
  19. UNN

    Init Eventhandler & MP

    No worries, I should have included a better description of what was going on. Thanks for taking the time to try it out. Yeah, that is a bit odd. I thought a server would behave the same, either way. But I suppose the main thing is to make sure your init event scripts account for potential respawns.
  20. UNN

    Init Eventhandler & MP

    The mission is there just to display the content of certain global variables. LOCALUNIT, SERVERTIME and SERVERUNIT are all global variables initialised by this script: Script.sqs: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">_Unit=_This Select 0; If IsServer Then     {     SERVERTIME=Time;     SERVERUNIT=_Unit;     PublicVariable "SERVERTIME";     PublicVariable "SERVERUNIT";     }     Else     {     LOCALTIME=Time;     LOCALUNIT=_Unit;     }; It creates a couple of variables on the server and clients. The server side variables are broadcasts to all the clients using the PublicVariable command. The script is launched using InitTest.pbo’s config init event handler. InitTest.pbo: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">class cfgVehicles     {     class SoldierWB;     class InitTest : SoldierWB         {         Scope=2;         DisplayName="My Test Soldier";         class EventHandlers              {              init = "[_this select 0] Execvm ""\InitTest\Script.sqs""";              };         };     }; Yeah, it could very well be just for dedicated servers, as I didn't test it with the ingame server.
  21. UNN

    Init Eventhandler & MP

    Here's the quick test mission I did, like I said it's only a basic test. The mission is setup with two triggers showing what’s returned via the players configs init event, for both the server and the client. UNNMPInitTest.zip Each time the server trigger, returns a reference to the newly respawned player. The local trigger just returns the reference from the first time the client joined the server. From a mission editing point of view, there are probably better ways of keeping track of respawns than init events. I was interested in this because it could, in some cases, cause multiple copies of the same script, to be run on the server. If you weren’t aware that it was being fired on every respawn.
  22. UNN

    Init Eventhandler & MP

    Well I can only talk about V1.08 with the respwan settings I mentioned above. But if you call this script from a config init event: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">If IsServer Then     {     MYTESTTIME=Time;     PublicVariable "MYTESTTIME";     }; Then setup a mission where you have a radio trigger executing this line: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">Hint Format ["Time %1",MYTESTTIME] At the start of the mission, calling the radio triggers returns a hint value of 0. If wait a couple of seconds then select respawn from the menu, running the trigger again returns a value of 10. Keep repeating the steps to increment the hint value, after each respawn. I should point out that this only applies to players and not respawning AI. To me that is enough evidence to say, the config init event is running on the server after each respawn. Can't think of a simpler test than that, give it a try and see for yourself, it only takes five minutes to setup. Post back on how you get on. I can post the test mission and addon for anyone else who is interested. It really is better to try these things out for yourself, and confirm things one way or another from multiple sources, rather than just taking someone’s word for it.
  23. Perhaps you could switch the player to a unit that has no others to command, or is a temporary subordinate of the players group?
  24. I think The_Captain means you create a camera object and switch to that view, while the dialog is open? That way it may not treat mouse clicks as move to commands. But as The_Captain said, it depends if your dialog covers the entire screen. An object that overlaps the map might also work, assuming all the commands are there to manipulate maps? You just have to transfer the coordinates from the overlapping objects events, to the map object with script commands.
  25. UNN

    Init Eventhandler & MP

    Please do, I've not done much with respawn scripts, curious to see what’s going on. I'm sure there will be some kicking about, perhaps they might help.
×