Jump to content
Sign in to follow this  
darkxess

Planned Chopper Insertion

Recommended Posts

Ok, ive got my chopper in the editor all crewed up, my squad of men in the chopper too, also the waypoints etc set for where the chopper will drop off

the men and then (choppers) will fly away and delete. All I want now is a way for the Chopper, Crew, and Squad to be hidden in the mission until ive hit a

trigger for them to spawn and then carry out there mission (waypoints etc). Ive tried numerous ways ie: Editor based AI script by trigger and also cB AI Unit Caching

but with problems from them both. Can anyone help me with a simple way to do what I want please?

Thanks.

Share this post


Link to post
Share on other sites
hideObject would be my first guess here. Creating a trigger that hides the helo until insertion should work fine. Note though that this is just local and has to be executed server-side, look through the comments for more info on that.

Share this post


Link to post
Share on other sites
hideObject would be my first guess here. Creating a trigger that hides the helo until insertion should work fine. Note though that this is just local and has to be executed server-side, look through the comments for more info on that.

This is of course for a single player mission .. so the local/server side thing is no problem im guessing.

Reason im asking for help here is ive no idea, so how would I exactly implement it with hideObject ?

Thanks

Edit: with reading about the "hideObject" info on the link, its saying that it will still be heard, and smoke from engines etc are still there,... its not exactly what im wanting.

Really I just want the units not there at all (cached) and then spawn as I hit the given trigger which ive put.

Share this post


Link to post
Share on other sites
hideObject would be my first guess here. Creating a trigger that hides the helo until insertion should work fine. Note though that this is just local and has to be executed server-side, look through the comments for more info on that.

That comment in Wiki is incorrect, if the effects of the command are local then it must be executed in every machine so it has global effect.

If it is run only on the server machine, it will only be hidden on the server, while clients still see it.

Share this post


Link to post
Share on other sites

@Dark

How close are you spawning the helo to the player? If it's far away it shouldn't be an issue, but if it is close, enableSimulation might be helpful since this freezes the object into place, so it won't emit any sound or dust etc. I'm not sure whether this causes the object to behave like a stone or if it truly freezes it in place though.

Share this post


Link to post
Share on other sites
@Dark

How close are you spawning the helo to the player? If it's far away it shouldn't be an issue, but if it is close, enableSimulation might be helpful since this freezes the object into place, so it won't emit any sound or dust etc. I'm not sure whether this causes the object to behave like a stone or if it truly freezes it in place though.

Anywhere is ok, even right at the edge of the map (chernarus). Though my problem is, this mission is BIG and im wanting the best performance ie: lack of lag! so cacheing the units would work best

but like I linked, they both have problems with cacheing (choppers). I have tried so much with other ways but always failed so im seeing now if there is any other way even if it was to have them scripted to be spawned once triggered.

Share this post


Link to post
Share on other sites

why not just wait until you need them, and THEN spawn them and head into the action?

Share this post


Link to post
Share on other sites

Why don't you just create the helo, crew, and waypoints when the time arises?

---------- Post added at 11:01 ---------- Previous post was at 11:01 ----------

panther ninja'd me!

Share this post


Link to post
Share on other sites
why not just wait until you need them, and THEN spawn them and head into the action?

Its what I want! but... I only want them to spawn once ive hit the trigger. For instance, I enter a town and then trigger the choppers - they then come and drop off the

special forces (groups in the chopper) to the town and they then do as they should do - "clear the town". The only part ive not got figured out is to have the spawned units (choppers with groups)

not start the game until triggered.

Share this post


Link to post
Share on other sites

Just something I've thrown together real quick:

_usgrp = ["USMC_Soldier","USMC_Soldier","USMC_Soldier","USMC_Soldier"]; //variable containing all soldiers
_helo = createvehicle ["CH47_EP1",getmarkerpos "chspawnpos",[],0,"FLY"]; // spawns vehicle
_helopilot = createUnit ["USMC_Soldier_Pilot",getmarkerpos "chspawnpos",[],0,"NONE"]; // spawns pilot
_helopilot moveInDriver _helo;
waitUntil {!isNil "BIS_fnc_init"};
_ussoldiers = [getmarkerpos "chspawnpos", WEST, _usgrp] call BIS_fnc_spawnGroup; //Spawns a group of soldiers, look up the function on the BIKI for further reference.
{_x moveincargo _helo} foreach units _ussoldiers; // Moves the group into the cargo of _helo;

/*
Add waypoints etc with 
addWaypoint
setWaypointBehaviour
setWaypointStatements
etc

Also include additional stuff if you want 
*/

You can call it with something like this:

