Jump to content
Sign in to follow this  
thegunnysgt

Lobby Choices

Recommended Posts

I have this in my description file for a selection in the lobby:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">titleParam2 = "Artillery:";

valuesParam2[] = {10000, 0, 1, 2, 4};

defValueParam2 = 2;

textsParam2[] = {"Unlimited", Not Available, One Time, Two Times, Four Times};

How can I use this to force units in-game to limit their ammo according to which is selected: Unlimited, No Ammo, One Shell, Two and so on.

Share this post


Link to post
Share on other sites

hey gunny. I dont really understand what exactly you want to do. To actually LIMIT the ammo you should create a trigger with

player ammo "m16" > textsParam2 (check whether globality works. if not put it into a init.sqs for each client)

but if you want to equip the unit with what you selected you just put the according commands into the init-line of each player.

Share this post


Link to post
Share on other sites

I know it kinda rough to understand, sorry.

I want to be capable to select how much ammo artillery pieces get when selected from the lobby. That way I can change it at will and not have to do edits in the Editor when I want them to get a different amount from game to game.

I hope that helped make it more understandable.

Share this post


Link to post
Share on other sites

Well. Yes.

So you got your Arti-Units somewhere on the map, right? So I suggest you type into their init-lines the ref to a script in qhich you got:

this removeMagazines <span style='color:red'>magazine</span>; for[ { i = 0 },{ i < Param2 },{ i = i + 1 } ] { this addMagazine <span style='color:red'>magazine</span> ; };

<span style='color:red'>magazine</span> Will be the right mag for the Arti. This should work.

If not you should have the plot of what you gotta do i think

Share this post


Link to post
Share on other sites

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">this removeMagazines "SH_125_HE"; for [ { i = 0 },{ i < Param2 },{ i = i + 1 } ] {this addMagazine "SH_125_HE"; };

It gives me an error, any suggestions? I wouldn't know how to even go at this one.

UPDATED: I got no error by inputing do after the ]

Share this post


Link to post
Share on other sites

Uhmmm well whistle.gif off course. Sorry - I didnt code anything for a couple of month now. At least I wanted to give you an idea of what it faut faire to receive a result.

Share this post


Link to post
Share on other sites

Okay, that gave me 4 extra reloads when I selected Four Times from the Lobby list, but I want to only limit them to 4 Shells only. How do I approach this.

And thanks for getting me started. smile_o.gif

Share this post


Link to post
Share on other sites

uhm. difficile story. dunno the exact specs but as long as a mag will contain more than 1,2 or 4 shots it will be hardly makable. cos you cannot equip a unit with a certain number of rounds. you can only equip it with a number of filled mags.

afaik. dunno if there has been introduced a new function which allows to set the ammo per shot.

Share this post


Link to post
Share on other sites

Any way to remove a radio command or trigger after so many times of usage defined by the Lobby Choice?

Share this post


Link to post
Share on other sites

Sure. You got the trigger which make the radio. So you increase a var like

int_triggerAcount = int_triggerAcount + 1;

at the same time you check whether

int_triggerAcount > int_triggerAmax

and if yes:

use setRadioMsg NULL. I hope this will still work for ArmA

Share this post


Link to post
Share on other sites

I am have a hard time understanding what is explained. Could you break it down for me just a bit.

Share this post


Link to post
Share on other sites

BTW: What you probably want to try:

To simulate an amount of ammo you may start with this

//Load "Param2" into something more identificable

_int_ammoStartAmount = Param2;

/*

Calculate how many magazines are at least nessesary to provide the required amount of ammo (3 Shots per mag with 7 Shot required will lead to at least 3 Magazines -> 9 Shots avialable)

*/

_int_reqMagCount = ceil( _int_ammoStartAmount/<span style='color:red'>int_ammoPerMag</span> );

//Fill the Arti with the number calculated above so it has enough ammo

<span style='color:red'>arti1</span> removeMagazines "SH_125_HE";

for [ { _i = 0 },{ _i < _int_reqMagCount },{ _i = _i + 1 } ] do

