aliens

Author Topic: HWP how to Constant animation only on flying ?  (Read 9822 times)

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 686
    • View Profile
HWP how to Constant animation only on flying ?
« on: February 20, 2016, 06:35:36 pm »
is it possible to make animation constant only on flying ?
For exemple i build this deamon with wings but i want the wings only to move when flying! ( last 4 spirtes of each directions)

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3375
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #1 on: February 20, 2016, 06:51:51 pm »
In my extended version its possible.

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 686
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #2 on: February 21, 2016, 05:54:48 pm »
nice thanks ill keep it in mind in the future , and ask more when the mod is almost done

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 686
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #3 on: December 05, 2016, 01:16:12 pm »
In my extended version its possible.

Hi Yankes can you tell how i can do it? Hope it´s a ruletset entry cause i no nothing about scripting!

Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3375
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #4 on: December 05, 2016, 08:27:00 pm »
Hi Yankes can you tell how i can do it? Hope it´s a ruletset entry cause i no nothing about scripting!

This is example for parrot https://openxcom.org/forum/index.php/topic,4451.15.html
Quote
armors:
  - type: PARROT_ARMOR
    scripts:
      selectUnitSprite: |
        var int temp;
        var int walking;
        unit.isWalking walking;
        if eq walking 0;
          unit.getId temp;
          offsetmod temp 11 0 8; #desync animation of different units
          add temp anim_frame;
          wavegen_saw temp 8 8 7; #create sequence similar to: "1 2 3 4 3 2 1 0 1 2 3 4 3 2 1 0"
          mul sprite_offset 8;
          add sprite_offset 8;
          add sprite_offset temp;
          set sprite_index sprite_offset;
        else;
          add sprite_index sprite_offset;
        end;
        return sprite_index;
This will not work for 2x2 unit because it use different offset for graphic parts (but you still can test it and see some bizarre effects :) ), but if you provide some sample rulsest of unit you want to animate I could change this script to be compatible with it.

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 686
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #5 on: December 05, 2016, 08:53:18 pm »
This is example for parrot https://openxcom.org/forum/index.php/topic,4451.15.htmlThis will not work for 2x2 unit because it use different offset for graphic parts (but you still can test it and see some bizarre effects :) ), but if you provide some sample rulsest of unit you want to animate I could change this script to be compatible with it.

it´s the cyberdisc armor with 20 on drawing routine

  - type: CYBERDISC_ARMOR #Flying Deamon
    spriteSheet: FDEAMON.PCK
    allowInv: false
    corpseBattle:
      - CYBERDISC_CORPSE_1
      - CYBERDISC_CORPSE_2
      - CYBERDISC_CORPSE_3
      - CYBERDISC_CORPSE_4
    corpseGeo: STR_CYBERDISC_CORPSE
    frontArmor: 50
    sideArmor: 50
    rearArmor: 50
    underArmor: 50
    drawingRoutine: 20
    constantAnimation: true
    movementType: 1
    size: 2
    damageModifier: #DEAMON ARMOR
      - 1.0 #none
      - 1.0 #AP
      - 1.0 #FLAMES
      - 1.0 #HE
      - 1.0 #LASCANON
      - 1.0 #PLASMA
      - 1.0 #STUN
      - 1.0 #MELEE
      - 1.0 #ACID
      - 0.0 #SMOKE
    loftempsSet: [ 92, 89, 90, 91 ]


The constant animation also don´t work for i can see, must  be a drawing routine 20


Offline Yankes

  • Global Moderator
  • Commander
  • *****
  • Posts: 3375
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #6 on: December 06, 2016, 12:03:56 am »
Code: [Select]
armors:
  - type: CYBERDISC_ARMOR
    scripts:
      selectUnitSprite: |
        var int temp;
        var int walking;
        var int floating;
        unit.isWalking walking;
        unit.isFloating floating;
        if and eq walking 0 eq floating 1;
          unit.getId temp;
          offsetmod temp 11 0 8; #desync animation of different units
          add temp anim_frame;
          wavegen_saw temp 4 4 4;
          add sprite_offset 1;
          add sprite_offset temp;
          add sprite_index sprite_offset;
        else;
          add sprite_index sprite_offset;
        end;
        return sprite_index;
done, animation is play only when unit is floating.

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 686
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #7 on: December 06, 2016, 12:17:59 pm »
  :'( doesn´t work , the animation is stuck on first frame floating or on ground
Maybe i need the newest version of extender?

--- posts merged - Solarius Scorch; please don't double-post ---

  :'( doesn´t work , the animation is stuck on first frame floating or on ground
Maybe i need the newest version of extender?

nevermind i just updated to the newest version and it works :D
Thank you man , that´s some mad skillz
« Last Edit: December 06, 2016, 09:06:10 pm by Solarius Scorch »

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 686
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #8 on: December 08, 2016, 09:32:49 pm »
i get a crash some times when i kill the deamon .. this is the error

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1934
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #9 on: December 08, 2016, 09:39:26 pm »
There's a bug in OXCE/OXCE+ on killing 2x2 units - I think Yankes is looking into it.

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 686
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #10 on: December 09, 2016, 12:43:55 pm »
There's a bug in OXCE/OXCE+ on killing 2x2 units - I think Yankes is looking into it.

ho i see, and your correct other 2x2 units also bug crash , where can i see this thread that talks about it, so i know when its fixed?

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1934
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #11 on: December 09, 2016, 02:46:41 pm »
Check Meridian's OXCE+ thread, Yankes posted a quick fix there if you want to recompile the executable, otherwise it should be in the next version of OXCE/OXCE+.


Offline bulletdesigner

  • Commander
  • *****
  • Posts: 686
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #12 on: December 09, 2016, 03:41:40 pm »
i´m going off topic but "quick fix is add `&& !unit->isOut()` at line `TileEngine.cpp:3256`:" that´s like Chinese to me..where do i write that line? ....hahah can they just put a .exe with that solved

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1934
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #13 on: December 09, 2016, 03:51:23 pm »
He's talking about this line in the engine source code, and I'm guessing since it sounds like Chinese to you, compiling your own version is out of the question...  Are you using OXCE+ 3.5 for windows?  I can compile an .exe with the fix in it to use until a new version is released.

Edit: Try this one out.
« Last Edit: December 09, 2016, 04:47:40 pm by ohartenstein23 »

Offline bulletdesigner

  • Commander
  • *****
  • Posts: 686
    • View Profile
Re: HWP how to Constant animation only on flying ?
« Reply #14 on: December 09, 2016, 07:59:29 pm »
thank you it work perfectly i´m using oxce 3.5+ windows