Jump to content

shuko

Member
  • Content Count

    2231
  • Joined

  • Last visited

  • Medals

Everything posted by shuko

  1. shuko

    SHK_Taskmaster

    Version 0.42 is up. Levrex contributed a function to check non-BIS factions. As I have no addon factions myself, I'd be interested hearing how it works for those who do have.
  2. Features: - The script is server driven; all task additions and updates are called on server side. All changes are broadcasted to players in one array variable. This enables more work to be done only on server, since most of AI-related things happen there anyway. This way the number of triggers placed goes down, as they are unnecessary for clients (players). Number of publicvariabled variables goes down also. - Only one eventhandler is created instead of one per task. - As tasks are kept in an array, no global variable is created for each task. - No "call compile format" type of coding. - Variables used to check for task states and statuses are replaced with functions, cutting down number of global variables. - Usage simplified; briefings are easier to create, some parameters are made optional. Creating a briefing in init.sqf [[ ["Task1","Task1Title","Task1Desc"], ["Task2","Task2Title","Task2Desc",true,["markerTask2",getpos obj2]] ],[ ["Note1","Hello West",WEST], ["Note2","Hello East",EAST], ["Credits","Made by: Shuko of LDD Kyllikki<br />www.kyllikki.fi"] ]] execvm "shk_taskmaster.sqf"; Task Data ["TaskName","Title","Description",Condition,[Marker],"State",Destination] Required parameters: TaskName string Name used to refer to the task Title string Task name shown in the in/game task list Description string Task description, the actual text body Optional parameters: Condition boolean/side/faction/unit/group/string Units the task is added to. Default is everyone Marker array Marker related to the task. It will be created only for the units who have the task. Marker will be hidden after task is completed. Can be an array of marker arrays, if you want to create multiple markers. Name string Name of the marker to create. Position string Position of the marker. Type string Marker type. Optional, default is "selector_selectedMission". Color string Marker color. Optional, default is red. State string Task state of the newly created task. Default is "created". Destination object/position/marker Place to create task destination (game's built-in waypoint/marker). If an object is given, setSimpleTaskTarget command is used, attaching the destination to it. Condition (limiting the units to who the tasks and notes are created) Examples: [...,WEST] All playable units on BLUFOR (WEST) [...,"USMC"] Faction USMC [...,grpMarine1] Units that belong to group named grpMarine1 [...,myDude] Unit named myDude Then there is the IF syntax, so you can create a condition anyway you want, where _x is the unit (=player). Examples: "((group _x == grpScouts) OR (_x == pilot1))" Members of grpScouts and unit named pilot1 "(typeof _x == ""CDF_Soldier_Sniper"")" All CDF snipers TaskState The task state of the newly created task. Valid states are succeeded, failed, canceled and assigned. Default is assigned. Note Data [NoteTitle,NoteText,Condition] Required parameters: NoteTitle string Text shown in the list NoteText string The actual note text body Optional parameters: Condition boolean/side/faction/unit/group/string Units the note is added to. Default is everyone. Updating tasks Task states are updated by calling a function. Possible states are: succeeded/failed/assigned/canceled. Example: ["Task1","succeeded"] call SHK_Taskmaster_upd; It's possible to set state of one task and set another as assigned using an optional 3rd parameter. Example: ["Task1","succeeded","Task2"] call SHK_Taskmaster_upd; This will make task state of task Task1 to succeeded and the state of the task Task2 as current. Another optional 3rd parameter can be used to add a new task after updating another task. Example: ["Task1","succeeded",["Task2","Title","Desc"]] call SHK_Taskmaster_upd; This will make task Task1 as succeeded and create a new task Task2. Same set of parameters is used for the creation as in init.sqf or SHK_Taskmaster_add. Creating tasks during a mission Tasks can be added after briefing with the add function. Same set of parameters is used as in creating a briefing. The new task is set as current task automatically. Example: ["Task2","Extraction","Get to teh choppa!"] call SHK_Taskmaster_add; Functions SHK_Taskmaster_isCompleted This function can be used to check if a task is completed. Task is considered completed with states succeeded, failed and canceled. Function returns a boolean (true/false) value. Example: "Task1" call SHK_Taskmaster_isCompleted SHK_Taskmaster_getAssigned Returns list of tasks which have "assigned" as their state. Example: call SHK_Taskmaster_getAssigned Example result: ["Task1","Task4"] SHK_Taskmaster_getState Returns the task state (succeeded/failed/canceled/assigned/created). Example: "Task1" call SHK_Taskmaster_getState SHK_Taskmaster_hasState Checks if a task's state matches the given state. Function returns a boolean value. Example: ["Task1","succeeded"] call SHK_Taskmaster_hasState SHK_Taskmaster_hasTask Checks if a task with the given name has been created. Returns boolean. Example: "Task1" call SHK_Taskmaster_hasTask SHK_Taskmaster_addNote (client side only) Creates a briefing note. This can only be used on client side, and it's not boardcasted for other players. Parameters: ["Title","TextBody",Condition], Condition is optional. Example: ["Enemy forces","Oh noes, there will be enemy soldiers in the area of operation."] call SHK_Taskmaster_addNote Files shk_taskmaster.sqf Example mission I'm sure there are something to fix, add and change. Don't be afraid to ask for instructions, give feedback or report bugs.
  3. Someone correct me if I'm wrong, but I thought the parent/child thing only meant that when parent is completed, it will complete the children as well. It has no affect on UI.
  4. shuko

    SHK_moveObjects

    Basically anything that is type of "object", which markers unfortunately are not.
  5. shuko

    SHK_Taskmaster

    taskVarNum = 1; // from the upkeep of your dynamic tasks, or any other method of making and tracking of the tasks [format ["myDynTask%1",taskVarNum],"you must do this","this is you duty, do it!"] call SHK_Taskmaster_add; All the fields are text. So, should be pretty simple really. All you need to figure out is how you will create the dynamic tasks and how you keep track of them. By that I don't mean the UI part of tasks which Taskmaster adds, but the actual task with trigger/conditions etc.
  6. shuko

    SHK_pos

    So, the problem is with the triggers. Does the mission have AI units on the players' side? Have you tested if the triggers are created correct and actually fire (with some simple condition)?
  7. shuko

    SHK_pos

    Ah yes, indeed it should be. Well, you say you know how to use it, which I assume means you load it correctly. What exactly is the problem? Can't get random positions generated? Can't do anything with the positions? Not even the markers show up? I mean, I didn't test it nor have I've scripted in months, but the code seems pretty valid.
  8. shuko

    SHK_pos

    Something like? fnc_createMarker = { private ["_pos","_m"]; _pos = _this select 0; _m = createMarker [format["mPos%1%2",(floor(_pos select 0)),(floor(_pos select 1))],_pos]; _m setmarkerColor (_this select 1); _m setMarkerShape "Icon"; _m setMarkerType "mil_dot"; }; fnc_createTrigger = { private ["_pos","_trg"]; _pos = _this select 0; _trg = createTrigger["EmptyDetector",getPos _pos]; _trg setTriggerArea[25,25,0,false]; _trg setTriggerActivation["WEST","PRESENT",false]; _trg setTriggerTimeout [1,1,1,false]; _trg setTriggerStatements["({_x in thisList} count (playableUnits + switchableUnits) > 0) && ((getposATL Player select 2) < 33);", "hint 'Recon: CHECK!';", "hint 'X';"]; }; _count = 1 + random 4; // how many for "_i" from 1 to _count do { _p = ["mkr1",0] call SHK_pos; [_p,"ColorRed"] call fnc_createMarker; [_p] call fnc_createTrigger; };
  9. shuko

    SHK_pos

    A bug fix was done to a function by Cool=Azroul13. New version is up.
  10. shuko

    SHK_Taskmaster

    New version is up with Alwarren's isCompleted function.
  11. shuko

    SHK_Taskmaster

    I'm traveling at the moment, but I'll look into it once I get home. Thanks for the function! PS. Maker should know which tasks have been created at certain time, and only check those. ;)
  12. shuko

    SHK_Taskmaster

    No idea, I haven't opened the game in months. :/
  13. shuko

    SHK_pos

    Not really, because it's the object mover that moves the stuff? Or is the unit/object inside a rock always the anchor/middle one? Edit: If you can bother trying if this works, at all. I didn't test it. Change foreacg at the end of the moveObject.sqf { _xPos = getpos _x; _dir = ((_xPos select 0) - (_aPos select 0)) atan2 ((_xPos select 1) - (_aPos select 1)); _dir = _dir + _dAdj; _dst = _aPos distance _xPos; if (!isnil "_fDir") then {_x setdir _fDir}; _xPos = [((_dPos select 0) + (_dst * sin _dir)), ((_dPos select 1) + (_dst * cos _dir)), 0]; _endPos =+ _xPos; _endPos set [2,20]; for "_i" from 0.25 to 20 step 0.25 do { _endPos set [2,_i]; if (!(lineIntersects [ATLToASL _xPos, ATLToASL _endPos])) exitWith {}; }; _x setposATL _endPos; } foreach _objects;
  14. shuko

    SHK_pos

    Does that happen even with using the 5th parameters?
  15. shuko

    SHK_Taskmaster

    Uploaded version with Fat_Lurch's fix for the marker text.
  16. shuko

    SHK_Taskmaster

    Excellent, thank you!
  17. shuko

    SHK_pos

    That seems very lovely. It would be great if you don't mind sharing it.
  18. { _x commandFire target1; } foreach array1;
  19. shuko

    SHK_pos

    Probably, when I get enough time/motivation. Are you sure the position retrieved with parameter value 1 is actually a road position? Since with value 1, if none found, it will return a random position as a fail safe.
  20. Using the condition parameter is so much easier than removing & readding. Check the Wiki for addaction.
  21. shuko

    How Did You Learn To Script?

    Started in OFP, learned by trial and error way, and looking/using/editing other peoples' scripts. Advice part Rydygier already summed up quite nicely.
  22. Since you spawn and despawn the groups, you have perfect control over them. Thus, you can add and remove them from a global array, instead of bothering with trying to figure out a way to refer to them by name. Simply, you can just iterate the array etc.
  23. It was given to you in the previous page already. You are not defining the "lights" array before trying to set objects into it. lights=[]; // Array that stores all the created lights http://forums.bistudio.com/showthread.php?169328-Variables-in-list-help-needed&p=2570782&viewfull=1#post2570782
  24. Error Undefined variable in expression: lights
×