aliens

Author Topic: An help about Extra Sprite handling!  (Read 15275 times)

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
An help about Extra Sprite handling!
« on: June 15, 2017, 12:35:43 am »
Hey people

I want to add some sprites (weapon big/hand/floors for now) to the FMP mod, mostly i replace the old and vanilla ones.

But i got a problem. When i add extra sprites, hand sprites, sometimes it goes crazy. The weapon starts to use another random extra sprite, even changes only at some directions only. I change the ID numbers of the sprites and as a result, the buggy one gets fixed but another one corrupted. I just can't figure it out by myself.

Can you give me some hints about it? What could be the problem?

Thx

Offline Wolfstarr

  • Colonel
  • ****
  • Posts: 248
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #1 on: June 15, 2017, 01:02:13 am »
Hi Drages, can you post some of your files and code so we can have a look?

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #2 on: June 15, 2017, 10:23:26 am »
Seeing your changes would help.

In general:
- you can't use extra sprite index > 999 in vanilla, it might collide with other mods (in OXCE+ you can)
- two mods cannot share any extra sprites... which means, if you are making a mod for FMP (i.e. not directly changing FMP), you need to define the new sprite AND also all its usage... even if you are using the same sprite index... the reason is that the game puts an offset to all extra sprites, e.g. bigob with index 345 will become 1345 in FMP and 2345 in your mod

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #3 on: June 15, 2017, 02:37:22 pm »
Seeing your changes would help.

In general:
- you can't use extra sprite index > 999 in vanilla, it might collide with other mods (in OXCE+ you can)
- two mods cannot share any extra sprites... which means, if you are making a mod for FMP (i.e. not directly changing FMP), you need to define the new sprite AND also all its usage... even if you are using the same sprite index... the reason is that the game puts an offset to all extra sprites, e.g. bigob with index 345 will become 1345 in FMP and 2345 in your mod

I will upload my files. But I just edit the FMP, add my extra sprite to rul file as next number. For example if the final handop is 735, I add 736. So I don't make any complex thing or another mod.

So I add or edit this new sprite ID at items rul file. Everything looks OK. But when I start a quick battle, bigops work fine but some of the handops go crazy. Some works but others uses the handops I added with different id's. And their position is not correct too.

For example I added new laser sprites, they worked fine. Then I added new plasma sprites but some of them used the laser sprites with wrong positions. Even stranger, the plasma rifle uses some directions correctly from right handops I added, but other directions are from heavy laser with wrong position.

I tried to change sprite id's and some of them corrected but now others bugged.

I got a massy standart folder which I add my mods and working folders. Could this mess create this bugs?

Thx again.

Offline ohartenstein23

  • Commander
  • *****
  • Posts: 1933
  • Flamethrowers fry cyberdisk circuits
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #4 on: June 15, 2017, 03:03:09 pm »
With sprites that have multiple parts (facings, animation frames, etc.), each part takes 1 index, so for example, handobs take 8 indices. If the last handob index is 735 and you start a new one at 736, you're replacing 7 of the facings for the handob referenced at 735. To not overlap, you should start at 735 + 8 = 743 for your index.  For bullet sprites, it's more complicated; each sprite is 35 frames, but the ruleset reference is (sprite index) / 35.  So for example bulletSprite: 12 is really referencing sprite frames 420 to 454, and bulletSprite: 13 starts at 455.

