Jump to content
GodsFist

Help with scripting.

Recommended Posts

Hello all,

i m making mp missions for our server and do almost everything in the eden editor.

I want to try and begin with learning scripting. I know a few things by looking at other scripts but now i want

to start slowely begin making my own scripts but.....

do not know how to begin so here's my question:

Is there someone who can make me a simple script so i can learn from that?

 

Their are 2 pow's in a cage that we have to resque.

When the pow are outside the cage they have to run to a wp and wait for a Heli evac that starts flying to the Pows

When the heli lands the pow get in and the heli waits till they are in.

When the pow are inside it should fly to a safe wp.

I hope someone can help me with this.

THANKS!!!

Share this post


Link to post
Share on other sites

No no i want to learn it by myself, but if i see a very easy script than i can figure it out, I read Fockers Arma Scripting

but its not that easy if you want a first script by yourself.

I looked also at a few scripts from other missions but if you startscripting  its a little overwhelming lol.

so with a little easy script i can hopefully see what the basics are.

 

 

Share this post


Link to post
Share on other sites

Without any effort like reading???? If you read more you could see that i already read the "Fockers Arma Scripting"tutorials. and some scripting files,

but never mind, i thought i could ask a simple question over here.

 

Share this post


Link to post
Share on other sites

Now you changed youre answer in "to Understand" but....... Ah forget it its a waste of my time.

Ill figure it out by myself, thx anyway.

Share this post


Link to post
Share on other sites

If you want to start with scripting the example you gave isn't the easiest to begin with.

Having to free hostages, move them into a chopper, all while checking for cases when something goes wrong like a hostage getting killed by a stray bullet or the chopper refusing to land because he spotted hostiles fleeing the scene, too much going on.

Split it up into smaller parts.

Start with the hostage and how to free them, you could do this either by the player being in vicinity to the hostage and then set the mission to won, or by addAction, you could make the hostage play a hostage animation with kneeling, hands tied behind the back, etc.

 

This stuff can get complicated really fast, so better pick an easier example and work your way from there.

 

Cheers

Share this post


Link to post
Share on other sites

Thx grumpy but i think ill stick with the editor for now.

Ill tried it by myself but it won't work.

I can show you if you don't laugh, lol.

 

    pow1 move (getMarkerPos pow1Heli1Land);
        sleep 1;
    pow1Heli1 move (getPos pow1Heli1Land);
        sleep 1;    
    //Wait until pow1 reach the heli
    while {alive pow1 && (pow1 distance pow1Heli1) > 15} do {
        sleep 1;
    };
    //Get in as cargo
    pow1 assignAsCargo pow1Heli1;
    [pow1] orderGetIn true;
    //Move to finalPos
    pow1Heli1 move (getMarkerPos "pow1_final");
    //wait until pow1 reach final dest.
    while {alive pow1 && (pow1 distance (getMarkerPos "pow1_final")) > 20} do {
        sleep 1;
    };

 

pow1 is the P.O.W ofcourse.

and the  pow1Heli1 is de evac heli.

and the  pow1Heli1Land is de landing marker

As you can see I don't know how to build a script HAHA.

 

But for now i stick by the editor.

Share this post


Link to post
Share on other sites

I actually loathe the editor.

If you want to activate something via custom radio action, you have to connect the trigger to the unit.

But not with "set trigger owner" as one might think, "sync to" is the correct command.

Weird as heck.

 

Handling multiple tasks with triggers, task modules and whatnot can be tiresome pretty fast.

 

Also don't use markers, use invisible helipads to make a chopper land exactly where you want it to land, otherwise it might fly over 400m away to a more fitting location.

No need for all the sleeps and the while loop in your example, this will make the pow1 unit board the chopper and the chopper fly to [0,0,0] after pow1 is in cargo:

 

  1. Place chopper named pow1heli1 mid air
  2. Place civ unit named pow1
  3. Place helipad where you want the chopper to land
pow1 assignascargo pow1heli1;
[pow1] ordergetin true;
systemchat "Waiting for chopper to land";
_somethingSomething = [] spawn {

	waituntil {pow1 in crew pow1heli1};
	pow1heli1 move [0,0,0];
	systemchat "Moving to [0,0,0]!";
};

