Home   Help Search Login Register  

Author Topic: Marker Help (Noob)  (Read 1421 times)

0 Members and 1 Guest are viewing this topic.

Offline Hardtak

  • Members
  • *
Marker Help (Noob)
« on: 15 Jul 2009, 03:45:26 »
I am rand new to scripting in general and have done some research prior to making this post.   the questions I have currently are about marker.

Q1.  In order to have a marker not pop up until a task is selected I need to:

       1. Create a "empty" marker at the wanted position called obj1 (just an example)
       2. Then in the briefing.sqf add a line that states setSimpleTaskDestination (getMarkerPos "obj1")

Is that correct?

Q2.  After the initial task I do I continue to use the briefing.sqf to activate the markers or do I use something else?

Q3.  What else should I know?  I have read the BIS Wiki on markers but it doesn't day a whole lot.

Any help would be greatly appreciated.

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Marker Help (Noob)
« Reply #1 on: 15 Jul 2009, 08:36:27 »
Welcome to the Ofpec forums

 :welcome:

Q1
1. Yes, exactly.
2. Try the commands setMarkerType and possibly setMarkerText. I dont know what setSimpleTaskDestination does exactly, but i doubt that it meddles with the markertype, since there are other commands for that.

Q2 Same procedure can be used for all markers. You can change markers from scripts (as in your example), triggers or just about anything. I do it your way. I start a script named briefing.sqf, that handles all briefingrelated stuff in the mission. It makes it easier to go back and correct any errors while designing the mission.

Q3
Look in the Comref in Ofpec's Edidor Depot. It is commented and can show you a lot of neat tricks. There's also a bunch of tutorials in the Ed Depot that might come in handy.

EDIT1: The alphabetized searchable COMREF can be found here.

EDIT2: Crossed out erroneous assumption.
« Last Edit: 16 Jul 2009, 12:04:48 by nominesine »
OFPEC | Intel Depot
RETARDED Ooops... Retired!

Offline Hardtak

  • Members
  • *
Re: Marker Help (Noob)
« Reply #2 on: 15 Jul 2009, 18:39:01 »
Ty very much fore the help nominesine.  :D

Upon further examination and thought I could use a little more help.

Here is the description for for setSimpleDestination:

http://www.ofpec.com/COMREF/index.php?action=details&id=1259&game=All

And here is the thread that suggested it's use.:

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


What I gather setSimpleDestination does is set a waypoint on the HUD and names it using the text field in the previously established marker it is pointed to.  But I am under the impression that it is an empty marker that is set.  If I want to have a marker created that adds an elliptical red mark on the map do I need to use setMarkerType, setMarkerText, setMarkerShape, setMarkerSize, and setMarkerColor?  Would it be best to do this in a trigger?

Another question I have is what prevents the marker from being added before I want it to?  The first task isn't a problem as that task is set as active from the missions start, but subsequent missions I don't want the markers to activate until the previous tasks completion.  Here I will post my code to give you a better idea as to what it is I am doing.

Code: [Select]
// last created entries go on top, so reverse the order
// <marker name='obj1'>here</marker>//
//<img image='shilk.paa'/>//

// create a simple note in the briefing
player createDiaryRecord["Diary", ["Oleg V. Takarov", "<img image='olegphoto.paa'/><br/>Oleg Vidaly Takarov<br/>AKA Kowmap<br/><br/>DOB 6-17-73<br/>"]];

player createDiaryRecord["Diary", ["ROE", "You are weapons free for the duration of the operation.<br/>Try to use your best judgement Red-Tide and avoid any international incidents."]];
 
player createDiaryRecord["Diary", ["Situation", "XXXXX"]];
player createDiaryRecord["Diary", ["Mission Overview", "XXXXX"]];
 

// <br/> is a line break, forcing the text behind it to go on a new line

// create a task



tsk6 = player createSimpleTask["Destroy Artillery Base"];
tsk6 setSimpleTaskDescription["Destroy the Artillery Base"];
tsk6 setSimpleTaskDestination (getMarkerPos "arty")

tsk5 = player createSimpleTask["Kill Leaders"];
tsk5 setSimpleTaskDescription["Kill the Ofiicer and local Warlord leader."];
tsk5 setSimpleTaskDestination (getMarkerPos "leaders")

