Home   Help Search Login Register  

Author Topic: MP Parameters Example (Accepted)  (Read 10247 times)

0 Members and 1 Guest are viewing this topic.

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
MP Parameters Example (Accepted)
« on: 27 Aug 2009, 18:08:33 »
I put together an example of how to setup the new feature provided by the latest beta patch that allows you to include more then 2 params options in the description.ext.

I've also included a short tutorial on the subject. If you feel I need to include anything else let me know!


Tutorial
Example Mission

Basically the new addition is the params class within the description.ext.

Code: [Select]
class Params
{
        class DayTime
        {
//paramsArray[0]
                title = "Time Of Day";
                values[] = {0,16,8};
                texts[] = {"Dusk","Midday","Dawn"};
                default = 16;
        };
        class Revive
        {
// paramsArray[1]
                title = "Number of Revives:";
                values[] = {2000,1000,20,10,7,5};
                texts[] = {"No Revive","Infinite - Cadet","20 - Easy ","10 - Normal","7  - Hard","5  - Extreme"};
                default = 20;
        };
class Grass
        {
// paramsArray[2]
                title = "Grass Options";
                values[] = {0, 1, 2};
                texts[] = {"NoGrass", "Medium", "Normal"};
                default = 0;
        };
};
« Last Edit: 15 Sep 2009, 21:00:27 by hoz »
Xbox Rocks

Offline i0n0s

  • Moderator
  • *****
Re: MP Parameters Example (Accepted)
« Reply #1 on: 28 Aug 2009, 01:13:56 »
 :good: :clap:

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: MP Parameters Example (Accepted)
« Reply #2 on: 28 Aug 2009, 01:33:50 »
I love it. About time BIS expanded the amount of parameters  :good:

Offline norrin

  • Tutorial Writer
  • **
Re: MP Parameters Example (Accepted)
« Reply #3 on: 28 Aug 2009, 03:34:55 »
Sounds great and this will be enormously useful in expanding the player's options in the lobby.  Thanks for sorting out our little problem mate. :)

Offline Dr Eyeball

  • Members
  • *
Re: MP Parameters Example (Accepted)
« Reply #4 on: 28 Aug 2009, 09:14:48 »
This is great news. BIS must have finally discovered the Arma 2 wish list.

Why isn't this feature mentioned in the beta change logs? (It's only in the readme, which most sites do not include in the announcements.)
« Last Edit: 28 Aug 2009, 10:35:18 by Dr Eyeball »

Offline kju

  • Members
  • *
    • PvPScene - The ArmA II multiplayer community
Re: MP Parameters Example (Accepted)
« Reply #5 on: 28 Aug 2009, 10:14:13 »
It is listed and explained at the end of the readme..  ::)

Offline fleepee

  • Members
  • *
  • Enter the Matrix!
Re: MP Parameters Example (Accepted)
« Reply #6 on: 29 Aug 2009, 10:21:49 »
It doesn't work in my mission or the example mission with my game patched in 1.03...
I've read: "Note: This only works with the latest beta build!"

What version does it need to work?


Offline ferstaberinde

  • Members
  • *
  • I'm a llama!
Re: MP Parameters Example (Accepted)
« Reply #8 on: 07 Sep 2009, 10:05:14 »
Encountered a possible bug today, wondered if anyone else can vefrify before I report to BIS:

Steps to repeat (A):

1. Create a mission with at least 2 parameters using the new class-based method described by Hoz.

2. Ensure the default value of your first parameter is not 0 (zero).

3. Ensure that you do not set or define the old-school Param0/Param1 variables.

4. In a script, get the value of your first parameter using the command: (paramsArray select 2)

5. Test the mission on your LOCAL NON-DEDICATED server.

Expected behaviour: The script should return the selected value for your first parameter.

Actual behaviour: The script returns the value 0 for your first parameter, regardless of your  selection in the mission parameters screen.

++++

Steps to repeat (B):

1-4. As per (A) above.

5. Test the mission on your REMOTE DEDICATED server.

Expected behaviour: The script should return the selected value for your first parameter.

Actual behaviour: As per expected behaviour.

++++

So it works on dedicated server, but not on a non-dedicated server. Anyone else encounter this?

Note: I am using v1.03.58972

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: MP Parameters Example (Accepted)
« Reply #9 on: 07 Sep 2009, 13:41:10 »
Ok, tested this, and in SP and in MP host mode paramsArray is always of size x - 2 (because they're missing param1 and param2). In dedicated mode param1 and param2 are put in the beginning of the paramsArray, causing all the index values to shift by 2.

I can't really see this as desirable behaviour (even by BIS standards), so it's probably a bug.


Btw fer, I don't get a 0 value like you do, but since you only use 2 parameters (paramsArray[0] and paramsArray[1], because in SP and MP host mode param1 and param2 are not included), you are actually grabbing an out of bounds value.
« Last Edit: 07 Sep 2009, 13:49:25 by mikey »

Offline ferstaberinde

  • Members
  • *
  • I'm a llama!
Re: MP Parameters Example (Accepted)
« Reply #10 on: 07 Sep 2009, 15:19:38 »
Alright, nice to know I'm not going mad. I'll drop BIS a note ...

Offline mikey

  • Former Staff
  • ****
  • Whitespace Whore
Re: MP Parameters Example (Accepted)
« Reply #11 on: 15 Sep 2009, 17:30:18 »
Seems like that worked fer, since it works normally now in 1.04 :good:

Btw, to sum it up for people what changed from the beta to the stable release of 1.04:

In the beta the game put param1 and param2 in the start of the paramsArray when on a dedicated server, and not on a MP hosted machine. This caused the array indices to shift by 2.
Now in the 1.04 dedi param1 and param2 are not put in front anymore, and it works perfectly.

Could you update the example mission hoz?

« Last Edit: 15 Sep 2009, 17:35:21 by mikey »

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: MP Parameters Example (Accepted)
« Reply #12 on: 15 Sep 2009, 21:00:37 »
I did thanks.
Xbox Rocks

Offline Shuko

  • Members
  • *
Re: MP Parameters Example (Accepted)
« Reply #13 on: 19 Sep 2009, 19:27:44 »
Is there a way to get the class name? In your example, "DayTime" or "Revive".

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: MP Parameters Example (Accepted)
« Reply #14 on: 22 Sep 2009, 02:32:05 »
Not sure what you mean 'get the class name'. I suppose it could be gotten with the config commands. Maybe explain a bit further about what you want to do.
Xbox Rocks