• 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.

Reflect Projectile Back to Shooter Script Help

pendranome

New member
I'm working on a game mod and there is a character with a special move than can reflect certain projectiles back in the direction they came from. The problem I'm having is that the projectile will not damage the original parent even if I update the projectile's "candamage" property to include enemies. To be clear, other enemies CAN be hit by the reflected projectile, just not the enemy who actually shot the projectile. Can anyone help me figure out what I would need to do to make a projectile entity "betray" its creator so to speak?

Before anyone brings it up, I found a post that touches on this, but as far as I can tell the code here is doing the same thing my code is. It simply reversed the direction and velocity and then reassigns the "candamage" value.

Not sure why it works here but not in my mod. Maybe it has something to do with the entity's type??? Here's a snippet of the code:

C++:
if(getentityproperty(other, "type") == openborconstant("TYPE_SHOT")

                    || getentityproperty(other, "type") == 2) {

                    int direction = getentityproperty(other, "direction");

                    int xVel = getentityproperty(other, "xdir");

                    if(direction == 0) {

                        direction = 1;

                    } else {

                        direction = 0;

                    }



                    xVel = xVel*-2;



                    changeopenborvariant("lasthitc", 0);



                    performattack(self,openborconstant("ANI_FOLLOW11"), 1);



                    changeentityproperty(other, "parent", self);

                    //changeentityproperty(other, "hostile", "type_enemy", "type_player", "type_obstacle", "type_npc", "type_shot");

                    //changeentityproperty(other, "type", openborconstant("TYPE_SHOT"));

                    changeentityproperty(other, "candamage", openborconstant("type_enemy"), openborconstant("type_player"), openborconstant("type_obstacle"), openborconstant("type_npc"), openborconstant("type_shot"));

                    //changeentityproperty(other, "projectilehit", "type_enemy", "type_player", "type_obstacle", "type_npc", "type_shot");

                    changeentityproperty(other, "direction", direction);

                    changeentityproperty(other, "velocity", xVel, 0, 0);

                }

Any help would be greatly appreciated.
 
I'm working on a game mod and there is a character with a special move than can reflect certain projectiles back in the direction they came from. The problem I'm having is that the projectile will not damage the original parent even if I update the projectile's "candamage" property to include enemies. To be clear, other enemies CAN be hit by the reflected projectile, just not the enemy who actually shot the projectile. Can anyone help me figure out what I would need to do to make a projectile entity "betray" its creator so to speak?

Before anyone brings it up, I found a post that touches on this, but as far as I can tell the code here is doing the same thing my code is. It simply reversed the direction and velocity and then reassigns the "candamage" value.

Not sure why it works here but not in my mod. Maybe it has something to do with the entity's type??? Here's a snippet of the code:

C++:
if(getentityproperty(other, "type") == openborconstant("TYPE_SHOT")

                    || getentityproperty(other, "type") == 2) {

                    int direction = getentityproperty(other, "direction");

                    int xVel = getentityproperty(other, "xdir");

                    if(direction == 0) {

                        direction = 1;

                    } else {

                        direction = 0;

                    }



                    xVel = xVel*-2;



                    changeopenborvariant("lasthitc", 0);



                    performattack(self,openborconstant("ANI_FOLLOW11"), 1);



                    changeentityproperty(other, "parent", self);

                    //changeentityproperty(other, "hostile", "type_enemy", "type_player", "type_obstacle", "type_npc", "type_shot");

                    //changeentityproperty(other, "type", openborconstant("TYPE_SHOT"));

                    changeentityproperty(other, "candamage", openborconstant("type_enemy"), openborconstant("type_player"), openborconstant("type_obstacle"), openborconstant("type_npc"), openborconstant("type_shot"));

                    //changeentityproperty(other, "projectilehit", "type_enemy", "type_player", "type_obstacle", "type_npc", "type_shot");

                    changeentityproperty(other, "direction", direction);

                    changeentityproperty(other, "velocity", xVel, 0, 0);

                }

Any help would be greatly appreciated.

You also need to change the Owner property. There is a check in the damage routine that prevents a projectile from hitting its owner.

This is for the simple reason that as you spawn the projectile, chances are its attack box is overlapping the owner's body box, so without that check Ryu would just hit himself in the face with his own Hadouken.

Note: Owner, not Parent. The Parent property has nothing to do with it.

HTH,
DC
 
You also need to change the Owner property. There is a check in the damage routine that prevents a projectile from hitting its owner.

This is for the simple reason that as you spawn the projectile, chances are its attack box is overlapping the owner's body box, so without that check Ryu would just hit himself in the face with his own Hadouken.

Note: Owner, not Parent. The Parent property has nothing to do with it.

HTH,
DC
Yes it worked! Thank you so much DC. It works exactly like I want it to now. It was driving me crazy!
 
Back
Top Bottom