Jump to content

Recommended Posts

So I've started coding around for the first time in the eden editor yesterday and I've been experimenting with a vehicle rearm script.

This script rearms one ammo of each pylon each second after it was triggered triggered, or at least that's what it's supposed to do.

        _veh = thisList select 0;
        _add = 1;
        _pylons = getAllPylonsInfo _veh;
        while {true} do{
            hint "loading ammo..";
            {_veh setAmmoOnPylon [(_x select 0), _add]}  forEach _pylons;
            _add = _add + 1;
            sleep 1;

The problem that I have encountered is that I have tried spawning this code to use the wait function without success. The errors tell me that not only is _pylons (and possibly other variables) not defined, but also the fact that there are local variables in a global space... which I searched around and "fixed" using the call function.
To clarify, I did spawn it with proper arguments and after I used the params function, to no avail.

I'd be grateful if someone could help me with this predicament, as I'm not very experienced in coding. (even less than a day of active coding eperience)

Share this post

Link to post
Share on other sites

thisList works only for triggers' condition or activation code, for preset condition only (like Blufor present).

Firing (vehicle) can fire an event handler : fired.


In single player:

So you need to script for the vehicle, let's say from in init field of an helo (in editor):

ALLPYLS = getAllPylonsInfo this;
this addEventHandler ["Fired", {
  params ["_veh"];
  {_veh setAmmoOnPylon [_x#0, _x#4]} forEach ALLPYLS;

That's a kind of infinite ammo on pylons.

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