• All, Gmail is currently rejecting messages from my host. I have a ticket in process, but it may take some time to resolve. Until further notice, do NOT use Gmail for your accounts. You will be unable to receive confirmations and two factor messages to login.

Solved Switching Hitflash/Hit Sparks to Hit Depending on Which Entity Type

Question that is answered or resolved.

maxman

Well-known member
I have a projectile which is a type trap that can hit any entity type I want since it's set in script with candamage. What I'm trying to do is to have the projectile hit any entity depending on which type that is. If it's a player or enemy type, that hitflash should have a special move hitflash to appear (switch to anim follow3). But if it's a trap type like projectiles, that should have a hitflash of collision spark (switch to anim follow1). Using followcond and followanim along with hitflash works perfectly, but only hitflash calls on certain entity to hit any entity instead of entity type. For instance, I'm trying to hit players and enemies with special flash like hitflash (but with script). Even hitting projectiles to appear like hitflash with anim follow1 without special hit sparks. Also, the problem is that if I don't use these 3 conditions for both fighters (followcond, followanim, and hitflash), the first one who unleashes his/her projectile, kills off the opponent's projectiles instead of clashing. If fighter 1 has no 3 conditions at all while fighter 2 has them, and fighter 1 unleashes his projectile first before fighter 2 does, that's gonna kill fighter 2's projectile off. If fighter 2 unleashes his projectile with 3 conditions in set before fighter 1 does unleash, that can collide. For instance, Ryu unleashes his Hadouken first before Ken does his, Ryu's projectile eliminates Ken's without clashing.

Code:
name  Hadoken
type trap
health 1
hostile enemy player trap none npc
gfxshadow 0
speed 8
nolife 1
remove 1
#nomove 1
alpha 1
setlayer 300
#hitenemy 1 0
antigravity 100
#lifespan 100000
offscreenkill 69 #USING OFFSCREENKILL IS A MUST WHEN IT COMES TO SUMMONING PROJECTILES ONCE UNTIL IT GETS KILLED OFFSCREEN OR HITS A FIGHTER OR PROJECTILE
hostile trap player enemy none npc
candamage npc none enemy player trap
#didhitscript data/scripts/didhit/hadouhit.c
#didhitscript data/scripts/knocker.c
didhitscript data/scripts/projectilehit.c
animationscript data/scripts/special.c
#animationscript data/scripts/script.c
#ondoattackscript data/scripts/knocker.c
onspawnscript @script
    void main(){
        void self = getlocalvar("self");
        changeentityproperty(self, "candamage", (1 + 4096) || (2 + 4096) || (1 + 2048) || (2 + 2048) || (5 + 4096) || (9 + 2048) || (9 + 4096));
//Players, enemies, none, and trap types
    }
@end_script


anim    follow1
@script
void self = getlocalvar("self");
if(frame==0){
    changeentityproperty(self, "velocity", 0, 0, 0);
    setindexedvar("AfterHadou",1);
}
if(frame==15){
    killentity(self);
}
    @end_script
    delay    2
    offset    37 22
    @cmd    makeOpponentUnblock
    frame    data/chars/misc/hadoken/0700500000.gif
    offset    71 54
    frame    data/chars/misc/hadoken/0700500001.gif
    offset    61 42
    frame    data/chars/misc/hadoken/0700500002.gif
    offset    59 45
    frame    data/chars/misc/hadoken/0700500003.gif
    offset    62 46
    frame    data/chars/misc/hadoken/0700500004.gif
    offset    65 46
    frame    data/chars/misc/hadoken/0700500005.gif
    offset    68 46
    frame    data/chars/misc/hadoken/0700500006.gif
    offset    70 44
    frame    data/chars/misc/hadoken/0700500007.gif
    offset    71 38
    frame    data/chars/misc/hadoken/0700500008.gif
    offset    71 39
    frame    data/chars/misc/hadoken/0700500009.gif
    offset    70 40
    frame    data/chars/misc/hadoken/0700500010.gif
    offset    69 40
    frame    data/chars/misc/hadoken/0700500011.gif
    offset    67 41
    frame    data/chars/misc/hadoken/0700500012.gif
    frame    data/chars/misc/hadoken/0700500013.gif
    offset    63 40
    frame    data/chars/misc/hadoken/0700500014.gif
    offset    46 37
    frame    data/chars/misc/hadoken/0700500015.gif
    offset    1 1
    frame    data/chars/misc/empty.gif
    
