rekrul 7 Posted September 20, 2009 (edited) I'm very new to editing so the logics and possibilities are mostly unknown to me. There's basically two things I'm trying to do. 1) A team lasers a tank and calls in airstrike with the radio. The AV-8B (which until then has been idling on the airstrip) gets a waypoint at the point the team lasers. This might be too advanced so just setting the waypoint to where the laserteam is, is fine. When I'm the laser-guy, this works fine as I can use position player, but when I'm the pilot, or if it's a multiplayer I guess, it's a problem. So I've tried giving the laser team a group name with "razor=group this;" on the team leader (do I have to apply it to all members?), the AV-8B gets "striker=group this"; and then I made a radio trigger with this in the On Act. field: pos=getpos razor; WP=striker addWaypoint [position pos,0];" but it doesn't work. I've also tried the teamleader's name since getpos is meant for objects, buildings or soldiers, but it doesn't help either. 2) I want the same team to mark a LZ for some choppers (and get the choppers there). I've made a group of two UH-1Ys, called "transport". Then I made a radio-trigger with this in the On Act. field titleText ["Mark LZ on map!","plain"]; bravoclick=true; onMapSingleClick " transport addWaypoint [_pos,0]; ""LZ"" setMarkerPos _pos; bravoclick=false "; waitUntil{!bravoclick}; onMapSingleClick ""; titleText ["Debug-text: Done","plain"]; Hint "Roger, we're Oscar Mike"; (Added space and enters for easier reading.) When I hit 0-0-2 I immediately get "Debug-text: Done" and "Roger, we're Oscar Mike" without marking anything on the map. What am I doing wrong? ---------- Post added at 04:32 AM ---------- Previous post was at 03:58 AM ---------- Hmmm, ok this is weird. I kept playing around with it and now I use this: titleText ["Mark LZ on map!","plain"]; onMapSingleClick " transport addWaypoint [_pos,0]; ""LZ"" setMarkerPos _pos "; titleText ["Done!","plain"]; As I hit 0-0-2, I get "Done!" immediately but when I click on the map, the LZ-marker moves and so do the choppers. However, every time I click on the map, the marker and choppers move, so I guess that's why I need the onSingleMapClick ""; at the end. But how do I get it to wait for my mapclick? Edited September 20, 2009 by Rekrul Share this post Link to post Share on other sites
JDog 11 Posted September 20, 2009 (edited) 1) No you don't have to apply it to all members, just the squad leader is fine. You have the syntax correct for addWaypoint, unsure why it wouldn't work if you use a single unit's position (can't get group pos returned). 2) Not sure about the waiting part. EDIT: ok I got it, this is what you're looking for: titleText ["Mark LZ on map!","plain"]; onMapSingleClick " transport addWaypoint [_pos,0]; 'LZ' setMarkerPos _pos; onMapSingleClick ''; titleText ['Done!','plain']; "; You just wanted it all wrapped around the main onMapSingleClick command. That'll get it to wait til the map is clicked to execute the rest. Edited September 20, 2009 by JDog Share this post Link to post Share on other sites
rekrul 7 Posted September 20, 2009 Great, thanks! Has this changed lately though? Cause all examples I have seen have some sort of variable that is halting the script until the map is clicked. Share this post Link to post Share on other sites
rekrul 7 Posted September 20, 2009 (edited) Ok, I finally figured out that waitUntil is for scripts so in the on Act field I put [] exec "lz.sqs"; I also tried calling it sqf, I really don't know the difference but it didn't matter. Here's my lz.sqs/.sqf: waitclick=true; titleText ["Mark LZ on map!","plain"]; onMapSingleClick " transport addWaypoint [_pos,0]; 'LZ' setMarkerPos _pos; waitclick=false; onMapSingleClick ''; titleText ['done','plain']; "; waitUntil {!waitclick}; hint "test!"; exit; I know that onMapSingleClick ''; should be outside the first one, this was just to test. Still, when I hit 0-0-2 now, I get Done and test! immediately, marker nor choppers are moving. Also, for whatever reason, the AI in the AV8B is driving forward on the airstrip. It's not taking off or anything, it's just driving straight ahead... Edited September 20, 2009 by Rekrul Share this post Link to post Share on other sites
JDog 11 Posted September 20, 2009 (edited) The difference between sqs and sqf does matter lol. That's an sqf file you have there, so give it the .sqf extension. And to call an .sqf file, you use nul=[] execVM "filename" not []exec "filename" Don't see why you don't just use the one I posted >.> fits in a trigger condition without need for a script and is shorter, both better for processing probably (though of course a trivial amount). Also you dont need "exit;" in sqf. Edited September 20, 2009 by JDog Share this post Link to post Share on other sites
rekrul 7 Posted September 21, 2009 Well, the reason is that I plan to do a lot more with the trigger, I just stranded on the point where common sense failed. ;) Share this post Link to post Share on other sites
rekrul 7 Posted September 29, 2009 (edited) I changed my mapclick from boolean to integer and that helped, but now I have a different type of problem. Does CreateVehicle use a different type of position than other things? I've changed my script to this: mapclick=0; titleText ["Mark LZ on map!","plain"]; onMapSingleClick " LZpos=_pos; transport addWaypoint [LZpos,0]; 'LZ' setMarkerPos LZpos; mapclick=1; titleText ['ferdig','plain']; "; waitUntil {mapclick>0}; onMapSingleClick ""; LZsmoke = "SmokeShellRed" CreateVehicle LZpos; hint "launching smoke"; exit; Everything works except the smoke. If I change it to this: mapclick=0; titleText ["Mark LZ on map!","plain"]; onMapSingleClick " LZpos=_pos; transport addWaypoint [LZpos,0]; 'LZ' setMarkerPos LZpos; mapclick=1; titleText ['ferdig','plain']; "; waitUntil {mapclick>0}; onMapSingleClick ""; [b]LZpos=position player;[/b] LZsmoke = "SmokeShellRed" CreateVehicle LZpos; hint "launching smoke"; exit; Then the smoke grenade at appears but obviously where I am, not at the LZ so are there different types of positions? I've tried just using _pos as well and I've tried using the marker "LZ" as pos but I'm not sure if I can since I'm not sure it's an object? Also, I don't know if it needs "LZ" or just LZ or what. Edited September 29, 2009 by Rekrul Share this post Link to post Share on other sites
JDog 11 Posted September 29, 2009 (edited) 'LZ' setMarkerPos LZpos; You need more than just that line to create a marker and have it appear on the map. Try createMarker, setMarkerType, etc. I don't know that setMarkerPos will create a new marker if the one you use in it doesn't yet exist, so not sure that line is doing anything. Going by your issue of getting the smoke to appear only when making it on position player, maybe you can't use the returned value from _pos for it. I'd guess that's not the case, I don't know, just throwing it out there. Edited September 29, 2009 by JDog Share this post Link to post Share on other sites
rekrul 7 Posted September 29, 2009 I already have a marker called LZ, so that part works. It's basically a lazy/simple man's implementation as I'm very new to this and don't want to try everything at once. It seems as createVehicle requires a different format than it gets from _pos though although I can't imagine why. I also realize that it was too late when I posted that and should of made a separate thread for it. Share this post Link to post Share on other sites
Prittstick 10 Posted October 9, 2009 I'm trying to do something similar, get a helicopter to go somewhere when I call it on the radio. made a radio trigger and pasted this into the OnAct field: titleText ["Mark LZ on map!","plain"]; onMapSingleClick " transport addWaypoint [_pos,0]; 'LZ' setMarkerPos _pos; onMapSingleClick ''; titleText ['Done!','plain']; "; And I renamed the chopper Transport. When I press 0-0-2, text comes up asking me to click on the map to place the LZ, but when I click nothing happens. Anyone have any idea what im doing wrong? Share this post Link to post Share on other sites
rekrul 7 Posted October 10, 2009 You're missing a " from the first one. I haven't tested this, and I need some Zzzs now, but try this: titleText ["Mark LZ on map!","plain"]; onMapSingleClick " transport addWaypoint [_pos,0]; 'LZ' setMarkerPos _pos "; onMapSingleClick "''; titleText ['Done!','plain']; Share this post Link to post Share on other sites
Prittstick 10 Posted October 10, 2009 You're missing a " from the first one. I haven't tested this, and I need some Zzzs now, but try this:titleText ["Mark LZ on map!","plain"]; onMapSingleClick " transport addWaypoint [_pos,0]; 'LZ' setMarkerPos _pos "; onMapSingleClick "''; titleText ['Done!','plain']; Thanks for the response, but it says 'Missing ""' when I put that in. Share this post Link to post Share on other sites
rekrul 7 Posted October 10, 2009 (edited) mapclick=0; onMapSingleClick " transport addWaypoint [_pos,0]; _ret=if (LZ_marker < 1) then { var = createMarker ['LZ', _pos]; hint 'Marker made'; [u]LZ_marker=1;[/u] 'LZ' setMarkerType 'Heliport'; 'LZ' setMarkerColor 'ColorRed'; 'LZ' setMarkerSize [1,1]; 'LZ' setMarkerText 'Chopper LZ'} else { hint 'No marker made!'; 'LZ' setMarkerPos _pos }; mapclick=1; "; waitUntil {mapclick>0}; onMapSingleClick ""; titleText ['Done!','plain']; In your init.sqs, or init field of the player put "LZ_marker=0;" (without ""). This is a variable I use to check if I have made the LZ marker or not. If I haven't, I create it. If I have already made it, I move it. You can use boolean instead but I never seem to get the checks right. Mapclick is a variable I use to check if player has clicked the map. Again it's integer since I can't get booleans working. Edit: Whoops, I somehow removed the LZ_marker=1; line. Edited October 12, 2009 by Rekrul Share this post Link to post Share on other sites
Tom1 10 Posted October 3, 2011 I'm sorry I am having trouble following this thread, I have a similar question: I have a group of survivors of a helicopter crash trying to evade enemy patrols until the rescue chopper arrives and they can signal the chopper. I want three groups of enemy soldiers in the area to start moving towards the current position of the survivors, I am doing this by adding a marker to the survivor group ("rungroup") and then every 5 minutes creating a new marker on the survivor group. sleep 60; _marker = createMarker ["Marker1", position rungroup]; sleep 300; _marker = createMarker ["Marker2", position rungroup]; sleep 300; _marker = createMarker ["Marker3", position rungroup]; sleep 300; etc etc Every 5 minutes I want the enemy patrols' waypoint to update its position to the newly created waypoint. The problem is, I have no clue how to use scripts to create waypoints on a markers position. I am confused when it comes to stuff like putting "getMarkerPos" inside one of my scripts. Can someone please show me how I would add a waypoint for "badgroup1" on "Marker1"? Thanks in advance :) Share this post Link to post Share on other sites