OpenXcom Forum

Modding => Work In Progress => Topic started by: bulletdesigner on February 20, 2016, 06:35:36 pm

Title: HWP how to Constant animation only on flying ?
Post by: bulletdesigner 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)
(https://s15.postimg.org/h1vy0vfvb/deamon.jpg) (https://postimg.org/image/h1vy0vfvb/)
Title: Re: HWP how to Constant animation only on flying ?
Post by: Yankes on February 20, 2016, 06:51:51 pm
In my extended version its possible.
Title: Re: HWP how to Constant animation only on flying ?
Post by: bulletdesigner 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
Title: Re: HWP how to Constant animation only on flying ?
Post by: bulletdesigner 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!
Title: Re: HWP how to Constant animation only on flying ?
Post by: Yankes 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.
Title: Re: HWP how to Constant animation only on flying ?
Post by: bulletdesigner 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

(https://s14.postimg.org/mnbfxjf99/fdeamon.png) (https://postimg.org/image/mnbfxjf99/)
Title: Re: HWP how to Constant animation only on flying ?
Post by: Yankes 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.
Title: Re: HWP how to Constant animation only on flying ?
Post by: bulletdesigner 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
Title: Re: HWP how to Constant animation only on flying ?
Post by: bulletdesigner on December 08, 2016, 09:32:49 pm
i get a crash some times when i kill the deamon .. this is the error
(https://s15.postimg.org/vj8pmjn7r/123.png) (https://postimg.org/image/vj8pmjn7r/)
Title: Re: HWP how to Constant animation only on flying ?
Post by: ohartenstein23 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.
Title: Re: HWP how to Constant animation only on flying ?
Post by: bulletdesigner 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?
Title: Re: HWP how to Constant animation only on flying ?
Post by: ohartenstein23 on December 09, 2016, 02:46:41 pm
Check Meridian's OXCE+ thread (https://openxcom.org/forum/index.php/topic,4187.msg75725.html#msg75725), Yankes posted a quick fix there if you want to recompile the executable, otherwise it should be in the next version of OXCE/OXCE+.

Title: Re: HWP how to Constant animation only on flying ?
Post by: bulletdesigner 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
Title: Re: HWP how to Constant animation only on flying ?
Post by: ohartenstein23 on December 09, 2016, 03:51:23 pm
He's talking about this line (https://github.com/ohartenstein23/OpenXcom/blob/oxce3.5-plus-proto/src/Battlescape/TileEngine.cpp#L3364) 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. (https://drive.google.com/open?id=0BzdM3YhNg14pSXFFNEVDWDdoRjQ)
Title: Re: HWP how to Constant animation only on flying ?
Post by: bulletdesigner on December 09, 2016, 07:59:29 pm
thank you it work perfectly i´m using oxce 3.5+ windows
Title: Re: HWP how to Constant animation only on flying ?
Post by: Yankes on December 09, 2016, 10:02:26 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
this is because it was addressed to Meridian, he more often release new version than me (aka exe).