anim    follow2
@script
void self = getlocalvar("self");
if(frame==0){
    changeentityproperty(self, "velocity", 0, 0, 0);
}
if(frame==15){
    killentity(self);
}
    @end_script
    loop    0
    delay    2
    offset    37 22
    @cmd makeOpponentUnblock
    frame    data/chars/misc/hadoken/0700500000.gif
    offset    71 54
    frame    data/chars/misc/hadoken/0700500001.gif
    offset    61 42
    frame    data/chars/misc/hadoken/0700500002.gif
    offset    59 45
    frame    data/chars/misc/hadoken/0700500003.gif
    offset    62 46
    frame    data/chars/misc/hadoken/0700500004.gif
    offset    65 46
    frame    data/chars/misc/hadoken/0700500005.gif
    offset    68 46
    frame    data/chars/misc/hadoken/0700500006.gif
    offset    70 44
    frame    data/chars/misc/hadoken/0700500007.gif
    offset    71 38
    frame    data/chars/misc/hadoken/0700500008.gif
    offset    71 39
    frame    data/chars/misc/hadoken/0700500009.gif
    offset    70 40
    frame    data/chars/misc/hadoken/0700500010.gif
    offset    69 40
    frame    data/chars/misc/hadoken/0700500011.gif
    offset    67 41
    frame    data/chars/misc/hadoken/0700500012.gif
    frame    data/chars/misc/hadoken/0700500013.gif
    offset    63 40
    frame    data/chars/misc/hadoken/0700500014.gif
    offset    46 37
    frame    data/chars/misc/hadoken/0700500015.gif
    offset    1 1
    frame    data/chars/misc/empty.gif

anim follow3
@script
void self = getlocalvar("self");
if(frame==0){
    changeentityproperty(self, "velocity", 0, 0, 0);
    setindexedvar("AfterHadou",1);
}
if(frame==4){
    killentity(self);
}
    @end_script
    delay    2
    offset    1 1
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif
    frame    data/chars/misc/empty.gif    

anim idle
@script
    void self = getlocalvar("self");
    changeentityproperty(self, "name", "Ryu");
    changeentityproperty(self, "candamage", openborconstant("TYPE_NONE"), openborconstant("TYPE_ENEMY"), openborconstant("TYPE_PLAYER"), openborconstant("TYPE_NPC"), openborconstant("TYPE_TRAP"));
    changeentityproperty(self, "subject_to_platform", 0);

@end_script
    hitfx data/sounds/empty.wav
    attack17 41 14 34 21 15 0 0 0 0 0 0
    loop    1 1
    delay    2
    followanim    1
    #followanim    3
    followcond    1
    #hitflash empty
    hitflash SpecFlash
    offset    67 22
    bbox 41 14 34 21
    platform 1 1 1 1 1 1 1 1 # <== PLEASE USE ALL 1's IN PLATFORM IF TRAP OR OBSTACLE TYPE IS USED SO IT DOESNT BLOCK ENTITIES
    frame    data/chars/misc/hadoken/0700000000.gif
    @cmd    makeOpponentBlock
    hitfx data/sounds/empty.wav
    attack17 41 14 34 21 15 0 0 0 0 0 0
    delay    8
    bbox 41 14 34 21
    frame    data/chars/misc/hadoken/0700000000.gif
    offset    68 24
    attack17 42 16 34 21 15 0 0 0 0 0 0
    bbox 42 16 34 21
    @cmd    makeOpponentBlock
    frame    data/chars/misc/hadoken/0700000001.gif
    offset    69 28
    attack17 43 20 34 21 15 0 0 0 0 0 0
    bbox 43 20 34 21
    @cmd    makeOpponentBlock
    frame    data/chars/misc/hadoken/0700000002.gif
    offset    72 28
    attack17 46 20 34 21 15 0 0 0 0 0 0
    bbox 46 20 34 21
    @cmd    makeOpponentBlock
    frame    data/chars/misc/hadoken/0700000003.gif
    attack17 46 20 34 21 15 0 0 0 0 0 0
    @cmd    makeOpponentBlock
    frame    data/chars/misc/hadoken/0700000004.gif
    offset    77 28
    attack17 51 20 34 21 15 0 0 0 0 0 0
    bbox 51 20 34 21
    @cmd    makeOpponentBlock
    frame    data/chars/misc/hadoken/0700000005.gif
    offset    74 27
    attack17 48 19 34 21 15 0 0 0 0 0 0
    bbox 48 19 34 21
    @cmd    makeOpponentBlock
    frame    data/chars/misc/hadoken/0700000006.gif
    offset    78 26
    attack17 52 18 34 21 15 0 0 0 0 0 0
    bbox 52 18 34 21
    @cmd    makeOpponentBlock
    frame    data/chars/misc/hadoken/0700000007.gif
    offset    79 23
    attack17 53 15 34 21 15 0 0 0 0 0 0
    bbox 53 15 34 21
    @cmd    makeOpponentBlock
    frame    data/chars/misc/hadoken/0700000008.gif
    offset    79 22
    attack17 53 14 34 21 15 0 0 0 0 0 0
    bbox 53 14 34 21
    @cmd    makeOpponentBlock
    frame    data/chars/misc/hadoken/0700000009.gif
    