Cheers

Share this post


Link to post
Share on other sites
5 hours ago, Grumpy Old Man said:

I actually loathe the editor.

If you want to activate something via custom radio action, you have to connect the trigger to the unit.

But not with "set trigger owner" as one might think, "sync to" is the correct command.

Weird as heck.

 

 

Not sure that works as you say. Are you speaking about radio trigger?

 

I did some tests and there is no change at all: a radio alpha trigger stays available for each player (JIP or not). thisList doesn't return anything: []. The radio will fire on every PC.

 

The unique solution to make such trigger local to the "caller" (for caller's position), is to make the trigger "local, without server sync". No way in the editor, you have to script for that with createTrigger (option: effect local). See also   this post.

  • Like 1

Share this post


Link to post
Share on other sites

Interesting, tried it again and seemed to work just fine with just placing a trigger and setting to radio alpha.

Didn't work before. As I said, I loathe the editor for a reason, heh.

 

Cheers

  • Like 1

Share this post


Link to post
Share on other sites

Grumpy Old Man This worked perfectly.

Thank you very much for you're example.

:drinking2::yay::respekt:

Share this post


Link to post
Share on other sites

I've changed it a little,

 

if (!isServer) exitWith {};

    pow1heli1 engineOn true;
    pow1heli1 setVehicleAmmo 1;
    pow1heli1 setFuel 1;    
        _pow1heli1pilot = driver pow1heli1;
        _pow1heli1pilot setBehaviour "CARELESS";
        _pow1heli1pilot setCombatMode "RED";
        _pow1heli1pilot disableAI "TARGET";
        _pow1heli1pilot disableAI "AUTOTARGET";
        _pow1heli1pilot disableAI "FSM";
        _pow1heli1pilot allowFleeing 0;
        _pow1heli1pilot enableAI "MOVE";
        
        _pow1heli1pilot move (getPosATL pow1);
        _pow1heli1pilot action ["lightOn", pow1heli1];
        _pow1heli1pilot action ["CollisionLightOn", pow1heli1];
    
    pow1heli1 flyInHeight 25;

    pow1 assignascargo pow1heli1;
    [pow1] ordergetin true;

sleep 5;

    _output =
    "<t color='#04f214' size='0.6' font='PuristaLight' shadow='1'>P.O.W EVAC is airborn.</t>"+
    "<t color='#04f214' size='0.6' font='PuristaBold' shadow='1'> E.T.A 60 seconds. </t>";
    [[_output, 0, 1, 8, 1],"BIS_fnc_dynamicText"] call BIS_fnc_MP;    
        _powEvac = [] spawn {

        waituntil {pow1 in crew pow1heli1};
        pow1heli1 move [2556,4499,0];
        
sleep 15;

    _output =
    "<t color='#04f214' size='0.6' font='PuristaLight' shadow='1'>P.O.W is safe.</t>"+
    "<t color='#04f214' size='0.6' font='PuristaBold' shadow='1'> Heading out to base. </t>";
    [[_output, 0, 1, 8, 1],"BIS_fnc_dynamicText"] call BIS_fnc_MP;

sleep 60;

    {deleteVehicle _x} foreach crew pow1heli1; deleteVehicle pow1heli1;    

};

 

And it's working perfect.

Again THANK YOU!!!!

  • Like 1

Share this post


Link to post
Share on other sites

@GodsFist

Quick tip: make sure to private local variables:

_local = "Local String";
//versus
private _local = "Local String";
//and when passing variables you can use params
params["_local"];
//which will already be sent to the most inner scope like private does

 

Share this post


Link to post
Share on other sites

Maibe he put it in wrong thread by mistake? Nah he mentioned your name, so not wrong thread. We are missing some context here obviously.

  • Like 1

Share this post


Link to post
Share on other sites
_pow1heli1pilot = driver pow1heli1;

It's a local variable, I was explaining that private should be applied to these local variables.

Share this post


Link to post
Share on other sites

More explanation might be needed. 

Like why? Whats the benefit?

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

×