• All, I am currently in the process of migrating domain registrations. During this time there may be some intermittent outages or slowdowns. Please contact staff if you have any questions.

projectile deflect

bWWd

Well-known member
I want to have one entityt that can be deflected when you hit it so it travels opposite way and hits enemy back, its a projectile ,so i set it as npc, and when you hit it it should be able to hit enemy, so all works fine but it wont hit enemy back even if i set candamage by script or even when candamage enemy player is in header at all times.

Why projectile refuses to hit the owner n matter what i do? I dont want extra txt file just to spawn clone of the projectile.
So what is the secret to make it work ? Should be easy but its not cause of some internal flags or parenting , i cant be bothered to figure this out and spent houtrs changing aiflags and all, so i figured ill just ask if its even possible ? I want it all done within one entity.
It hits other enemies but not the owner .

I spawn projectile with projectile command in enemy attack.


@cmd projectile 1 "alfir" 30 3 180 1 0 0 3


Heres the fireball text

Code:
name    alfir
speed 5
jumpheight  0
type npc
shadow    1
remove 0
nolife 1
health 1
palette data/chars/almost/fih1.png
nomove 1
candamage obstacle player enemy
hostile obstacle player enemy
offscreenkill 300
nodrop 2
nodieblink 2
score 1 -1
falldie 1
alpha  1
flip 1
 
 


anim    death
    loop    0
    delay    3
    offset 128 44
    bbox 44 4 180 86
hitfx    data/sounds/beat2.wav
    followanim 1
    followcond 1
    jugglecost 100
    flipframe  0
    dropv -1.0 -1.0 -1.0
    hitflash    flash2
    attack    33 65 104 57 0 0 1 0 0 75
    seta  1
            @script
                void self = getlocalvar("self");
         if (getentityproperty(self, "direction")==1){
        changeentityproperty(self, "velocity", 4, 0, 0);
        }
        if (getentityproperty(self, "direction")==0){
        changeentityproperty(self, "velocity", -4, 0, 0);
        }
    @end_script
         frame    data/chars/almost/fih1.png
        frame    data/chars/almost/fih2.png
        frame    data/chars/almost/fih3.png
        frame    data/chars/almost/fih4.png
        frame    data/chars/almost/fih5.png
        frame    data/chars/almost/fih6.png
        frame    data/chars/almost/fih1.png
        frame    data/chars/almost/fih2.png
        frame    data/chars/almost/fih3.png
        frame    data/chars/almost/fih4.png
        frame    data/chars/almost/fih5.png
        frame    data/chars/almost/fih6.png
        frame    data/chars/almost/fih1.png
        frame    data/chars/almost/fih2.png
        frame    data/chars/almost/fih3.png
        frame    data/chars/almost/fih4.png
        frame    data/chars/almost/fih5.png
        frame    data/chars/almost/fih6.png
        frame    data/chars/almost/fih1.png
        frame    data/chars/almost/fih2.png
        frame    data/chars/almost/fih3.png
        frame    data/chars/almost/fih4.png
        frame    data/chars/almost/fih5.png
        frame    data/chars/almost/fih6.png
        frame    data/chars/almost/fih1.png
        frame    data/chars/almost/fih2.png
        frame    data/chars/almost/fih3.png
        frame    data/chars/almost/fih4.png
        frame    data/chars/almost/fih5.png
        frame    data/chars/almost/fih6.png
        frame    data/chars/almost/fih1.png
        frame    data/chars/almost/fih2.png
        frame    data/chars/almost/fih3.png
        frame    data/chars/almost/fih4.png
        frame    data/chars/almost/fih5.png
        frame    data/chars/almost/fih6.png
 
    killentity(self)
    
 

 
 
 
    
anim    idle


#    stun    10
    loop    1 1
    delay    3
    offset 128 44
    bbox 44 4 180 86
    followanim 1
    followcond 1
    jugglecost 100
    attack    89 19 104 57 0 0 1 0 0 75
    dropv -1.0 -1.0 -1.0
    hitflash flash2
    hitfx data/sounds/beat2.wav
    seta  1
            @script
                void self = getlocalvar("self");
         if (getentityproperty(self, "direction")==1){
             changeentityproperty(self,"parent", NULL());
        changeentityproperty(self, "velocity", 16, 0, 0);
        }
        if (getentityproperty(self, "direction")==0){
            changeentityproperty(self,"parent", NULL());
        changeentityproperty(self, "velocity", 16, 0, 0);
        changeentityproperty(self, "velocity", -16, 0, 0);
        }
    @end_script
 
         frame    data/chars/almost/fih1.png
        frame    data/chars/almost/fih2.png
        frame    data/chars/almost/fih3.png
        frame    data/chars/almost/fih4.png
        frame    data/chars/almost/fih5.png
        frame    data/chars/almost/fih6.png
        frame    data/chars/almost/fih1.png
        frame    data/chars/almost/fih2.png
        frame    data/chars/almost/fih3.png
        frame    data/chars/almost/fih4.png
        frame    data/chars/almost/fih5.png
        frame    data/chars/almost/fih6.png
        frame    data/chars/almost/fih1.png
        frame    data/chars/almost/fih2.png
        frame    data/chars/almost/fih3.png
        frame    data/chars/almost/fih4.png
        frame    data/chars/almost/fih5.png
        frame    data/chars/almost/fih6.png
        frame    data/chars/almost/fih1.png
        frame    data/chars/almost/fih2.png
        frame    data/chars/almost/fih3.png
        frame    data/chars/almost/fih4.png
        frame    data/chars/almost/fih5.png
        frame    data/chars/almost/fih6.png
 
Last edited:
I can't remember if @cmd projectile populates it with the "parent" setting, because if so the projectile won't hit it's owner.

Try spawning the projectile with "spawn01" function, but check if your script doesn't set the projectile parent (my version does it).
 
Ok not using projectile solved it , spawned it by script
But still... i wanna know what the hell is going on there and why the useless parenting flags that are not being used anywhhere anyway but make life harder ?
 
Why projectile refuses to hit the owner n matter what i do?
This is what is expected to happen:

Without that, as soon as Ryu released the hadouken, it would hit Ryu instantly. The engine is acting as expected and in the correct way. When you spawn something natively (knife, bomb, star), the engine already configures the owner automatically.

But when you do it via script, you have complete control. And that means exactly this: the engine does exactly what you tell it to do and nothing else (except collision routines, etc.).

But still... i wanna know what the hell is going on there and why the useless parenting flags that are not being used anywhhere anyway but make life harder ?
Come on dude. I would expect such behaviour from a newcommer, not from a veteran like you.
You have enough knowledge about the engine not to claim something like "useless flag about parent".

As a friend, I ask you not to reproduce the behavior of someone who doesn't understand something about the engine and starts to blame it. I've seen it happen and I know how it ends.

Many people are inspired by your work (I was inspired myself). Think about it :)
 
Yeah im irritated as hell, im losing money when im losing time... and i mean literally, i do some work now.
im aware it shows , no bad intentions, just want to know all the causes simply to not waste time.
 
Oh well i already forgot about this , i think you treat the internets too serious

I feel the same way as @O Ilusionista, in that I respect you as a long time and very adroit member of this community.

You also know good and well why the rules are in place, and belittling me, while not the biggest deal in the world, is the last straw.

10 day mute. Please come back with a better attitude, or do not come back.

DC
 
Back
Top Bottom