Jump to content
Sign in to follow this  
Scorpio

Adding randomized numbers and emblems

Recommended Posts

Adding Randomized Numbers and Emblems

By Soul Assasin.

1. Make a plane in Oxygen dimensions: 1x1 ...

randnum1.jpg

randnum2.jpg

2. Load up one number texture (use #1). Make sure it fits onto the plane you made earlier. Now select the plane and apply the texture using B.

randnum3.jpg

3. Copy paste the plane twice (for a 3 number variation) and place the copies next to each other.

4. Now select the first plane and right-click in the selections window:

randnum4.jpg

Select NEW and name the selectio 'n1':

randnum5.jpg

5. Repeat the step for the rest of the planes with 'n2', 'n3' and so on.

6. Ok now the difficult part, scripting and coding. In your config in class cfgModels the following should be present:

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

     sectionsInherit="Vehicle";

     sections[]={"n1","n2","n3"};

  };

in your cfgVehicles configuration this line should be present:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">hiddenSelections[] = {"n1","n2","n3"};

I would advise leaving the coding and scripting to someone who knows his/her way around these things.

I suggest yuo take the numRand scripts from the T55 pack and take a close look at how the randomization is done.

IMPORTANT NOTE:

The line of  script:

this setobjecttexture [ #, "pathname"]

is used to manually change the texture on the hiddenselection. The # corresponds to the order of selections you used in your defenitions, thus for n1 it would be:

this setobjecttexture [ 0, "pathname"]

for n2:

this setobjecttexture [ 1, "pathname"]

and so on.

Here is a part of the randomization process (only for n1):

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

? _unit in RHS_T55sWithoutRandomization: Exit

_nrand = random(100)

?_nrand > 90: _unit setObjectTexture [0, "\SIG_T55\n9.paa"], goto "n2"

?_nrand > 80: _unit setObjectTexture [0, "\SIG_T55\n8.paa"], goto "n2"

?_nrand > 70: _unit setObjectTexture [0, "\SIG_T55\n7.paa"], goto "n2"

?_nrand > 60: _unit setObjectTexture [0, "\SIG_T55\n6.paa"], goto "n2"

?_nrand > 50: _unit setObjectTexture [0, "\SIG_T55\n5.paa"], goto "n2"

?_nrand > 40: _unit setObjectTexture [0, "\SIG_T55\n4.paa"], goto "n2"

?_nrand > 30: _unit setObjectTexture [0, "\SIG_T55\n3.paa"], goto "n2"

?_nrand > 20: _unit setObjectTexture [0, "\SIG_T55\n2.paa"], goto "n2"

?_nrand > 10: _unit setObjectTexture [0, "\SIG_T55\n1.paa"], goto "n2"

?_nrand >= 0: _unit setObjectTexture [0, "\SIG_T55\n0.paa"], goto "n2"

this has to be done for n2 and n3 respectively.

Enjoy. smile_o.gif

Share this post


Link to post
Share on other sites

Great job scorpio, I knew it was possible through hidden selections and wondered when someone would come around and do it. These are the details that will make everything more realistic biggrin_o.gif

Share this post


Link to post
Share on other sites

With some a bit more tricky techniques u can not only randomize numbers but objects as well by manipulating theit textures.

Share this post


Link to post
Share on other sites

Great tutorial Soul and Scorp

Share this post


Link to post
Share on other sites

Yepp... Works Great... b4 u save/load the game smile_o.gif (i tested on 1.91)

2 possible solutions:

1) every minute(or whatsoever) redtaw these textures

2)use anims, as DKM did on their MI28

Share this post


Link to post
Share on other sites
Yepp... Works Great... b4 u save/load the game smile_o.gif (i tested on 1.91)

2 possible solutions:

1) every minute(or whatsoever) redtaw these textures

2)use anims, as DKM did on their MI28

Please notice that

1). Script which sets random number/objects/emplems should be fired up from the Init event handler or the unit's Init fields

2). It will work correctly in the MP mode only with patch 1.92 and later (otherwise randomized objects won't be visible on client stations)

3). Randomizing isn't synchronized on all stations. So it's good idea to place some trigger in the script (like ?norand: Exit - then set norand=true; in the unit's init field etc) so it will be possible to turn off randomizing and place numbers / emblems by hand.

For further explanations please refer to readme files of mine awmi2p's (or lwpmi2's) (on which, BTW, I introduced this randomizing method for the first time in the OFP addon's history smile_o.gif

Share this post


Link to post
Share on other sites

AirwolfPL:

1)You set your unit from the editor

2)you preview, everything is OK

3)you export your mission

4)you load your mission - all OK

5)quit to main meny

6) resume - no numbers!(textures)

BTW, did you use hiddenselection( maybe that's the problem?)

Share this post


Link to post
Share on other sites
AirwolfPL:

1)You set your unit from the editor

2)you preview, everything is OK

3)you export your mission

4)you load your mission - all OK

5)quit to main meny

6) resume - no numbers!(textures)

BTW, did you use hiddenselection( maybe that's the problem?)

Yes - as I've wrote above - this tutorial uses the same method I used on mine Mi-2 addons.

I suppose it doesn't work correctly because the init even handler is fired up only when 'fresh' mission is started and when the savegame is used - unit's saved state is loaded. I suppose this problem can be solved somehow - I'll do further research of this topic before I'll release new, updated versions of Mi-2 helos (which are almost ready).

Share this post


Link to post
Share on other sites

I Wrote about a solution.

AFAIK OFP stores animations correctly.

So, you may use a cylinder with different textures and rotate it as needed( as in DKM's MI-28)

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  

×