#|edited by openBor Stats v 0.67

SpecFlash.txt:

Code:
# Special Hit flash

name    SpecFlash #Special flash (special move hitsparks)
type    none
shadow    0
alpha 1
setlayer 50000
animationscript data/chars/misc/flash/flash.c

anim idle

    delay 3
    offset 36 51
    @cmd randAni4 openborconstant("ANI_FOLLOW1") openborconstant("ANI_FOLLOW2") openborconstant("ANI_FOLLOW3") openborconstant("ANI_FOLLOW4")
    frame none
    frame none

anim follow1

    delay 3
    offset 360 272
    #drawmethod 128 128 0 0 0 1 0 0 0 0 # drawmethod {scalex} {scaley} {flipx} {flipy} {shiftx} {alpha} {remap} {fillcolor} {rotate} {fliprotate}
    drawmethod scale 0.52 0.52 # drawmethod scale {scalex} {scaley}
    drawmethod alpha 1 # drawmethod alpha {alpha}
    @cmd randDir
    frame data/chars/misc/flash/M_flash/8210_0.png
    frame data/chars/misc/flash/M_flash/8210_1.png
    frame data/chars/misc/flash/M_flash/8210_2.png
    frame data/chars/misc/flash/M_flash/8210_3.png
    frame data/chars/misc/flash/M_flash/8210_4.png
    frame data/chars/misc/flash/M_flash/8210_5.png
    frame data/chars/misc/flash/M_flash/8210_6.png
    frame data/chars/misc/flash/M_flash/8210_7.png
    frame data/chars/misc/flash/M_flash/8210_8.png
    frame data/chars/misc/flash/M_flash/8210_9.png
    frame data/chars/misc/flash/M_flash/8210_10.png
    frame data/chars/misc/flash/M_flash/8210_11.png
    @cmd suicide
    frame data/chars/misc/flash/M_flash/8210_11.png

anim follow2

    delay 3
    offset 360 272
    #drawmethod 128 128 0 0 0 1 0 0 0 0 # drawmethod {scalex} {scaley} {flipx} {flipy} {shiftx} {alpha} {remap} {fillcolor} {rotate} {fliprotate}
    drawmethod scale 0.52 0.52 # drawmethod scale {scalex} {scaley}
    drawmethod alpha 1 # drawmethod alpha {alpha}
    @cmd randDir
    frame data/chars/misc/flash/M_flash/8211_0.png
    frame data/chars/misc/flash/M_flash/8211_1.png
    frame data/chars/misc/flash/M_flash/8211_2.png
    frame data/chars/misc/flash/M_flash/8211_3.png
    frame data/chars/misc/flash/M_flash/8211_4.png
    frame data/chars/misc/flash/M_flash/8211_5.png
    frame data/chars/misc/flash/M_flash/8211_6.png
    frame data/chars/misc/flash/M_flash/8211_7.png
    frame data/chars/misc/flash/M_flash/8211_8.png
    frame data/chars/misc/flash/M_flash/8211_9.png
    frame data/chars/misc/flash/M_flash/8211_10.png
    frame data/chars/misc/flash/M_flash/8211_11.png
    @cmd suicide
    frame data/chars/misc/flash/M_flash/8211_11.png

anim follow3

    delay 3
    offset 360 272
    drawmethod scale 0.52 0.52 # drawmethod scale {scalex} {scaley}
    drawmethod alpha 1 # drawmethod alpha {alpha}
    @cmd randDir
    frame data/chars/misc/flash/M_flash/8212_0.png
    frame data/chars/misc/flash/M_flash/8212_1.png
    frame data/chars/misc/flash/M_flash/8212_2.png
    frame data/chars/misc/flash/M_flash/8212_3.png
    frame data/chars/misc/flash/M_flash/8212_4.png
    frame data/chars/misc/flash/M_flash/8212_5.png
    frame data/chars/misc/flash/M_flash/8212_6.png
    frame data/chars/misc/flash/M_flash/8212_7.png
    frame data/chars/misc/flash/M_flash/8212_8.png
    frame data/chars/misc/flash/M_flash/8212_9.png
    frame data/chars/misc/flash/M_flash/8212_10.png
    frame data/chars/misc/flash/M_flash/8212_11.png
    @cmd suicide
    frame data/chars/misc/flash/M_flash/8212_11.png

