Results 1 to 10 of 10

Thread: Adding randomized numbers and emblems

  1. #1
    Sergeant Major
    Join Date
    Apr 6 2002
    Location
    Manchester, UK.
    Posts
    1,685
    Adding Randomized Numbers and Emblems
    By Soul Assasin.

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



    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.


    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:

    Select NEW and name the selectio 'n1':


    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=&#34;Vehicle&#34;;
    *** *** ***sections&#91;&#93;={&#34;n1&#34;,&#34;n2&#34;,&# 34;n3&#34;};
    *** };[/QUOTE]

    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&#91;&#93; = {&#34;n1&#34;,&#34;n2&#34;,&#34;n3&#34;};[/QUOTE]
    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&#58; Exit
    _nrand = random&#40;100&#41;
    ?_nrand &#62; 90&#58; _unit setObjectTexture &#91;0, &#34;&#92;SIG_T55&#92;n9.paa&#34;&#93;, goto &#34;n2&#34;
    ?_nrand &#62; 80&#58; _unit setObjectTexture &#91;0, &#34;&#92;SIG_T55&#92;n8.paa&#34;&#93;, goto &#34;n2&#34;
    ?_nrand &#62; 70&#58; _unit setObjectTexture &#91;0, &#34;&#92;SIG_T55&#92;n7.paa&#34;&#93;, goto &#34;n2&#34;
    ?_nrand &#62; 60&#58; _unit setObjectTexture &#91;0, &#34;&#92;SIG_T55&#92;n6.paa&#34;&#93;, goto &#34;n2&#34;
    ?_nrand &#62; 50&#58; _unit setObjectTexture &#91;0, &#34;&#92;SIG_T55&#92;n5.paa&#34;&#93;, goto &#34;n2&#34;
    ?_nrand &#62; 40&#58; _unit setObjectTexture &#91;0, &#34;&#92;SIG_T55&#92;n4.paa&#34;&#93;, goto &#34;n2&#34;
    ?_nrand &#62; 30&#58; _unit setObjectTexture &#91;0, &#34;&#92;SIG_T55&#92;n3.paa&#34;&#93;, goto &#34;n2&#34;
    ?_nrand &#62; 20&#58; _unit setObjectTexture &#91;0, &#34;&#92;SIG_T55&#92;n2.paa&#34;&#93;, goto &#34;n2&#34;
    ?_nrand &#62; 10&#58; _unit setObjectTexture &#91;0, &#34;&#92;SIG_T55&#92;n1.paa&#34;&#93;, goto &#34;n2&#34;
    ?_nrand &#62;= 0&#58; _unit setObjectTexture &#91;0, &#34;&#92;SIG_T55&#92;n0.paa&#34;&#93;, goto &#34;n2&#34;[/QUOTE]

    this has to be done for n2 and n3 respectively.

    Enjoy.




  2. #2
    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

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

  4. #4
    Second Lieutenant VXR's Avatar
    Join Date
    Jan 26 2002
    Location
    Netherlands
    Posts
    4,164

    Thumbs up

    Great tutorial Soul and Scorp

  5. #5
    Private First Class
    Join Date
    Oct 14 2002
    Location
    Moscow, Russia
    Posts
    26
    Yepp... Works Great... b4 u save/load the game (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
    Sorry for terrible english. My native language is C++

  6. #6
    Quote Originally Posted by (ZmeiGorin @ Sep. 18 2003,13:22)
    Yepp... Works Great... b4 u save/load the game (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&#39;s Init fields

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

    3). Randomizing isn&#39;t synchronized on all stations. So it&#39;s good idea to place some trigger in the script (like ?norand: Exit - then set norand=true; in the unit&#39;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&#39;s (or lwpmi2&#39;s) (on which, BTW, I introduced this randomizing method for the first time in the OFP addon&#39;s history



    Tomasz Sopylo - The Airwolf Mod
    &#124; http://awmod.uni.cc/ &#124;

  7. #7
    Private First Class
    Join Date
    Oct 14 2002
    Location
    Moscow, Russia
    Posts
    26
    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&#33;(textures)

    BTW, did you use hiddenselection( maybe that&#39;s the problem?)

  8. #8
    Quote Originally Posted by (ZmeiGorin @ Sep. 18 2003,17:35)
    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&#33;(textures)

    BTW, did you use hiddenselection( maybe that&#39;s the problem?)
    Yes - as I&#39;ve wrote above - this tutorial uses the same method I used on mine Mi-2 addons.

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

  9. #9
    Private First Class
    Join Date
    Oct 14 2002
    Location
    Moscow, Russia
    Posts
    26
    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&#39;s MI-28)

  10. #10
    J. BARBER NZXSHADOWS's Avatar
    Join Date
    Jul 6 2001
    Location
    Cullman, Alabama, United States
    Posts
    1,653
    I found it.




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •