Jump to content

Grumpy Old Man

Member
  • Content Count

    4333
  • Joined

  • Last visited

  • Medals

Everything posted by Grumpy Old Man

  1. Grumpy Old Man

    Help with dialog

    What exactly are you trying to do? Hard to tell where you're having problems from your snippet above, besides odd if then checks... Cheers
  2. Grumpy Old Man

    Arrays and addaction problem

    This could do the trick (untested): _bedTypes = [ "Land_Sleeping_bag_F", "Land_Sleeping_bag_blue_F", "Land_Sleeping_bag_brown_F", "Land_Ground_sheet_F", "Land_Ground_sheet_blue_F", "Land_Ground_sheet_khaki_F", "Land_Ground_sheet_OPFOR_F", "Land_Ground_sheet_yellow_F" ]; _beds = vehicles select {typeOf _x in _bedTypes}; { _x addAction ["Dormir 5 Horas",{ titleCut ["", "BLACK OUT", 5]; 5 fadeSound 0; sleep 5; titletext ["6 Hours later", "PLAIN"]; disableUserInput true; [player,"AinjPpneMstpSnonWrflDnon"] remoteExec ["switchMove", 0]; player setDir (direction _bedTypes); player setPos (_bedTypes modelToWorld [0,0.25,0]); skiptime 8; sleep 10; 5 fadeSound 1; "dynamicBlur" ppEffectEnable true; "dynamicBlur" ppEffectAdjust [6]; "dynamicBlur" ppEffectCommit 0; "dynamicBlur" ppEffectAdjust [0.0]; "dynamicBlur" ppEffectCommit 10; titleCut ["", "BLACK IN", 5]; sleep 3; [player,"AinjPpneMstpSnonWrflDnon_rolltofront"] remoteExec ["playMove", 0]; _fin = player addEventHandler ["AnimDone",{ [(_this select 0),"AmovPpneMstpSrasWrflDnon"] remoteExec ["switchMove",0]; }]; uiSleep 3; player removeEventHandler ["AnimDone",_fin]; disableUserInput false } ]; } forEach _beds;
  3. Grumpy Old Man

    Ingame time script

    Simply use daytime: _launch = 14; waitUntil {dayTime > _launch}; Cheers
  4. Grumpy Old Man

    Change Faction

    Indeed, weird, the wiki suggests otherwise: After reading the comments I decided to do a quick check, playerSide always seems to return the initial side of the player unit (maybe retrieved from Cfg?). Even after joining east group and setting captive it returns west, the initial side. So it will be better to check for side player instead. This begs the question of the actual purpose of playerSide, heh. Cheers
  5. Grumpy Old Man

    Change Faction

    PlayerSide will return west, even if the player is setCaptive true. setCaptive only pretends to change sides, a captive west player will still engage east units. To properly change sides you need to use join or joinSilent: [player] joinSilent createGroup civilian; Cheers
  6. Grumpy Old Man

    Weather Effects Ravage

    That's not how this works. You have to get permission first before releasing or "re-releasing" a tweak or modificated work made by someone else (unless stated otherwise inside the original files). It's a bit unfortunate especially with a community that has quite some fluctuation in its member base (transition from A2 to A3 was really rough, lots of folks left for good with no way to contact them). Fortunately sqf is pretty easy to get a hold of and there's still plenty of folks left that make scripts for the heck of it. Cheers
  7. Grumpy Old Man

    Traffic Lights

    Well he ripped it off some altis life server, so it has to be his code, right? Cheers
  8. Grumpy Old Man

    Issues unsolved on my mission

    Guess sqf strikes again, for some reason # demands brackets if another command is involved (if I remember correctly), something like this might fix it: !isNull (_x#1) Cheers
  9. Grumpy Old Man

    Detect enterable buildings

    Just check once for every unique house className on the map upon mission start via preInit or postInit. Cheers
  10. Grumpy Old Man

    Issues unsolved on my mission

    I'd reduce all those loops into a single array and put it into an eachFrame EH so you actually get a realtime update (if this is wanted): //initplayerlocal.sqf addMissionEventHandler ["EachFrame",{ _array = [ ["Marker_drop_plane",drop_plane], ["marker_aa0",aa0], ["marker_aa1",aa1], ["marker_hostjet0",hostjet0], ["marker_hostjet1",hostjet1], ["marker_hostjet2",hostjet2], ["marker_aa2",aa2], ["marker_aa3",aa3] ]; { if (!isNull _x#1) then {_x#0 setMarkerPos _x#1}; } forEach _array; }]; setMarkerPos doesn't eat much performance, you can easily do this for a dozen or so vehicles, as long as it's done locally via initPlayerLocal.sqf. You can reduce it even further if you plan on creating the markers dynamically, so you don't need to touch the array at all, just a simple setVariable in the object init field would do. Cheers
  11. Grumpy Old Man

    Detect enterable buildings

    What performance question? Cheers
  12. Grumpy Old Man

    detect if AI is being fired upon

    You could use assignedTarget inside the fired eventhandler, but that doesn't work reliably either, since it can occasionally return objNull for some reason. Tried to do something similar back in the days without finding a 100% reliable way to return a units current target. Cheers
  13. No need for a separate loop: _ID = player addAction [name cursorObject, {}, [], 0, false, false, "", "_target setUserActionText [_target getVariable ['TAG_fnc_myActionID',-1], name cursorObject];_target distance cursorObject <= 4"]; player setVariable ["TAG_fnc_myActionID",_ID]; Cheers
  14. Grumpy Old Man

    Disable JIP after 5 minutes have passed

    Not a question of daytime, it's a question of how much coffee you had and if you're physically capable of making another mug o' black gold. Cheers
  15. Grumpy Old Man

    Own faction - is mod mandatory?

    The way factions currently work I'd say it's not worth it making a mod just for a few faction strings no one will ever see when playing the game. Just use a few loadout templates and randomize them to visually create a faction (base cap gang, balaclava troops, fedora federation etc). Cheers
  16. Grumpy Old Man

    Disable JIP after 5 minutes have passed

    Could be something like this (untested): //description.ext class CfgDebriefing { class tooLate { title = "Too Late"; subtitle = ""; description = "Mission in progress, wait for restart to join again."; pictureBackground = ""; picture = "b_inf"; pictureColor[] = {0.0,0.3,0.6,1}; }; }; //initServer.sqf missionNamespace setVariable ["TAG_fnc_kickJIP",false,true]; _lockOut = [] spawn { waitUntil {serverTime > 300}; missionNamespace setVariable ["TAG_fnc_kickJIP",true,true]; }; //initPlayerLocal.sqf params ["_player","_didJIP"]; if (_didJIP AND missionNamespace getVariable ["TAG_fnc_kickJIP",false]) exitWith { "tooLate" call BIS_fnc_endMission;//will end mission locally for player }; Cheers
  17. I guess you want to check if at least one group that contains players is left alive? Condition check returning true when one or less teams containing at least one player is left: count (allGroups select {count (units _x select {isPlayer _x AND alive _x}) > 0}) <= 1 End mission when condition returns true: //initServer.sqf in mission root _endMission = [] spawn { waitUntil {sleep 3;count (allGroups select {count (units _x select {isPlayer _x AND alive _x}) > 0}) <= 1}; "SideScore" call BIS_fnc_endMissionServer; }; Check BIS_fnc_endMissionServer for further parameters. Edit: corrected function condition, thanks for the hint @GEORGE FLOROS GR Cheers
  18. Grumpy Old Man

    Issues unsolved on my mission

    It's not a bug. Tasks assigned via module to objects cease to work, because upon respawn the player becomes a new object. Can be handled via onPlayerRespawn.sqf or respawn eventhandler etc. Also you never should execVM either onPlayerRespawn.sqf or onPlayerKilled.sqf since they are automatically executed upon their respective events. Cheers
  19. Grumpy Old Man

    [Solved!]drawLine headache/issue

    That's just string manipulation, you don't pass variables towards EH scope that way. You can also go fancy with multiple borders like this, even add custom color for every border etc: GOM_fnc_drawBorders = { params ["_borderArray"]; { (findDisplay 12 displayCtrl 51) ctrlAddEventHandler ["Draw",format [" _border = %1; _border params ['_markerPrefix','_color']; _markers = allMapMarkers select {toUpper _x find toUpper _markerPrefix >= 0}; _markers sort true; _positions = _markers apply {getMarkerPos _x}; _positions pushBack (_positions#0); { if (_forEachIndex < count _positions - 1) then { (_this select 0) drawLine [ _x, (_positions select (_forEachIndex + 1)), _color ]; } } forEach _positions; ", _x]]; } forEach _borderArray; }; _customBorders = [["RED",[1,0,0,1]],["BLUE",[0,0,1,1]]]; [_customBorders] call GOM_fnc_drawBorders; Pretty easy to build upon. Sure, why not? GOM_fnc_drawBordersAsLeFancyPolygon = { params ["_borderArray"]; { (findDisplay 12 displayCtrl 51) ctrlAddEventHandler ["Draw",format [" _border = %1; _border params ['_markerPrefix','_color']; _markers = allMapMarkers select {toUpper _x find toUpper _markerPrefix >= 0}; _markers sort true; _positions = _markers apply {getMarkerPos _x}; (_this select 0) drawPolygon [_positions,_color] ", _x]]; } forEach _borderArray; }; _customBorders = [["RED",[1,0,0,1]],["BLUE",[0,0,1,1]]]; [_customBorders] call GOM_fnc_drawBordersAsLeFancyPolygon; Cheers
  20. Grumpy Old Man

    [Solved!]drawLine headache/issue

    You simply need to sort the array of fitting markers and to close the polygon add the first marker to the end of the array: (findDisplay 12 displayCtrl 51) ctrlAddEventHandler ["Draw"," _markers = allMapMarkers select {toUpper _x find 'BORDER' >= 0}; _markers sort true; _positions = _markers apply {getMarkerPos _x}; _positions pushBack (_positions#0); { if (_forEachIndex < count _positions - 1) then { (_this select 0) drawLine [ _x, (_positions select (_forEachIndex + 1)), [1,1,1,1] ]; } } forEach _positions; "]; This way you simple create one marker named "border" and copy paste it, the automatic marker naming will work fine with the sort command (pasted markers will be named "border_1", "border_2" etc). Check out the wiki entries of the respective commands, if things are unclear ask again. Cheers
  21. Grumpy Old Man

    question about script

    I'd say .sqf compares most to something like javascript, it's not really a programming language but a scripting language. Had no experience in scripting/programming myself prior to sqf (some 4-5 years ago I guess) and am currently neck deep into C++, which I enjoy much more. The more time I spend in C++, the less I wanna go back to .sqf... Cheers
  22. Grumpy Old Man

    How to make Ai talk to player

    These will not work at all, comma has no place in .sqf syntax, not with any amount of beer. Using sideChat you will only see the group ID and the index of the group member (Alpha 1-5 etc.), not the name. Using globalChat you will only see the side (Civilian) in front of the message. The only proper way using the vanilla system for having AI chatter with visible names in white font (directChat doesn't exist for some weird reason, but I'm past that...) is to use kbTell. A quick showcase to this is to define a basic function so messages are properly transmitted for MP: //init.sqf or wherever you seem fit GOM_fnc_transmitMessage = { params ["_from","_to","_sentence"]; [_from,["Randomsentence", "protocol.bikb"]] remoteExec ["kbAddtopic",0]; [_from,[_to, "Randomsentence", "Randomsentence", ["Randomsentence", {}, _sentence, [] ]]] remoteexec ["kbtell",0]; true }; //protocol.bikb in mission root class Sentences { class randomsentence { text = "%Randomsentence"; speech[]={%Randomsentence}; class Arguments { class Randomsentence {type = "simple";}; }; }; }; class Arguments{}; class Special{}; startWithVocal[] = {hour}; startWithConsonant[] = {europe, university}; //to make one unit speak to another: _talk = [baschir,player,"Hello"] call GOM_fnc_transmitMessage You can also give the unit first and last names, using setName: this setname ["Abdullah Abd-Allah","Abdullah","Abd-Allah"] I believe there's also a more recent function to display chat in the lower center of the screen, no idea, believe it's different from titleText or so... Cheers
  23. Grumpy Old Man

    Where do i find Cities IDs??

    No such thing as city IDs, there's probably another script picking the location based on the values from description.ext params. Other than that, ask the original mission author for permission to alter his mission and how to go about changing those values. Cheers
  24. Grumpy Old Man

    Repetable trigger condition

    Do you absolutely have to do it via triggers? Stuff that goes beyond if XY in thisList is done more conveniently with a simple script snippet. What @pierremgi meant was that the condition won't fire with 2 objects, because it requires >2 objects, means more than 2, other than >=2, which will fire with 2 objects, or more. A simple thing to tweak on your own, really. Cheers
  25. Grumpy Old Man

    Repetable trigger condition

    Nice idea, definitely didn't see anything similar yet, heh. Cheers
×