tsk4 = player createSimpleTask["Destroy AA Site"]; // adds a task w/o desc or marker
tsk4 setSimpleTaskDescription["Destroy the Anti Aircraft Site located WNW of Gorka"];
tsk4 setSimpleTaskDestination (getMarkerPos "aasite")

tsk3 = player createSimpleTask["Destroy Radio Tower"]; // adds a task w/o desc or marker
tsk3 setSimpleTaskDescription["Destroy the radio tower in Lupatino."];
tsk3 setSimpleTaskDestination (getMarkerPos "radiotower")

tsk2 = player createSimpleTask["Clear Myshkino"]; // adds a task w/o desc or marker
tsk2 setSimpleTaskDescription["Clear the twon of Myshkino of a militants."];
tsk2 setSimpleTaskDestination (getMarkerPos "myshkino")

tsk1 = player createSimpleTask["Destroy Generators"]; // adds a task w/o desc or marker
tsk1 setSimpleTaskDescription["Search Sosnovka for the two Electical Generators and destory them."];
tsk1 setSimpleTaskDestination (getMarkerPos "generators");

player setCurrentTask tsk1;  // Make tsk1 the active task
« Last Edit: 15 Jul 2009, 19:08:49 by Hardtak »

Offline nominesine

  • Former Staff
  • ****
  • I'm NOT back!
    • The IKB Forum
Re: Marker Help (Noob)
« Reply #3 on: 16 Jul 2009, 01:08:30 »
I made a few erroneous assumptions in the post above. When you setSimpleTaskDescription on an existing marker it will automatically transform into a yellow circle. That's the only reason to use one of the invisible 'Empty' markers to the define the destination for your objectives in the editor. Game wise, a marker is a marker is a marker. OK? It just looks better if your new yellow marker isn't spawned on top of an already existant marker, in another colour. Enough of that for now. Lets take a look at a working sample code and explain what it actually does. These are a quotes from the briefing script in one of my missions:

tskObj1 = player createSimpleTask ["Insert on Utes."];

That's the first step when you are creating a task. As you can see this is an instruction that tells the player to 'insert' on Utes. It's purely Eye Candy. As you've already figured out it serves little purpose apart from adding to the players immersion. We still cannot check if the created task has been accomplished ingame or not. We simply cannot use the created simpleTask just yet. Let's continue with some more Eyecandy (it will become important later on though). Lets add a description to our simpleTask:

tskObj1 setSimpleTaskDescription ["Board the helicopter and order insertion (0-0-1)", "Insert on Utes.", "INSERTION"];

The above quote denotes (in order of appearance) the text the player will see in the right hand-box, next to the task head line (when he/she highlights the original task headline with a single mouse click), and the listbox headline above. The quote serves no other purpose but does indeed look good on screen. In order to make the entry useful in the future you must use the exact same phrase when you define the second quote here, as you did when you defined the first quote above (in this case "Insert on Utes"). Now it's time to decide wich task should be active on mission start. Since my example only includes one task, I'll set that one to active using the following code:

player setCurrentTask tskObj1;

Since you wanted to add a clickable hint to the briefing (player double clicks on "Insert on Utes" and map centers at the object destination) we must add another line to our briefing script. It goes as follows:

tskObj1 setSimpleTaskDestination (getMarkerPos "destinationObj1");

destinationObj1 is an empty marker I've already placed on the map and named myself. As mentioned before you may use any type of marker and make up any name to your liking. The effect is as follows: When the player double clicks the task in his/her briefing, the map will center on the marker. Exactly what you wanted, right? Three things are important here:

1) You must use createSimpleTask before you setSimpleTaskDescription

2) You must setSimpleTaskDescription before you setCurrentTask

3) You cannot setSimpleTaskDestination unless setCurrentTask has been executed in the script.


Read the three steps again, because the chronology is important here. That's where you screwed up in your quoted example. You used setSimpleTaskDestination before setCurrentTask. Otherwise your code isperfectly fine.


SIDE NOTE: I've been fooling around with this game for 9 (nine) years, and your question almost forced me to my knees, trying to help you. You've managed to solve most of the problem at hand singlehandedly, and I'm sure you'll manage to solve almost any problem you'll encounter concerning ArmA2 scritpting. Good job! I'm impressed.
« Last Edit: 16 Jul 2009, 11:56:17 by nominesine »
OFPEC | Intel Depot
RETARDED Ooops... Retired!