{

<span style='color:red'>arti1</span> addMagazine "SH_125_HE";

};

/*

Wait until the Arti has fired the amount of shots it has assigned to. Then remove all remaining ammo so it looks like there has only been this certain amount it already fired of. Achieve this by checking the difference between the amount of ammo the Arti has been given initially and the amount the Arti has now. The Amount the Arti has atm can be got thru "( Count of Mags - 1 ) multiplied with the ammo/mag PLUS the ammo in the current mag". Count of Mags MINUS 1 because the not fully filled mag counts as well as a mag

*/

waitUntil

{

( { _x == "SH_125_HE" }count( magazines <span style='color:red'>arti1</span> ) - <span style='color:red'>int_ammoPerMag</span> +( <span style='color:red'>arti1</span> ammo "SH_125_HE" ) ) <= ( <span style='color:red'>int_ammoPerMag</span>*_int_reqMagCount - _int_ammoStartAmount );

};

<span style='color:red'>arti1</span> removeMagazines "SH_125_HE";

Of course I didnt try this either but it should remove all mags from the gun as soon as it has fired its _int_ammoStartAmount rounds.

regards

---edit---

i tell you this day how to deal with the radio but i gotta go to work now.

Share this post


Link to post
Share on other sites

Curious, how can I get this to work or something like it?

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if (ammo = Param2) then (this removeMagazines "30Rnd_105mmHE_M119")

confused_o.gif

Also, how do I tell vehicles to respawn using a script if selected to respawn in the lobby. And what would need to be in the description and init files for it to work as well as in the map to reference the vehicles to the respawn selection or not. I am trying to get it something like Evolution, where you can select 1 Hour days with or without respawn.

Share this post


Link to post
Share on other sites

Mate... you have a lot of questions... I suggest you get a tutorial and learn some stuff on your own wink_o.gif

For the radio:

I think you created a trigger which is used for the "Radio" (Call Alpha etc.) - right?

Now create a script and call it from the triggers onActivation-line. In the script your write:

int_countArtiCalled = int_countArtiCalled + 1;

if( int_countArtiCalled > <span style='color:red'>int_maxArtiCalls</span> )then

{

<span style='color:red'>int_indRadioMsg</span> setRadioMsg NULL;

} else {

//Things that will occur on the Call - such as Arti will shoot

}

int_maxArtiCalls equals the maximum count the trigger will be executed. int_indRadioMsg is the index of your call (0 for A,1 for B, etc.)

---edit---

Your first example doesnt seem to make sense to me. What you actually want to achieve is:

if ... ammo wasted ... equals ... the amount of ammo actually available ... then ... take away all remaining slugs

try to understand the script. take a look in five minutes. i will add some comments for you

Share this post


Link to post
Share on other sites

Yeah I know, I just want to be capable of understanding what it is that I am doing. This is my second mission I am doing and using what I am asking in this forum.

If I could find a tutorial on what I am asking than I would be there and not in the forum so much. But this game doesn't have a whole lot of info out there but what the players create when they edit. I just seem to not be finding any of them or when I do, they are now what I am looking for.

Sorry I am asking so may questions, but a forum is for asking questions, if people think I am asking so much than it is simple, just don't reply.

Quote[/b] ]Your first example doesnt seem to make sense to me. What you actually want to achieve is:

if ... ammo wasted ... equals ... the amount of ammo actually available ... then ... take away all remaining slugs

try to understand the script. take a look in five minutes. i will add some comments for you

What I was thinking with that is changing my variables in the Lobby amounts. Say if I only wanted 1 shell to be fired I would say when the ammo count gets to 29 (Total shells is 30) than removemagazines. If only wanted 4 shells to be fired it would be 26 and so on for the others. Sorry I didn't make it clear enough.

--EDIT--

Success, when selected from the Lobby I can now fire the artillery how ever many times I select and then the magazines go empty.

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">#ammo

if (g1 ammo "M119" <= Param2) then {g1 removemagazines "30Rnd_105mmHE_M119"};

goto "ammo"

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  

×