Jump to content
Sign in to follow this  
tj72

Two Part Question

Recommended Posts

Part 1.

Question:

a. Is it possible to create arrays at runtime that are named Incrementally?

b. Can I create groups at runtime? Do they need to be allready created in the editor. If yes then question 1.a. applies here as well.

Example:

Within a script I want to create an array.

There is a variable called groupcount to start....

Code Sample  

groupcount = 1

Can I name the array as such....

Code Sample  

eg_+"[(groupcount)]" (please ignore syntax error here)

so that the name of the array is eg_01

It is very important to have the two digit structure. I am assuming I can count # of digits in the groupcount variable  and add zero to the array name so that it is correct and not eg_1 but eg_01.

After the array is created.....

Code Sample  

groupcount+1

so the next array created will be eg_02 and so on up to whatever max groups are. Also another set of arrays would have arrayname_001 format so I figure I would add another layer to the same loop as above.

Part 2.

Question:

a.If group names and an array name are the same, how can I reference the array when the group hits a trigger?

I assume Im allowed to have groupnames and array names as the same with no problem.

b.If for some reason I cant. How can I read the group name and reference the array with the same number as the group.?

Example:

Code Sample  

groupname = eg_01

sets off trigger and passes a value into the correct array....

Code Sample  

eg_01 (the array) select 0 = 2

and then that value updates another array....

Code Sample  

mission_02 select 0 = 2 (but this could be something different)

then use that value to say create a gamelogic named Code Sample  

mission_02wp_01

but it could be anything here that is just an example.

The point is that the value of 2 is used in the gamelogics name by pasting it in from the array name.

c.Is it possible to pass the part of an arrays name as a value into another array with generic variables.

Example:

eg_01 is accessed and the value of 1 is passed into a variable of x. Then x is used to access the next array instead of the integer of 1.

Instead of:

Code Sample  

if this select 0 = 1 then goto #function_01

its

Code Sample  

this select 0 = x (or should it be _x? not sure)

goto #function_"[x]" (sic syntax)

or

Code Sample  

this select 0 = x(or should it be _x? not sure)

mission_0+"[x]" select 2 = x+1 (so then the array of mission_02 (if x=2) is accessed at the third point on the array)

Any help with this would be a Godsend for me.

Please let me know if this is not clear enough.

Thanks!

Share this post


Link to post
Share on other sites

Apologies for a speed reply which is what this is but I've got to go and eat my dinner so haven't read your post properly. In answer to question one try declaring a string like so:

_grpcount=count units group player

_string=format[_eg%1,_grpcount]

hint _string

See what it displays. Probably complete bollocks but have a little play with it and see what happens.

Share this post


Link to post
Share on other sites

1a - Is it possible to create arrays at runtime that are named Incrementally?

If you can keep track of the number of arrays, the array names can be formed using format["array%1",_number].

1b - Can I create groups at runtime?

Not directly. The way I create groups is by placing "dummy units" for each side (west,east,res,civ) on a remote island (they need to stay alive for the whole mission).

To create a new group, create the units in his group, then set the dummy only to grpNull, then group alpha 1. The units that were in his group will be automatically assigned to a new group and act independantly. The problem is you have no control of the new groups ID, and you will need another step to make 12 unit groups.

Share this post


Link to post
Share on other sites

Ok cool I can keep track of the count of arrays smile_o.gif

Im wondering because I want to have alot of groups running around and they each have an array assigned to them and another array linked to the first. One array for the group and one for the mission they are on.

Can I take a group arrays variable (or pointer) and set that value to another arrays without having a case for each number?

I mean.... this select 1 = x

therefore update ega_"%1[x]"

so that ega_03 is selected if x = 3

instead of

this select 1 = x

if x = 1 then get ega_01

if 2 then ega_02

Thanks chris I will check that out but dont have OFP installed right now sad_o.gif

which will be the first variable of a groups array and say

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  

×