nul = [player] execVM "helospawn.sqf";

In the trigger, ofcourse.

Above script is untested, should work though. You need the Functions module on the map for it.

Share this post


Link to post
Share on other sites

Ok.... so I save that script obviously as "helospawn.sqf". Put a trigger in the editor and "On Act" put this: nul = [player] execVM "helospawn.sqf";

Put the script in my missions folder and thats it? anything else im missing :P

Share this post


Link to post
Share on other sites

You have to create waypoints too, in the script. Read Mr.Murrays Editing guide DarkXess. You should get a grasp on simple/normal SP commands. Especially, If you're building SP missions as you say, then that guide is like your editing bible. You'll pretty much be able to do anything you can think of as far as a SP mission is concerned. ie; chopper insertion & extraction. Creating units, waypoints etc

That will make Sp mission making far more enjoyable for you.

Share this post


Link to post
Share on other sites

My script only spawns the stuff you need, and as Iceman says, you'll need to add waypoints via addWaypoint and other stuff (you can look this up in the BIKI).

Share this post


Link to post
Share on other sites

The waypoints and creating units etc is no problem, like I said its just spawning these already set units which is my problem. It was all going well until the

chopper refuses to work with "Editor based AI spawn script" like ive said here but still with no answer to how to fix it :(

Thanks anyways guys

Share this post


Link to post
Share on other sites

But why don't you ditch the "Editor based AI spawn script" for this particular instance, and simply create the vehicle,crew & waypoints you need? Unless I'm not understanding the problem correctly...

Share this post


Link to post
Share on other sites
But why don't you ditch the "Editor based AI spawn script" for this particular instance, and simply create the vehicle,crew & waypoints you need? Unless I'm not understanding the problem correctly...

I understand, just my knowledge of scripting is poor and its much easier for someone like me to just put "such&such.sqf" and the stuff spawn like it should do, lol.

You are understanding, just im being awkward with my stupid inability to script well, sorry.

Share this post


Link to post
Share on other sites
The waypoints and creating units etc is no problem...

LOL, Dark you're confusing me now! Like I said, step back for a minute. Go get the editing guide. Take the time to read through it front to back at least one time. Start a new mission called "scriptTest".Use this folder/map to try out the scripts that you write. It also serves as a personal script / snippet repository with working examples. Start out with simple hint "hello world". Work your way through the guide and try all of the statements/code out in your testmission.

Then you'll be on my level.. which is still really really bad, but at least things like this wont be a problem for you in the future.

Share this post


Link to post
Share on other sites

Just thought I'd throw this in here:

addWaypoint

Check out that link. Go through the other links below ("See also" section).

It should look like this when adding a waypoint (specifically for helos):

_usgrp = ["USMC_Soldier","USMC_Soldier","USMC_Soldier","USMC_Soldier"]; //variable containing all soldiers
_grp = createGroup WEST; // This creates an empty group for us to use when spawning the helo pilot (ADDED THIS)
_helo = createvehicle ["CH47_EP1",getmarkerpos "chspawnpos",[],0,"FLY"]; // spawns vehicle
_helopilot = _grp createUnit ["USMC_Soldier_Pilot",getmarkerpos "chspawnpos",[],0,"NONE"]; // spawns pilot
_helopilot moveInDriver _helo;
waitUntil {!isNil "BIS_fnc_init"};
_ussoldiers = [getmarkerpos "chspawnpos", WEST, _usgrp] call BIS_fnc_spawnGroup; //Spawns a group of soldiers, look up the function on the BIKI for further reference.
{_x moveincargo _helo} foreach units _ussoldiers; // Moves the group into the cargo of _helo;

_helowp = _grp addWaypoint [getmarkerpos "helowp1",0]; //Adds a basic waypoint at the marker position of helowp1 (I guess you know your way around the editor)
_helowp setWaypointBehaviour "CARELESS"; // As you can see we access the waypoint via the variable given to it (_helowp) so we can modify the waypoint. A basic waypoint often isn't enough
_helowp setWaypointCombatMode "BLUE"; // This tells the unit to never fire (important so the helo doesn't go nuts in case of insertion / extraction).
_helowp setWaypointType "TR UNLOAD"; // Sets the type of WWaypoint (this defines whether it's a "Move", "Get In" or whatever kind of waypoint. Important.

The above waypoint is pretty much what you need for the helo to land and unload.

If you're interested in super simple stuff and precise landings and all that check out Mando Heliroute for ArmA2.

This allows for precise movements and allows the AI to land on buildings and whatnot. I definitely recommend this over making your own waypoints and so on.

The above waypoint is a really simple waypoint

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×