SOLVED - Issue with Walls and spawned entities

O Ilusionista

Captain 100K
Guys, I've hit a snag with my project and I need help, since I've tried everything that I know to fix it, but nothing had work.
If I can't fix it, my game can't continue.

Let me explain what happens.
The TL;DR version:

I need to make the burn entity to detect the landframe when they lands atop of a wall, like the player does.

The long explanation

I have a type Enemy entity (I had to set it as enemy or some "subject_to" doesn't work) called "burnP", which is the entity I use for displaying human players and enemies in fire after been hit by a BURN attack:

name burnP
type      enemy
gfxshadow 1

palette data/chars/misc/burn/01.gif
alternatepal data/chars/misc/burn/blue.gif

animationscript data/scripts/grabscript.c

subject_to_wall 1
subject_to_platform 1
suject_to_basemap 1
subject_to_holes 1
no_adjust_base 0

I call it on the BURN animation (and on other animation) using a script WhiteDragon gave to me long time ago, which works and uses bindentity
Code:
@script
if(frame==0)
{
    void self = getlocalvar("self");
    void e;
    clearspawnentry();
    setspawnentry("name", "burnP");
    e = spawn();
    bindentity(e, self,0,1,0,1,1);
}
@end_script
Using bindentity, I make the effect to bind to the player, which gets invisible while effect is active (plus, the bindentity makes it to follow the parent animation, so I can use only one entity for different colors of fire). Since I spawn it at the Y=0 (IOW, at the same Y position of the parent), I use a "landframe" to control when the effect should be destroyed.

The problem is: it fails. Sometimes, if you near a wall and get hit by a burn attack, the effect will simply get destroyed because its near a wall, while the character is invisible and haven't landed over the wall (which works as a platform).

And now I am having an even bad situation: the Player lands over a wall, but the effect don't (it get stuck on air, then it try to fall on the ground - ignoring the wall)
W71imdr.png


How can I solve it?

Here is what I tried, all no good:
- Setting a landframe with a killentity
- setting a subentity or customknife (so I can kill the summoned entity when it lands)
- Spawn the entity and check the parent animpos (since all the entities calls the fire effect at the FIRST frame and everyone lands on the second frame), but the code is simply ignored:

Code:
script @script

void main()
{

void self = getlocalvar("self");
void parent = getentityproperty(self, "parent");
void pFrame = getentityproperty(parent, "animpos");


    if(parent!=NULL()){
       if (pFrame >0){
       killentity(self);
       }
    }
}
@end_script

What I can do? I am lost here.
What I won't do - add the fire colors to every character palette.
 
Why youre using separate entity to display fire, isnt it better to use fire frames in burn animation ? If palette of fire effect is different then there should be a way to load custom palette temporarily just to use it with burn animation?
I would change the way i do burn animation instead and use it how it was meant to be used, without bindentity and if i want extra sparks on top of fire i just use projectile or something simple.
IT would be better to explain what exactly you want it to do and why you had to separate it from actual burn animation.
Then figure out the best way to do it.
You know what would be neat, some command like "ownpal" so every frame thats in animation will use its own palette instead of one of alternatepals and others defined in character header.Cause i remember i used bindentity for effects because my palette was wrong and i wanted to use one fire animation on all characters which obviously introduced palette issues.
 
Sure, let me explain:
Why you're using separate entity to display fire, isnt it better to use fire frames in burn animation ?
The key here is CONTROL and OPTMIZATION. There is a difference between efficient and effective.

Using a different entity, I do have way more control, specially when they are palette independent from the parent entity.
I do have 2 colors of burn and I am implementing a third one. To have 3 palettes for every character just to handle it is not a best option (we are talking about 60+ palettes here), and including burn colors on the original palette is not a good idea.

Using bindentity function, the burn effect uses the same animation from its parent - and here is where all the magic resides. I just change the burn effect palette on-the-fly using script, which triggers different sparks in different colors (again, script controlled). Wants a new color? just add a new animation and put a single script line and it's done. I could even use the same animation if I want to.

If you explore my mod, you will see that I am addicted to optimization:
- I don't have different entities for red and blue flame sparks - its the same entity controlled throught script
- All the helpers (the ones which comes and execute an attack) are just ONE entity, which I control using script
- Spider-Woman has two different modes. Instead of using a different weapon, I just control this using script. Pretty much like all alternative modes for all characters. I just use weapons when I HAVE to.
- The same entity which is used for block is the same which is used for grab effect, for example. Again, controlled by script.
- All the throw animations uses ONE single animation, instead of tons of fall animations like in other mods. I use 2 addition animations just for sake of cosmetics, but I could use the same animation.
And the list continues :)