If you don't want to worry about colliding with FMP sprite indices, I'd suggest making a separate mod where you can start the index count where you want, as long as you respect the reserved space for vanilla sprites (128 I think for handobs, look up on https://ufopaedia.org for the others).

Edit: Also, I would advise against putting stuff into the /path/to/openxcom/standard folder, as that's supposed to be the folder which contains only the files for making the vanilla game work, and any edits there would either be overwritten by or mess up an updated nightly version.  This is another reason to use the user/mods folder, so all of your WIP can easily be contained and moved from version to version and installation to installation.
« Last Edit: June 15, 2017, 03:20:27 pm by ohartenstein23 »

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #5 on: June 15, 2017, 04:30:30 pm »
This is the problem I had. I gave id's one to another without knowing this. Thx. I think it will handle my problem. I will test it when I get my pc..

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #6 on: June 18, 2017, 03:05:46 am »
Hey ppl..

I got an answer about explosion sprites.. I want to use different explosions but i could not do it.. can u give me a hand? thx

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #7 on: June 18, 2017, 10:22:14 am »
Just take it from a different mod for inspiration, by random search I found this:

Modportal Link Hardmode Expansion <- Modportal downloads not working.
Dropbox Link Latest Version

Groundcombat changes:
   Colored Explosions (Grey: Smoke, Yellow: HE, Stun: Purple)

Code: [Select]
extraSprites:
  - type: X1.PCK
    width: 1024
    height: 64
    subX: 128
    subY: 64
    files:
      56: Resources/Items/Hitanimation/SpriteSheet_SmokeExplosion.png
      64: Resources/Items/Hitanimation/SpriteSheet_StunExplosion.png

Also: https://www.ufopaedia.org/index.php/X1.PCK
« Last Edit: June 18, 2017, 10:27:46 am by Meridian »

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #8 on: June 18, 2017, 12:36:53 pm »
Just take it from a different mod for inspiration, by random search I found this:

Code: [Select]
extraSprites:
  - type: X1.PCK
    width: 1024
    height: 64
    subX: 128
    subY: 64
    files:
      56: Resources/Items/Hitanimation/SpriteSheet_SmokeExplosion.png
      64: Resources/Items/Hitanimation/SpriteSheet_StunExplosion.png

Also: https://www.ufopaedia.org/index.php/X1.PCK

You help me so much, man! I figured it out  but this image is very little and animate so fast.. i will look for more explosions to use. and i could use the default explosion to edit.

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #9 on: June 18, 2017, 12:57:03 pm »
and i could use the default explosion to edit.

attached

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #10 on: June 18, 2017, 08:25:33 pm »
Meridian, can i go over 1000 with nighties at sprite ID?

I revised and added many handobs with the ammunitions so the numbers go high fast.. i would need to erase many ammunitions handobs if i limit 1000..
« Last Edit: June 18, 2017, 08:42:07 pm by drages »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #11 on: June 18, 2017, 08:47:41 pm »
Meridian, can i go over 1000 with nighties at sprite ID?
I revised and added many handobs with the ammunitions so the numbers go high fast.. i would need to erase many ammunitions handobs if i limit 1000..

You can, but it might have side effects... conflicts with other mods.

If you want it only for personal use, there is a trick... put your mod on the very bottom of the mod list... since the conflicts can be only with mods with ID higher than your mod, having highest ID "solves" the issue.

If you want to publish it, people won't ever read any of instructions (100% guaranteed), so that won't work. Other options are:
a/ use OXCE+
b/ ask SupSuper/Warboy if they would be willing to merge the changes Yankes and I made to support 1000+ sprites into vanilla... the changes are relatively small and work quite well so far (both PirateZ and Xcom Files use this)

And as modding, how can i make an item alien specific as "alien artifact"

Not sure what you mean...

If you don't want xcom to ever be able to use an item, just put a dummy research as dependency, e.g. STR_UNOBTAINABLE
« Last Edit: June 18, 2017, 09:06:36 pm by Meridian »

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #12 on: June 18, 2017, 09:00:50 pm »
You can, but it might have side effects... conflicts with other mods.

If you want it only for personal use, there is a trick... put your mod on the very bottom of the mod list... since the conflicts can be only with mods with ID higher than your mod, having highest ID "solves" the issue.

If you want to publish it, people won't ever read any of instructions (100% guaranteed), so that won't work. Other options are:
a/ use OXCE+
b/ ask SupSuper/Warboy if they would be willing to merge the changes Yankes and I made to support 1000+ sprites into vanilla... the changes are relatively small and work quite well so far (both PirateZ and Xcom Files use this)

Hmmm... so maybe i can create another mod with only ammo handobs.. and yeah i should ask them to add this..

Btw, as sprites, I am thinking about something.. can we make the weapons images changes (big-floor-hand) when it uses different ammo. For example we got a laser weapon with yellow lights at it's sprites and it shoots yellow beams. But when i use different ammo, a red ammo, then the weapon sprites will change according to it and it will fire red beams. It's like coding a sprite change to ammo. I think it would be cool and fitting.
« Last Edit: June 18, 2017, 09:44:03 pm by Solarius Scorch »

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9098
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #13 on: June 18, 2017, 09:13:00 pm »
Hmmm... so maybe i can create another mod with only ammo handobs..

Yeah, but you'll have to be careful not forgetting anything... and also put your extra-mod below your main-mod... otherwise it may/will overwrite changes from your extra-mod.

and yeah i should ask them to add this..

Here are the changes:
change 1/ https://github.com/Yankes/OpenXcom/commit/5d62e26e1341f0f4f22969fe40f5d5312ab8150e
change 2/ https://github.com/MeridianOXC/OpenXcom/commit/258581e6378f53994e67364eda51e307bf4917be

Btw, as sprites, I am thinking about something.. can we make the weapons images changes (big-floor-hand) when it uses different ammo. For example we got a laser weapon with yellow lights at it's sprites and it shoots yellow beams. But when i use different ammo, a red ammo, then the weapon sprites will change according to it and it will fire red beams. It's like coding a sprite change to ammo. I think it would be cool and fitting.

I think Yankes has support for all (or at least most) of this in OXCE/OXCE+ using "scripts".
I don't know how it works, but I've seen different bigobs for weapons with different ammo...

Be prepared for a steep learning curve for scripts... people that can help you are: Yankes and Ohartenstein.

Offline drages

  • Colonel
  • ****
  • Posts: 150
    • View Profile
Re: An help about Extra Sprite handling!
« Reply #14 on: June 18, 2017, 09:22:55 pm »
Yeah, but you'll have to be careful not forgetting anything... and also put your extra-mod below your main-mod... otherwise it may/will overwrite changes from your extra-mod.

Here are the changes:
change 1/ https://github.com/Yankes/OpenXcom/commit/5d62e26e1341f0f4f22969fe40f5d5312ab8150e
change 2/ https://github.com/MeridianOXC/OpenXcom/commit/258581e6378f53994e67364eda51e307bf4917be

I think Yankes has support for all (or at least most) of this in OXCE/OXCE+ using "scripts".
I don't know how it works, but I've seen different bigobs for weapons with different ammo...

Be prepared for a steep learning curve for scripts... people that can help you are: Yankes and Ohartenstein.

Scripts are another world to conquer. Before i go for that kind additions, i need to handle my mod. I am working on it for some days non-stop... coding-editing-creating new images-checking other arts.. It's nice to have people here to get answer fast when i stuck.

If i go for scripts, i need to create my own exe and then maybe blow the FMP mod itself. If i don't lose my interest, i probably will recreate FMP from the beginning anyway. I am working at my first millstones for now..