3 Commando Brigade

Realism. Tactics. Fun.

+ New Topic + Post Reply
11 posts in this topic
Posted: Sun Nov 10, 2013 11:20 pm     Super secret spam barrier
Quote
Offline

Posts: 186
Ribbons:
Donator (1)

1st 'proper' little project


So I'm bored and would like to put my VERY minimal skills in this area to use but have no idea where to start.

I want to create a very simple mod to ensure the player does not drop mags when they are empty (allowing MagRepack mod to rearm)

It seems like a nice little project to get me used to how Arma works

So basically...

HELP!?

:)

thanks 


Posted: Sun Nov 10, 2013 11:31 pm     Super secret spam barrier
Quote
Offline
Major
Major
Other duties:
Site Admin
Game Admin
Modder
Founder

Posts: 3774
Location: London, UK
Ribbons:
Service Medal (7)
Hmmm, looks like you could use the magazinesDetail and currentMagazineDetail commands to monitor a mag's ammo count. Once it reaches zero the mag could then be re-added to the player's inventory (with an ammo count of zero). Not sure if Arma will automatically throw the empty mag away again though. May need some experimenting ;)

"To achieve great things, two things are needed; a plan, and not quite enough time." - Leonard Bernstein
3CB ops in a nutshell.

PC Specs


Posted: Sun Nov 10, 2013 11:47 pm     Super secret spam barrier
Quote
Offline
1st Lieutenant
1st Lieutenant
Other duties:
Game Admin
Site Admin
Modder
Founder

Posts: 6573
Location: Surrey UK
Ribbons:
Service Medal (7) Media Man (2) Donator (1)
Modding Team (1) Frag of the match (1) Leadership (1)
Public Regular (1) Operation Medal (3)
very nice idea....


Posted: Tue Nov 12, 2013 10:17 am     Super secret spam barrier
Quote
Offline

Posts: 186
Ribbons:
Donator (1)
this!!!

a million times this!!!

http://forums.bistudio.com/showthread.p ... hlight=AKM


Posted: Tue Nov 12, 2013 1:06 pm     Super secret spam barrier
Quote
Offline

Posts: 186
Ribbons:
Donator (1)
OK, so...
As far as I have got it using this http://community.bistudio.com/wiki/magazinesAmmoFull
using this to select the mags which are loaded and are primary or secondary weapon mags (therefore excluding launchers etc ;) )
event handler checks mag ammo after each shot and when 0, a mag of the same variety is input into inventory with an ammo count of 0 (this works, verified) after the reload animation. (this was the only way I could think of doing it AFTER the reload)

Please any suggestions, I'm kind of s**t


Posted: Tue Nov 12, 2013 1:59 pm     Super secret spam barrier
Quote
Offline

Posts: 186
Ribbons:
Donator (1)



_magazines = magazinesAmmoFull
_arrayLength = count _magazines




 
if ((_magazines select i) select 3 == 1) and ((_magazines select i) select 2 == true) then
{
    _pCurMag = (_magazines select i) select 0;
    _pMagAmmo = (_magazines select i) select 1;
}
else
{
    while {i < _arraylength} do
        {i + 1;};  
};



if _pMagAmmo == 0 then
{
    player addMagazine [_pCurMag, 0];
}




*p indicates primary weapon, s will indicate secondary (pistol)

*here are some functions, just need help sorting them out :/ the script is called with


Posted: Tue Nov 12, 2013 2:19 pm     Super secret spam barrier
Quote
Offline
Major
Major
Other duties:
Site Admin
Game Admin
Modder
Founder

Posts: 3774
Location: London, UK
Ribbons:
Service Medal (7)
Looking very good, although I can't see where you've defined "i". I'm assuming you're iterating through every item in the array - i being each iteration number. With every cycle you're increasing i by 1.

You could use a 'for' loop instead, which does this for you automatically. Also be careful not to miss any open and closing brackets (added below).
for "_i" from 0 to _arrayLength do
{
    if (((_magazines select _i) select 3 == 1) and ((_magazines select _i) select 2 == true)) then
    {
        _pCurMag = (_magazines select _i) select 0;
        _pMagAmmo = (_magazines select _i) select 1;
    }
};


Also, the Biki is down at the moment so I don't know exactly what magazinesAmmoFull returns.

"To achieve great things, two things are needed; a plan, and not quite enough time." - Leonard Bernstein
3CB ops in a nutshell.

PC Specs


Posted: Tue Nov 12, 2013 2:30 pm     Super secret spam barrier
Quote
Offline
1st Lieutenant
1st Lieutenant
Other duties:
Game Admin
Site Admin
Modder
Founder

Posts: 6573
Location: Surrey UK
Ribbons:
Service Medal (7) Media Man (2) Donator (1)
Modding Team (1) Frag of the match (1) Leadership (1)
Public Regular (1) Operation Medal (3)
wow - looking good Frosty. I'm not able to help with the scripting, sorry.

But very happy to help bug test etc etc.

Have you contacted the chap who is developing Mag-repack ? Might be an idea to collaborate to prevent doubling up of work load?

Would seem your mod/script would be dependant on his anyway for the "re-filling". But does Mag-repack see your empty mags ok?

Exciting stuff for sure !

SJ


Posted: Tue Nov 12, 2013 3:42 pm     Super secret spam barrier
Quote
Offline

Posts: 186
Ribbons:
Donator (1)
it's kind of clunky, haven't done anything for arma for ages, the last thing I did was java and lua so im getting a bit confused haha.
at the moment the script is called with an event handler on every shot in INIT
I'll check with mag repack


Posted: Tue Nov 12, 2013 5:44 pm     Super secret spam barrier
Quote
Offline
Major
Major
Other duties:
Site Admin
Game Admin
Modder
Founder

Posts: 3774
Location: London, UK
Ribbons:
Service Medal (7)
Looking forward to seeing the results Frosty, an interesting project indeed :)

P.S
I thought it would be an idea to add syntax highlighting to the forums, so I did ;)

"To achieve great things, two things are needed; a plan, and not quite enough time." - Leonard Bernstein
3CB ops in a nutshell.

PC Specs


+ New Topic + Post Reply


Who is online

Users browsing this forum: No registered users and 171 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

phpBB © Forum Software
© 3 Commando Brigade Gaming Community
All images belong to their respective owners


3CB Modern design by Jamie Goodson
WysiBB