OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Rocko Bonaparte on 10 Jan 2005, 07:39:48
-
I'm trying to get SetWPPos to work, and I've never used it before. I believe I'm using it correctly, but the units just don't care where I reposition their waypoints -- they ALWAYS go to the predetermined one instead. Here's the script where I use it:
_crash_site = [[Rescue1, Rescue2, Rescue3, Rescue4, Rescue5, Rescue6, Rescue7, HeliWreck, DeadPilot], CrashBoundTL, CrashBoundBR] call randomly_position
hint format["Crash site is (%1, %2)", _crash_site select 0, _crash_site select 1]
; Initial orders
[group CaptureCrew, 2] SetWPPos _crash_siteI'm using a randomized position there -- the function generates a random position to all those units in that array, and then gives me the base position, which is stored in _crash_site. That hint statement prints it out correctly. Because it's random, I get different results each time, but I get things like:
"Crash site is (3288.4543, 4103.4903)"
To me it sounds like those two coordinates represent a valid position, so I should be able to use it with setWPPos; it doesn't work. Any ideas what I could be doing wrong?
Edit: I feel I left out too much. "CaptureCrew" is defined in the mission.sqm like so: class Item41
{
side="EAST";
class Vehicles
{
items=7;
class Item0
{
position[]={4630.314941,39.599998,3466.399658};
azimut=130.000000;
id=209;
side="EAST";
vehicle="JAM_EBOfficer";
leader=1;
rank="SERGEANT";
skill=1.000000;
text="CaptureCrew";
};
; Lots more items listed here.
};
class Waypoints
{
items=3;
class Item0
{
position[]={4629.698730,39.599998,3473.443848};
id=210;
type="GETIN";
class Effects
{
};
showWP="NEVER";
};
class Item1
{
position[]={5105.652832,219.321716,4109.590332};
type="GETOUT";
combatMode="RED";
formation="LINE";
combat="COMBAT";
class Effects
{
};
showWP="NEVER";
};
class Item2
{
position[]={5105.652832,222.190323,4149.777832};
type="SAD";
class Effects
{
};
showWP="NEVER";
};
};
};and that code block is in init.sqs
-
just make sure your trying to place a waypoint that already exsits, ive had trouble with the SetWPPos b4 when ive tried to Setpos waypoint 2 and the group only has 1 waypoint,
try
[(group CaptureCrew), 0] setWPPos _crash_site
and if not try,
{_x commandmove _crash_site} foreach units (group CaptureCrew)
-
Also check that you have the right index number for the waypoint.
Make a test missionette on Desert Island just to see if you can get the command to work. I frequently do this with commands I haven't used before, having discovered the hard way that it usually saves time in the long run.
-
I think I am referring to waypoint numbers correctly. I included the waypoints with that missions.sqs snippet. If something seems wrong, let me know. I recall reading waypoint 0 is not the first waypoint, so I start from 1 and work up. So I'm trying to reposition the "GETOUT" waypoint.
Something I haven't tried is using the class name instead of the text field for the unit. Is this what I am supposed to do?[Item41, 2] SetWPPos _crash_siteWhere Item41 is the name of the class. I'm at work and can't test it out right now. The code I've included has one of the vehicles named, and I use the group that corresponds to that unit. I've also tried placing a "text=" field right underneath "side=EAST;" and that doesn't work either.
-
I figured out my fundamental problem. I wasn't assigning group names correctly. I thought you could assign a group's name like you would a unit, using a "text=name;" field. I've since learned that no such thing works on groups, and that you need to make the assignment in the init field of a group member.