OFPEC Forum
Editors Depot - Mission Editing and Scripting => ArmA - Editing/Scripting General => Topic started by: IGWedge on 06 May 2007, 18:55:48
-
Hi Guys
Just wondering if someone can tell me what im doing wrong :scratch:
Very basic stuff im sure but as im trying to learn these things come up.
Im just trying to create a group of downed pilots via a script with a downed blackhawk. I also want to disarm the pilots and stop them from moving.
I currently have something like this.
_posmarker = [7975,7286,0];
_grpilot = createGroup (west);
_heli = createVehicle ["BlackhawkWreck", _posmarker, [], 0, "NONE"];
"SoldierWPilot" createUnit [_posmarker, _grpilot];
"SoldierWPilot" createUnit [_posmarker, _grpilot];
_pilot1 = (units _grpilot select 0);
_pilot1 disableAI "MOVE";
_pilot1 allowfleeing 0;
_pilot1 setBehaviour "Careless";
removeallweapons _pilot1;
_pilot1 setCaptive true;
commandStop _pilot1;
_pilot2 = (units _grpilot select 1);
_pilot2 disableAI "MOVE";
_pilot2 allowfleeing 0;
_pilot2 setBehaviour "Careless";
removeallweapons _pilot2;
_pilot2 setCaptive true;
commandStop _pilot2;
Im not gettin any joy..it just isnt doin anything.
Many thanks
Wedge
-
Try this to create your pilots
_posmarker = [7975,7286,0];
_grpilot = createGroup west;
_heli = createVehicle ["BlackhawkWreck", [(_posmarker select 0)+10,(_posmarker select 1)+10,0], [], 0, "NONE"];
_pilot1 = _grpilot createUnit ["SoldierWPilot",_posmarker, [], 0, "FORM"];
_grpilot selectLeader _pilot1;
_pilot1 disableAI "MOVE";
_pilot1 allowfleeing 0;
_pilot1 setBehaviour "Careless";
removeallweapons _pilot1;
commandStop _pilot1;
_pilot2 = _grpilot createUnit ["SoldierWPilot",[(_posmarker select 0)+2,_posmarker select 1,0], [], 0, "FORM"];
_pilot2 disableAI "MOVE";
_pilot2 allowfleeing 0;
_pilot2 setBehaviour "Careless";
removeallweapons _pilot2;
commandStop _pilot2;
_pilot1 setCaptive true;
_pilot2 setCaptive true;
Make sure there are more west units in the map, else you need center = createCenter west;
before executing _grpilot = createGroup west;
-
What doesnt work about this script?
This could be it. Instead of
"SoldierWPilot" createUnit [_posmarker, _grpilot];
"SoldierWPilot" createUnit [_posmarker, _grpilot];
change it to...
_pilot1 = "SoldierWPilot" createUnit [_posmarker, _grpilot];
_pilot2 = "SoldierWPilot" createUnit [_posmarker, _grpilot];
Because you arent naming the pilots, the script will just create the pilots but wont do anything you told them to do.
Edit - Too late >:(
:D
-
Ok i tried doing as you said but its still not working
Its just not creating the units,
I did try this method as it is
unit = group player createUnit ["SoldierWB", position player, [], 0, "FORM"]
and it worked but because i hadnt changed anything within this line it created the pilots and put them in my group.
The thing is, i am on the independant side. The pilots are on the west.
Make sure there are more west units in the map, else you need center = createCenter west;
before executing _grpilot = createGroup west;
Im really not too sure what you mean, i tried placing a west unit out of play somewhere and still nothing. This is obviously where my problems are
A quick explanation... i am making a training map in which you can select the missions you want to try... so really there is nothing else on the map other than the players group...everything else i wanted to create via the script which is executed when the player selects that mission.
So what im unsure of is how to create an existing group that enables the pilots to createunit.
Thanks
-
I've used create group and it runs fine.
Try to attach the function to a global variable.
Group1 = creategroup West
-
The problem with createGroup is that it only works if the corresponding center already exists. Placing units of one side in the editor activates the corresponding center (west, east, civilian ...), but if no units of one side are already present in the map, the center of that side will not exist and createGroup for that side will fail. This is why center = createCenter west; may be necesary.
As an example, if you create a mission where there are only civilians (placed on the map from the editor), any createGroup west or east will fail.
-
Ok
I tried it again usnig west and guerilla, seeing as it is training for the independant ive tried to keep it as this....
I created a group of independant guys to test the other theory...but still no joy
Im assuming the line _grppilot = createGroup (guerilla);
is ok but correct me if im wrong please.
this is what i have now
_user = _this;
_usergroup = (group _user);
hint format ["CSAR: Combat Search And Rescue\nYour mission is to find and rescue 2 downed chopper pilots\nfrom the enemy\n \n \n GOOD LUCK!"];
_grppilot = createGroup (guerilla);
_posmarker = [7975,7286,0];
_pilpos = [7978,7286,0];
_search = createMarkerLocal ["Search", _posmarker];
_search setMarkerColorLocal "ColorGreen";
_search setMarkerShapeLocal "RECTANGLE";
_search setMarkerSizeLocal [400, 100];
_search setMarkerBrushLocal "FDiagonal";
_heli = createVehicle ["BlackhawkWreck", [(_posmarker select 0)+1,(_posmarker select 1)+1,0], [], 0, "NONE"];
"SoldierWPilot" createUnit [_posmarker, _grpilot];
"SoldierWPilot" createUnit [_posmarker, _grpilot];
maybe someone could take a quick look and maybe tell me whats wrong
Ive attached a small example... the script is triggered by radio alpha
many thanks
Wedge
-
Did you create a center named guerrilla? Or is that what you want is to use resistance? If so, AFAIK, the side name is resistance.
-
Ahh cool thats good to know
yes i am using resistance.
Unfortunatly it still does not help me.
When you say center = createCenter west;
i presume this changes to center = createCenter resistance;
Do i put this in the script or in the editor?? i have it in the script and it makes no differance.
did you take a look at that map??
-
Now it works:
_user = _this;
_usergroup = (group _user);
hint format ["CSAR: Combat Search And Rescue\nYour mission is to find and rescue 2 downed chopper pilots\nfrom the enemy\n \n \n GOOD
LUCK!"];
_grppilot = createGroup resistance;
_posmarker = [7975,7286,0];
_pilpos = [7978,7286,0];
_search = createMarkerLocal ["Search", _posmarker];
_search setMarkerColorLocal "ColorGreen";
_search setMarkerShapeLocal "RECTANGLE";
_search setMarkerSizeLocal [400, 100];
_search setMarkerBrushLocal "FDiagonal";
_heli = createVehicle ["BlackhawkWreck", _posmarker, [], 0, "NONE"];
_pilot1 = _grppilot createUnit ["SoldierWPilot",[_posmarker select 0,(_posmarker select 1)-12,0], [], 0, "FORM"];
_pilot1 setDir random 360;
_grppilot selectLeader _pilot1;
_pilot1 disableAI "MOVE";
_pilot1 allowfleeing 0;
_pilot1 setBehaviour "Careless";
removeallweapons _pilot1;
commandStop _pilot1;
_pilot2 = _grppilot createUnit ["SoldierWPilot",[(_posmarker select 0)+2,(_posmarker select 1)-12,0], [], 0, "FORM"];
_pilot2 setDir random 360;
_pilot2 disableAI "MOVE";
_pilot2 allowfleeing 0;
_pilot2 setBehaviour "Careless";
removeallweapons _pilot2;
commandStop _pilot2;
_pilot1 setCaptive true;
_pilot2 setCaptive true;
-
Thats awesome Mate thanks
works a treat.
I have 1 more question.....
i presume if i wanna make the spawn point of the created unit random this will appear differently on everyones system.
Is there an easy way to make it the same for everyone?
-
So is it MP?
If so, place in the map a gamelogic named server. execute the script only if
?local server: execute your script.
This way the script would be executed only in the server, for example placing that in the init.sqs. If you do so, the position may be random but the created units will have the very same position for all the clients.
-
ok i understand what your saying...yes its MP
So i have my "server" gamelogic.
the mission script is called "p_rescue.sqf"
just to clarify I only want the mission script to be run when the team leader wants to (ie radio alpha)...
I also have an init.sqs, is this where i should put it?? ?local server: "p_rescue.sqf"
also...
I am trying to give my enemy some waypoints within the same script it looks something like this.
_patrol1 = _enemy addWaypoint [_wp1, 0];
_patrol2 = _enemyaddWaypoint [_wp2, 0];
_patrol3 = _enemy addWaypoint [_wp3, 0];
_patrol4 = _enemy addWaypoint [_wp4, 0];
_patrol5 = _enemy addWaypoint [_wp1, 0];
[_enemy, 5] setWaypointType "CYCLE";
I keep getting an error saying .....
_wp5 = _enemy |#| addwaypoint [_wp1,0]
error 0 elements provided, 3 expected
Any ideas
Sorry to keep askin stuff but as i sort something somethin else pops up.....gotta learn somehow :confused:
-
Then you dont really need the server check, as you only would execute it in leader machine.
In the radio trigger condition put:
this && (player == leader group player)
In the activation execute your script. That should work.
-
many thanks for that...
i just edited my post above not sure if you saw it
-
What is __enemy with two "_"?
-
What is __enemy with two "_"?
lol sorry bout that, that was not the problem
that is my tired little fingers workin away
its not supposed to be there i edited the typo
_patrol1 = _enemy addWaypoint [_wp1, 0];
_patrol2 = _enemyaddWaypoint [_wp2, 0];
_patrol3 = _enemy addWaypoint [_wp3, 0];
_patrol4 = _enemy addWaypoint [_wp4, 0];
_patrol5 = _enemy addWaypoint [_wp1, 0];
[_enemy, 5] setWaypointType "CYCLE";
-
Did you try:
_patrol5 setWaypointType "CYCLE";
?
-
It doesnt seem to matter what i do i keep getting
error 0 elements provided, 3 expected
Does anyone know what it means/how i can fix it....
I even tried executing it as a seperate "patrol.sqf" but i stil got the same error
-
What is for example _wp1?
addWaypoint requires a position and the placement radius
somesoldier/group addWaypoint [position,radius (in meters)]
If _wpX is not a position it will cause an error..