anim follow4

    delay 3
    offset 360 272
    drawmethod scale 0.52 0.52 # drawmethod scale {scalex} {scaley}
    drawmethod alpha 1 # drawmethod alpha {alpha}
    @cmd randDir
    frame data/chars/misc/flash/M_flash/8213_0.png
    frame data/chars/misc/flash/M_flash/8213_1.png
    frame data/chars/misc/flash/M_flash/8213_2.png
    frame data/chars/misc/flash/M_flash/8213_3.png
    frame data/chars/misc/flash/M_flash/8213_4.png
    frame data/chars/misc/flash/M_flash/8213_5.png
    frame data/chars/misc/flash/M_flash/8213_6.png
    frame data/chars/misc/flash/M_flash/8213_7.png
    frame data/chars/misc/flash/M_flash/8213_8.png
    frame data/chars/misc/flash/M_flash/8213_9.png
    frame data/chars/misc/flash/M_flash/8213_10.png
    frame data/chars/misc/flash/M_flash/8213_11.png
    @cmd suicide
    frame data/chars/misc/flash/M_flash/8213_11.png

projectilehit.c:
C:
void main(){
 
    //Projectile hitting certain entity with specified hit effects
    //A role play of hitfx
 
    void self = getlocalvar("self");
    void target = getentityproperty(self, "opponent");
    void tname = getentityproperty(target, "defaultname");
    void Type = getentityproperty(target, "type");
    void Beat = loadsample("data/sounds/beat1.wav");
    //clearspawnentry();
    //loadmodel("specflash");
    //setspawnentry("name", "specflash");
    //void Spawn = spawn();
 
    if(Type == openborconstant("TYPE_PLAYER")){
        // Players
        //void Beat = loadsample("data/sounds/beat1.wav");
        playsample(Beat, 0, 100, 100, 0, 0);
        //changeentityproperty(Spawn, "animation", openborconstant("ANI_IDLE"));
        //performattack(self, openborconstant("ANI_FOLLOW3"));
        //killentity(self);
    }else if(Type == openborconstant("TYPE_ENEMY")){
        // Enemies / CPU Opponents (Fighters as enemy type entities)
        //void Beat = loadsample("data/sounds/beat1.wav");
        playsample(Beat, 0, 100, 100, 0, 0);
        //performattack(self, openborconstant("ANI_FOLLOW3"));
        //killentity(self);
    }else if(tname == "Ryu3"){
        // Dummies
        //void Beat = loadsample("data/sounds/beat1.wav");
        playsample(Beat, 0, 100, 100, 0, 0);
        //performattack(self, openborconstant("ANI_FOLLOW3"));
        //killentity(self);
    }/*else if(tname == "hadoken" || tname == "khadoken" || tname == "khadokenE" || tname == "hadokenE"){
        //performattack(self, openborconstant("ANI_FOLLOW1"));
        changeentityproperty(self, "animation", openborconstant("ANI_FOLLOW1"));
        //killentity(self);
    }*/
}

How can I have a clashing spark appear when projectiles collide, and special hit sparks when it hits directly at its target (player, enemy, NPC, or obstacle)?
 
Last edited:
OK. I just finally solved my own problem which I was looking for, after I was playing around with characters' projectiles in MUGEN. I realized that the Hadou hit pops up along with the special move hit sparks when it hits the target. Even the Hadou hit pops up colliding with the other projectile, with no special move hit sparks in contact... which is good, because using followcond along with the two is quite helpful/useful. I was able to spawn a special move hit spark for the projectile to hit players and enemies and gave its axis after hitting its target in script. Here's what I got.

