Forum Jump :

Author Message


Posts: 7
Rank:


Level: Member

Country: hu
Location: Szeged
Occupation: student
Age: 25
In-game name:

 
#1 Posted at 2011-02-26 19:51        
     
Hi there, guys. Using all the knowledge I gained in scripting (which is pathetically little) I tried to write a reinforcement script.
I used plenty of ideas from several scripts and examples and the bastard works, more or less.
Here is the file which contains the problem:


player removeAction actreinforcements;

unmarked = true;
hint "Mark a reinforcement point on your map";
onMapSingleClick "point setpos _pos; unmarked = false";
waitUntil {!unmarked};

_marker= createMarker ["rfpoint",getpos point];
_marker setMarkerPos getpos point;
_marker setMarkerColor "ColorBlue";
_marker setMarkerType "Flag";
_marker setMarkerText "Reinforcement point";
hint "Reinforcement point marked";

infantry= player addAction ["Requesting infantry","troops\infantry.sqf"];
armored= player addAction ["Requesting armored support","troops\armored.sqf"];
transport= player addAction ["Requesting transport","troops\transport.sqf"];
air= player addAction ["Requesting air support","troops\air.sqf"];



I guess I don't have to explain, but still:
Once I executed the action I have to mark a spot on the map, the marker appears, and I can go on bringing in reinforcements.


Now, for my problem:
Every time I use the action the first time, everything is fine. When I try executing it again, the marker just stays where it was.
The troops that arrive spawn where I clicked the second time, so it's only the marker itself that causes this issue.


Still, it would be great if the marker's position changed.

So, can anyone help me out with a solution?
As you can see, I am no expert, so go easy on me.


Thanks in advance

By the way, many thanks for Norrin's air taxi scripts, too, analysing them gave the first push to try something new (for me, at least).


Author Message

palyarmerc  

I live inside the editor


Posts: 753
Rank:


Level: Member

Country: uk
Location:
Occupation: *Retired from ArmA*
Age:
In-game name: Paly

 
#2 Posted at 2011-02-26 23:22        
     
Have you deleted the original marker anywhere in your script? You can only have one marker with the same name at any one time

waitUntil {!unmarked};
deleteMarker "rfpoint";
_marker= createMarker ["rfpoint",getpos point];

....that's all folks....!

Advertisement


Author Message


Posts: 67
Rank:


Level: Member

Country: ca
Location:
Occupation:
Age:
In-game name:

 
#3 Posted at 2011-03-02 21:17        
     
You may find it easer to create the marker befor the mapclick, while using the mapclick to set the position of the marker.

Example
//  -delete the marker even if it does not exsits yet.
[b]DeleteMarker[/b] "rfpoint";

//  -Create the new marker.
_marker= [b]createMarker[/b] ["rfpoint",[0,0,0];
_marker setMarkerColor "ColorBlue";
_marker setMarkerType "Flag";
_marker setMarkerText "Reinforcement point";

//  -Get the Map click.
GetClick = true;
hint "Mark a reinforcement point on your map";
onMapSingleClick { "rfpoint" [b]SetPos[/b] _Pos; GetClick = false;
waitUntil {!GetClick};

hint "Reinforcement point marked";

There is something I think you may want to remove, The "unmarked = false;" and "waitUntil {!unmarked};" are not needed, however are needed if you intend on marking more then one positon at a time, you may want to consider a wait until map is closed kinda thing.
 WaitUntil {![b]VisableMap[/b]}; 

here is an example I have created for you.

//  -The script is called.

//  -delete the marker even if it does not exists yet.
[b]DeleteMarker[/b] "RefLz";

//  -Create the new marker.
_marker= [b]createMarker[/b] ["RefLz",[0,0,0];
_marker setMarkerColor "ColorBlue";
_marker setMarkerType "Flag";
_marker setMarkerText "Reinforcement point";

//  -Open the map for Input.
[b]showMap[/b] True;

//  -Get the Map click.
Hint "Mark a reinforcement point on your map";
[b]onMap[/b]Single[b]Click [/b]{"rfpoint" [b]SetPos[/b] _Pos};

//  -Wait until the map is closed before continuing.
waitUntil {![b]VisableMap[/b]};

//  -Clear the Mapclick Handle.
onMapSingleClick "";

//  -[b]run[/b] your code.

I did not test this but I am sure if gives the idea.