I have a modular way of work (which I use on my real life too): I ALWAYS think about the future usage. So I do prefer to waste time now, to build the control, instead of having the same work done over and over. Once I set it, it's done and it's just a copy and paste :)

You know what would be neat, some command like "ownpal" so every frame thats in animation will use its own palette instead of one of alternatepals and others defined in character header
There is an behaviour I've discovered while I was build the helper system - Whenever OpenBOR loads a sprite, the engine loads it's palette too. So if you create an entity with PALETTE NONE using sprites which were already loaded with palettes, the engine will overwrite the "none" setting with the first palette used.

To give you a better example:
I have Captain America, which I use as a player (has palette), as a helper (palette none) and enemy (has palette). Whenever the Helper appears on the screen, it was always using the first palette of the player (which is correct, btw). But once the Enemy version appears (which sets the sprites with a different yellow and green palette), the helper GETS THE YELLOW PALETTE.

The solution was to force a specific palette on-the-fly using script. This is why I asked to DC about if there is any limitation about the number of palettes I can set for an entity and he said no. Take a look at my helper palettes:

palette data/chars/misc/aHelper/dea01.gif  #0 Deathlok
alternatepal    data/chars/misc/aHelper/psy00.gif  #1 Psylocke
alternatepal    data/chars/misc/aHelper/sto01.gif  #2 Storm
alternatepal    data/chars/misc/aHelper/fir00.gif  #3 Firestar
alternatepal    data/chars/captain/classic.gif    #4 Captain America
alternatepal    data/chars/hawkeye/0smartpal_base-classicarcade.gif    #5 Hawkeye
alternatepal    data/chars/emma_frost/pal1.gif    #6 Emma Frost
alternatepal    data/chars/misc/aHelper/jo10.gif  #7 Jack of Hearts
alternatepal    data/chars/thor/pal1.gif   #8 Thor
alternatepal    data/chars/misc/aHelper/jg0.gif   #9 Jean Grey
alternatepal    data/chars/misc/aHelper/sw0.gif   #10 Scarlet Witch
alternatepal    data/chars/misc/aHelper/strange1.gif   #11 Strange
alternatepal    data/chars/misc/aHelper/fb01.gif          #12 Firebird
alternatepal    data/chars/misc/aHelper/bwf-1.gif          #13 Black Widow
alternatepal    data/chars/misc/aHelper/ice0.gif          #14 Iceman

So, when I want to call my aHelper entity as Deathlok, I just call it using its FOLLOW1 animation, which has a code to change the palette on-the-fly.
See how much control I have and how easy is to add a new helper? I don't need to create 14 different entities (and load 14 different entries on the memory, even if half of them reuses sprites).

So, the TL;DR version:

I need to make the burn entity to detect the landframe when they lands atop of a wall, like the player does.
 
Fantastic idea , i kinda have one entity for multiple effects and i control which effect appears by setting remap in projectile code instead of using spawn scripts.
So having command like "ownpalette" in animation would help ? Maybe thats something we could request from White Dragon.

Do you suspect theres something in engine that needs updating or you look for different way to do what you want to do ?
Cause for now maybe for burn animation you should use simple burn effect and add some separate flames? For everything else use what youre using now.
Im not sure how you did it and how many images are within burn effect at once.
Destroying on landframe is quite limited, i would search ways to do it differently, Why its subject to wall, does it fall through walls? Maybe use seta so it kinda flies im midair and obstacles/walls/platforms make no difference.
 
A little update:
I still need to further investigate, but it seams to happens only when you have a wall over another wall.

Once I have time to investigate it more, I will post more info.
 
UPDATE: Bloodbane managed to help me with this.]

Using his explanation:
I think somehow bound entities such as burnP can't locate its own base so when it's supposed to land on wall with landframe, it can't do it.  So I decided to change how burnP locate base, instead of finding its own base, it finds its parent's base to land.

So he made a code to check the parent base position, but I noticed there was a delay and you were able to see both the player and the burn animation, a very odd thing.

Then I was thinking about and...got it.
The solution was simple: Just kill the spawned entity when the player lands, using the same variable when I spawn it.
I just had to move the variable declaration to outside the if loop (in bold):

@script
  void e;
    if(frame==0)
    {
    void self = getlocalvar("self");
    clearspawnentry();
    setspawnentry("name", "burnP");
    e = spawn();
    changeentityproperty(e, "parent", self);
    bindentity(e, self,0,1,0,1,1);
    }
    if(frame==1){
    killentity(e);
    }

@end_script

And now it works, finally.
I think the bindentity prevents the binded entity to be killed, somehow.
 
Back
Top Bottom