Jump to content

Mike84

Member
  • Content Count

    208
  • Joined

  • Last visited

  • Medals

Posts posted by Mike84


  1. This might be a good question to ask this! I'm having some problems getting certain functions executing from the init field of units, while they work fine in triggers. Any idea why? (Specifically it was the BIS function to remove items from a units inventory)

    The code in the init lines is executed before the functions are "compiled".

    Easiest thing to do is to execVM a script which has a waitUntil { BIS_fnc_init }; on top, so it will wait until the bis function module is done "compiling" before it attempts to use the functions.

    Example:

    init line:

     nul = [this] execVM "someScriptInYourMissionFolder.sqf"; 

    someScriptInYourMissionFolder.sqf:

    waitUntil { BIS_fnc_init };
    _unit = _this select 0;
    
    blah blah blah, etc
    

    You can now use the _unit var to manipulate the unit where you execVM'ed the script in the init line.


  2. How to make task hints

    [objNull, ObjNull, tskExample1, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";
    

    how do i get this taskHint.sqf ?

    if i use this code in the activation field of the trigger, the editor returns an error: "Typ Script, expect nothing"

    Use:

    nul = [objNull, ObjNull, tskExample1, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";
    

    because the editor always wants to save the script handle (i still dont get why, but whenever you get that error, just put "nul = " in front of it).


  3. Well, you're using "setSimpleTaskDescription" wrong. You only give the array you're passing 1 element, while the howto says to give 3.

    For the tasks not showing up, I have no clue. I copied over the code and it worked fine, bar the task descriptions of course.

    Anyhow, check your rpt file for errors, because there is something else wrong here.


  4. How to make task hints

    taskHint is relatively useless itself (because it requires too much effort), but there is a script that makes it easier to use. So instead of executing a hint, do this:

    [objNull, ObjNull, tskExample1, "SUCCEEDED"] execVM "CA\Modules\MP\data\scriptCommands\taskHint.sqf";
    

    The first 2 arguments are useless so i just send objNull, the 3rd is the task that you've created, and the 4th is the status.

    Supported task states:

    "CREATED"

    statuscreated.png

    "CURRENT"

    statuscurrent.png

    "CANCELED"

    statuscanceled.png

    "SUCCEEDED"

    taskstatus.png

    "FAILED"

    statusfailed.png

    NB,

    - This command does not set the state of the task, so you still need to do this command, and the setTaskState command in your trigger.

    - It creates the hint in the middle of the screen, not at the right side (this means that taskHint and hint can be used at the same time)


  5. EDIT2:

    Figured it out. But now the tasks will get marked as complete but no Objective complete message appears on the screen.

    add a hint message

    tskObj1 setTaskComplete "SUCCEEDED"; hint "You've completed obj1!";
    

    Use that for now, I just found the taskHint command which might be better, but the documentation on the comref is faulty, so it will take some time to figure it out.


  6. @manzilla

    Try it with a radio trigger first (for example radio alpha, and press 0-0-1 ingame). If that works, something else must be wrong.

    @Jezuro

    Thnx (although I would've preferred 2 L's in canceled/cancelled) :)

    And a possible bug Jezuro, "ASSIGNED" is a valid taskState as well, but it will only cause confusion if players set their own tasks active, or when mission makers use setCurrentTask.


  7. I was thinking of making something like this as well when reading the comref (I haven't seen buildingPos before, although it was in arma1). Anyhow, I haven't gotten far yet, only the algorithm to find enterable buildings and save the number of positions in a building so far. Maybe you can find us for it as well:

    _radius = 250;
    buildingArray = [];
    {    
    if (((_x buildingPos 0) select 0) != 0) then
    {
    	_i = 0;
    	while { ((_x buildingPos _i) select 0) != 0 } do
    	{
    		_i = _i + 1;
    	};
    	buildingArray = buildingArray + [[_x, _i]];
    };  
    }forEach (nearestObjects [player,["House"], _radius]);
    

    and it will spit out (1st element = house object, 2nd element = number of positions):

    [[10827000# 10909: mil_house.p3d,2],

    [1094dc00# 10880: ss_hangar.p3d,10],

    [107a6000# 10660: mil_controltower.p3d,21],

    [10944800# 10887: mil_guardhouse.p3d,3]]


  8. How to make a basic Briefing in ArmA 2

    In ArmA 2 BIS has decided redo the briefing system. The well known 'briefing.html' is still being used, but only for the debriefing.

    The actual briefing is added by script commands, which I advise you to put in a 'briefing.sqf', and give you the ability to add 'Notes' and 'Tasks' to the briefing menu.

    Ok, let's start with the simple stuff. Make a file called 'briefing.sqf' and make sure this gets executed through the 'init.sqf'. Add the following to your init.sqf:

    execVM "briefing.sqf";
    

    Now we can add the briefing commands to the briefing.sqf file, and keep the other files of your mission clean.

    Adding Notes:

    player createDiaryRecord ["Diary", ["Title 1", "Message 1"]];

    This adds a note called 'Title 1', and when you click on that a bigger message screen comes up with 'Message 1'. This is great, but we really need some formatting and ability to add links and pictures.

    Linebreak/newline: <br/>

    Ampersand: &

    Link to marker: <marker name='obj1'>Link to Marker</marker>

    Show an image: <img image='somePic.jpg'/>

    Show an image and manipulate the image width and height: <img image='somePic.jpg' width='200' height='200'/>

    Some examples:

    player createDiaryRecord ["Diary", ["Title 2", "Isn't whitespace awesome? <br/><br/><br/>Yes it totally is!"]];

    player createDiaryRecord ["Diary", ["Title 1", "We have an objective <marker name=mkrObj1'>here</marker> and one <marker name='mkrObj2'>there</marker&gt]];

    Ok, you should now understand how to make a note, and what the possibilities are in the briefing message window, so let's add some tasks.

    Adding Tasks

    You can make tasks whenever you want (at mission start, or at any time you like duing a mission), and you can customize them a lot, but let's start with a simple one:

    tskExample1 = player createSimpleTask ["Task Title 1"];

    This add only adds a task called 'Task Title 1', but the message box is empty. We fix this with the following command:

    tskExample1 setSimpleTaskDescription ["Task Message 1", "Task Title 1", "Task HUD Title 1"];

    This sets a description to the task. The first array element is the message (like the message from the notes), the second element is the title (yes, we already defined that, but we have to redefine it here), and the third element is what gets shown on the HUD.

    Note: The formatting tags that I've shown you earlier work with tasks as well.

    So now that we have a task with a title and message, we can also add an objective marker to the task so we know where the objectives actually are:

    tskExample1 setSimpleTaskDestination (getMarkerPos "mkrObj1");

    Make sure you have an empty marker called 'mkrObj1', and you'll see a semi-transparant circular marker which will light up when you set the task as active.

    Other commands

    Well,now you know how to make notes and tasks, but we also need to control those tasks during the mission.

    We force a task upon a player by executing this on his machine:

    player setCurrentTask tskExample1;

    This will highlight the objective marker, and show him the through the HUD where the objective is.

    Now all that there's left, is setting the task status:

    tskExample1 setTaskState "SUCCEEDED";

    tskExample1 setTaskState "FAILED";

    tskExample1 setTaskState "CANCELED";

    tskExample1 setTaskState "CREATED";

    "SUCCEEDED" = Makes the checkbox green

    "FAILED" = Puts a red cross in the checkbox

    "CANCELED" = Puts a grey diagonal line through the checkbox

    "CREATED" = Clears the checkbox (makes it look like you've just created it)

    You can also show the state of the task with the taskHint command, but since that command is kinda hard to use, we're gonna use a function that I've made to make a lot easier to show the task state.

    How to make task hints

    If you wanna make taskHints that look like this:

    taskstatus.png

    then go and grab my taskHint function at http://www.ofpec.com/forum/index.php?topic=33768.0

    And that's pretty much it for a basic briefing. I'll try to add more advanced stuff to it when I have some more time.

    Templates

    I've made briefing.sqf and briefing.html templates. Grab them at ofpec:

    http://www.ofpec.com/forum/index.php?topic=33468.0

×