Jump to content

Muzzleflash

Member
  • Content count

    942
  • Joined

  • Last visited

  • Medals

Community Reputation

54 Excellent

5 Followers

About Muzzleflash

  • Rank
    First Sergeant

core_pfieldgroups_3

  • Interests
    Little of everything
  1. Place unit in front of vehicle

    Not sure if the bounding box is defined the same for each vehicle. But something like this then: private _bbox = boundingBoxReal damagedVehicle; private _frontDist = _bbox select 1 select 1; //This seems to be the edge of the front of the bounding box private _worldPos = damageVehicle modelToWorld [0, _frontDist, 0]; _worldPos set [2, 0]; // Ensure we placed on ground mechanic setPos _worldPos;
  2. There is nothing called "t" in createDiaryRecord. You probably meant to use <font>. If that doesn't work, try to remove the space between color and =.
  3. Enums, are they possible

    In program terms an enum is an enumerated type. That is you enumerate (specify exactly) the values that belong to the type. They don't have to integers, although it is common in C-like languages. Since we can't make custom types in SQF, we will have to make do with what we got. Basically the current values possible, e.g. number, string or array. And since SQF is not object oriented, we do not have methods, on however, we make our enum. What exactly you you mean by this? Do you mean you wan't to able to type something like: Dlc.Apex , if so you can't. How do you wan't to treat your values? Maybe something like this is closer to what you had in mind: Enum_fnc_MakeEnum = { params ["_name", "_values"]; private _result = []; { _x params ["_key", "_value"]; _result pushBack _value; private _varName = format ["%1_%2", _name, _key]; missionNamespace setVariable [_varName, _forEachIndex]; } forEach _values; missionNamespace setVariable [_name, _result]; _result }; ["DLC", [ ["VANILLA", "Vanilla"], ["LAWS_OF_WAR", "Laws of War"] ]] call Enum_fnc_MakeEnum; // Now you have all values in: { systemChat str _x; //Will output Vanilla, then "Laws of War" } forEach DLC; // Or pick a specific value: private _LoW = DLC select DLC_LAWS_OF_WAR; systemChat str _LoW; //Will output "Laws Of War"
  4. Enums, are they possible

    You can just do: MyEnum_ValA = 10; MyEnum_ValB = 20; MyEnum_ValC = 99;
  5. JIP Function

    The preInit runs the file. You want to compile the file so that is is ready for execution as a function. So there is no need for preInit. Tried what with isNil? My suggestion is, at the top of the script where you have something like: params ["_unit"]; if (isNull _unit) exitWith {}; //... rest below, e.g. add action to _unit I would expect it to. Because otherwise the whole scheme is basically useless. But ultimately the whole JIP part of remote execution is under documented, and nowhere, (I have found at least), it is clarified when JIP invocations occur.
  6. JIP Function

    Remove the preInit. And I would remove the part you added to the top of your script (this is the part that made it not working for everybody?). Instead just check in your script whether the argument is null or not.
  7. gc8, the machine on which you use publicVariable will not run any handlers.
  8. Question about AddAction and RemoteExec

    Yes, you would to ensure it runs for all players. You could do [_this select 1, "looks like ..."] remoteExec ["sideChat", 0]; .. You could also listen for the "intelFound" publicVariable broadcast and do it there instead.
  9. Phronk's Furniture Script

    I recently wrote a hash function as a proof of concept for how to apply the same random global state changes using only local efficient commands. For example: using the same "key" -- an input value to the hash function -- I could apply damage to some the buildings on map without having to transmit over the network. This could be one way to handle randomization, and ensure it is always the same, without storing a lot of data or doing a lot of synchronizing (only the key - basically a number - would be synchronized to clients).
  10. Help with Items Respawning

    You can use HazJ approach, just remember to add the event handler to the replenishment item you create (mentioned under etc... :) ).
  11. Well technically no, since I believe it the list only gives occupied vehicles. But in practice yes., but you have to do it manually using a separate script, by grabbing all objects in the area, and then filter them to ensure they are in the trigger. Worst case for a rectangle trigger you grab all objects in a radius encompassing the rectangle size, and filter them trough inArea.
  12. This is actually quite involved to make work. 1. Do you need to support join-in-progress? 2. Will the vehicles only by driven into/out of the area by players (not AI)? If #2 is true. Then one way is, for all players (and server) when joining, go through all vehicles and players, and for those that are in the trigger area (inArea MyTrigger) you allowDamage false. Then on your trigger activation, you also have allowdamage false, for both the vehicle and the player. And on leaving you have allowdamage true for all players and the vehicle.
  13. Converting date to text

    Good find. From looking at the arguments, which have gender, I am guessing that is language sensitive to what language the user is playing in. I will test it later, but if so, I am not going to use that until I am sure it will not be confusing. E.g. mixing german or french ordinals with implicit english.
  14. Converting date to text

    Your question prompted me to recreate strftime from C and Python in SQF. Almost all of the functionality is there, except the week numbers, timezone and microseconds. Your example would look like: private _text = [ [2035, 8, 14, 13, 37], "%A, %B %m%@O, %Y" ] call MF_fnc_DT_FormatTime; // Now _text is: "Tuesday, August 8th, 2035" To view the instructions and code click here , or click for the direct link to the file here.
  15. What do you mean when you say, for the top part, that that file is compiled for everyone. You mean you "call compile" it? In that case you would run the remoteExec once for EACH player and the server, and thus add too many event handlers. Are checkpilot and checkengine compiled by everyone, or just the server?
×