Solved Item On Death Palette

Question that is answered or resolved.

Weoooo

Member
Hi so I asked about how to make a 'dead' animation that loops a while ago and my uneducated hunch was correct, you do the ol' nodieblink 2 and spawn an object. But what if you want it to match the palette of the enemy? All I can think of is writing a script that gets what palette the enemy is mapped to and then spawns the object based on that.

I don't wanna be all "write code 4 me plz" but I really don't know how else to do it. I'm a complete amateur here, as well as a dang autodidact, so the only thing I'm working off of is the documentation and reverse engineering things I see in other people's .txt files. It feels like having a bunch of different objects based on what palette you wanna use is awkward and the wrong way to do it, but I don't see any other way. Cause I don't think the object can know what palette the enemy that spawned it had, especially since that enemy is now gone.
 
Solution
I was planning on using the spawnframe, because the object would spawn in on the last frame of death. The object would be made up of sprites that the source entity used, so I think it could use the same palette.
I think I get what you're saying because I had done something like that before and that was from last weekend. You can use onspawnscript for the item.

1. Check if both the parent entity and one item have the same number of palettes declared. They may or may not have the same color palette from each other (color glitch or not?), but the colors from both need to be the same.

Example:

This one has both source entity's color palette along its own summon.
Default.png

Source/Parent entity:
Code:
name Gouken
type...
Does the item have the same color palette as the source entity that's about to die with anim death? Or is it different from the source entity? How are you spawning that item, from level or spawnframe?

As in these here.
Code:
spawn whodatguy
item blablabla
coords 500 222
at 1500

Code:
spawnframe 1
subentity blablabla
offset ...
delay ...
frame ...
frame ...
 
Does the item have the same color palette as the source entity that's about to die with anim death? Or is it different from the source entity? How are you spawning that item, from level or spawnframe?

I was planning on using the spawnframe, because the object would spawn in on the last frame of death. The object would be made up of sprites that the source entity used, so I think it could use the same palette.
Well, that's the best solution for this purpose.
But before I share you a script, what is actually you are making here?

Oh, I'm not really making anything. I'm just foolin' around and messing with the engine. I grew up with games like these, so it's just fun to experiment.
 
I was planning on using the spawnframe, because the object would spawn in on the last frame of death. The object would be made up of sprites that the source entity used, so I think it could use the same palette.
I think I get what you're saying because I had done something like that before and that was from last weekend. You can use onspawnscript for the item.

1. Check if both the parent entity and one item have the same number of palettes declared. They may or may not have the same color palette from each other (color glitch or not?), but the colors from both need to be the same.

Example:

This one has both source entity's color palette along its own summon.
Default.png

Source/Parent entity:
Code:
name Gouken
type player
health 100
speed 10
atchain 1
shadow 0
load gohadoken
com d f a freespecial

palette        data/chars/gouken/Palettes/Default.png # Used as default palette
alternatepal    data/chars/gouken/Palettes/Jotaro_Joestar_Kastro.png # alternate palette 1
alternatepal    data/chars/gouken/Palettes/NDSilva_Raikage.png # alternate palette 2
alternatepal    data/chars/gouken/Palettes/Meldo_Original2.png # alternate palette 3
alternatepal    data/chars/gouken/Palettes/Blagoy_OldSF3.png # alternate palette 4
alternatepal    data/chars/gouken/Palettes/ExL_SolomonMuto.png # alternate palette 5

Something that is spawned out:
Code:
name GoHadoken
type trap
speed 10
alpha 1
health 1
hostile enemy player trap none npc
gfxshadow 0
nolife 1
remove 1
offscreenkill 69
setlayer 300
subject_to_gravity 0
candamage npc none enemy player trap


palette        data/chars/gouken/Palettes/Default.png # Used as default palette
alternatepal    data/chars/gouken/Palettes/Jotaro_Joestar_Kastro.png # alternate palette 1
alternatepal    data/chars/gouken/Palettes/NDSilva_Raikage.png # alternate palette 2
alternatepal    data/chars/gouken/Palettes/Meldo_Original2.png # alternate palette 3
alternatepal    data/chars/gouken/Palettes/Blagoy_OldSF3.png # alternate palette 4
alternatepal    data/chars/gouken/Palettes/ExL_SolomonMuto.png # alternate palette 5

2. Copy this code. You can rename it whatever you want, but as for now, you can name it as palchange.c, and save it as a .c file inside the scripts folder. Make sure you declare it as onspawnscript for that item.

palchange.c:
C:
void main()
{
    changePalette();
}

void changePalette()
{
    void self = getlocalvar("self"); // Get calling entity.
    void parent = getentityproperty(self, "parent"); // Get parent entity
    int Pmap = getentityproperty(parent, "map"); // Get parent entity's palette/map.

    changeentityproperty(self, "map", Pmap); // Change this particular entity's own color palette based on its parent entity's own color palette
}

Declare it in your item.
Code:
onspawnscript data/scripts/palchange.c

Done. You can spawn it with spawnframe and subentity/custentity based on its source entity's own colors.
 
Solution
Oh. Well... dang! That's right, even if the parent is gone it's still spawned from it. I didn't think about that! Ah, the wonders of knowledge and experience!

Thanks a bunch. I don't think I would've ever connected the dots on my own.
 
What I forgot to tell you is that you can use a blank image (empty.gif) or frame none for making an entity invisible. In case you have a color glitch using empty.gif, you can use frame none.
 
What I forgot to tell you is that you can use a blank image (empty.gif) or frame none for making an entity invisible. In case you have a color glitch using empty.gif, you can use frame none.

That could be handy if I want to keep the enemy around, right? That's a smart idea, since you can then use the resurrection type thing to have something that 'dies' but animates for a bit before it comes back.

Now if only I could figure out how to make idles switch the way I thought they do so sound can play, and I feel like this is a nifty little thing to have.
 
Back
Top Bottom