projectilehit.c:
C:
void main(){
    
    //Projectile hitting certain entity with specified hit effects
    //A role play of hitfx
    
    void self = getlocalvar("self");
    void target = getentityproperty(self, "opponent");
    void tname = getentityproperty(target, "defaultname");
    int x = getentityproperty(self, "x");
    int z = getentityproperty(self, "z");
    int y = getentityproperty(self, "y");
    void Type = getentityproperty(target, "type");
    void Beat = loadsample("data/sounds/beat1.wav");
    void Spawn;
    
    if(Type == openborconstant("TYPE_PLAYER")){
        // Players
        //void Beat = loadsample("data/sounds/beat1.wav");
        playsample(Beat, 0, 100, 100, 0, 0);
        clearspawnentry();
        loadmodel("specflash");
        setspawnentry("name", "specflash");
        Spawn = spawn();
        changeentityproperty(Spawn, "position", x, z, y);

    }else if(Type == openborconstant("TYPE_ENEMY")){
        // Enemies / CPU Opponents (Fighters as enemy type entities)
        playsample(Beat, 0, 100, 100, 0, 0);
        clearspawnentry();
        loadmodel("specflash");
        setspawnentry("name", "specflash");
        Spawn = spawn();
        changeentityproperty(Spawn, "position", x, z, y);

    }else if(tname == "Ryu3"){
        // Dummies
        //void Beat = loadsample("data/sounds/beat1.wav");
        playsample(Beat, 0, 100, 100, 0, 0);
        clearspawnentry();
        loadmodel("specflash");
        setspawnentry("name", "specflash");
        Spawn = spawn();
        changeentityproperty(Spawn, "position", x, z, y);
    }
}

Then, I added antigravity 100 for specFlash (special move hit spark(s)) entity as my choice. But you can use subject_to_gravity 0 for it.
 
I think I have a similar question (maybe a little more simple)

how do I use changeentityproperty (during gameplay) for flash especifically?

I currently have (say) an entity that uses " small blood flash" and I want to change it to a different one called "big blood flash."
 
I just realize my code is redundant and I didn't bother putting the OR operation in either types because I was testing spawned models in some different ways, but I ended up using the same scripts for testing purpose.

Back on topic. Could you be a little more specific? Did you take a look at spawn() and loadmodel? Does that entity attack in close range with its weapon or does it shoot with its projectile in open range?
 
I just realize my code is redundant and I didn't bother putting the OR operation in either types because I was testing spawned models in some different ways, but I ended up using the same scripts for testing purpose.

Back on topic. Could you be a little more specific? Did you take a look at spawn() and loadmodel? Does that entity attack in close range with its weapon or does it shoot with its projectile in open range?
No. I don't have any particular issue I was just curious because in the options for changeentityproperty (In the manual) there's "Flash" and I was wondering how do people use or what is it for exactly?

I keep getting errors:

for example changeentityproperty ( self, "flash", 1)

I tried replacing one with say smallblood or just a number, But I'm unsure of how this works.
 
I've never tried using "flash" property before, so I don't know what that means. It would be better if someone with much knowledge about it, explains how "flash" property is used. Could @DCurrent or @Kratus enlighten us on how it's used? It lacks information about it.


Wouldn't that "flash" be an entity name as a hitflash or something like this? changeentityproperty(self, "flash", "big_blood");

Otherwise, you could change its entity name with the other name: changeentityproperty(self, "name", "big_blood")

Are you going to give it a didhitscript for hits?
 
Last edited:
I've never tried using "flash" property before, so I don't know what that means. It would be better if someone with much knowledge about it, explains how "flash" property is used. Could @DCurrent or @Kratus enlighten us on how it's used? It lacks information about it.
@maxman @PS_VITA

DC may have more details about it, but according to my tests and source code check it seems that the "flash" property is a part of some unfinished feature.

Currently it just returns the entity ID number used by flash/block events defined at the entity's header and according to the models.txt order. In addition, it doesn't accepts "changeentityproperty", only "getentityproperty", so I think it will not be useful for your purpose.

But as an alternative way you can use events like didhit/ondoattack/takedamage/ondeath to create custom hitflashes. In case you need examples, I have similar features on the SOR2X game at the takedamage event used by some robot entities, preventing them from showing blood.
 
@Kratus is sort of correct. This requires a bit of in depth, so don't TLDR me. ;)

First, flash is not an entity property at all. It's a model property. One of the fundamental flaws of the getentityproperty() function is that it mixes in a lot of model properties and creates a ton of confusion. I'm fixing all that in the upcoming release with an all new entity property access, but that's another discussion. The point is, flash is a model property.

Next, the value of flash property is a model ID, not an entity. OpenBOR keeps an indexed list of model pointers just like it keeps a list of entity pointers. When new models load and there's a sub-entity command like flash, the loading routine uses the model name you provided (ex. flash mycoolflash) to locate the flash's model ID by name. That model ID is stored as the flash property. To spawn an entity from the flash model in game play, OpenBOR uses the ID from flash property to get the model pointer by its index. Again, this is how the engine handles all sub-entities (flash, dust, knife, etc.).

This is done because it moves an otherwise slow string search into the loading process, and replaces it with an instantaneous numeric reference during game play. It's also why the sub-entity model, whatever it is, has to be loaded before any command that tries to reference it.

HTH,
DC
 
Back
Top Bottom