Owner x Parent

O Ilusionista

Captain 100K
Guys, I would like to undestand the different between entityproperty PARENT from entityproperty OWNER (so I can put the info in the manual).

I understand the PARENT concept (its the same of conding languages), but I am not sure about OWNER.

Any helpe is appreciated.
 
I don't really want to double document, because I've already written all this up in a wiki that will be released along with 4.0, and double documentation tends to lead to confusion. I'll leave this SS of it here though so you can at least know the difference.

1703133944429.png

DC
 
Last edited:
LOL I need to understand this too. @DCurrent you just mentioned that they are different things in another thread today. Could you clarify?
DC can explain better than me but according to what I understand as a user, owner connects a secondary entity to the main entity and shares the same attack data, like rush count. So, if you throw a projectile and it hit any opponent, it will act like if the main entity is hitting the same opponent too.
Parent will connect two entities but only for reference, like if you want to kill a parent entity used only for effects when a certain animation ends but with no attack data shared.

Usually if you use the projectile command the owner property is applied automatically to the projectile entity and shares the attack data automatically, but if you spawn using the native spawn() function you will need to apply the owner manually to have access to the attack data. Below you can see an example using a spawn script with spawn01.

C:
void spawnToss(void name, float dx, float dy, float dz, float Vx, float Vy, float Vz, void ani, int atk, int dir)
{//Spawn and Toss entity with defined conditions (DEFAULT TOSS SCRIPT USED FOR ALL SPAWNED ENTITIES, LIKE ITEMS)
    void self        = getlocalvar("self");
    void vSpawn        = spawn01(name, dx, dy, dz, NULL(), dir);
    int direction    = getentityproperty(self, "direction");

    if(direction == 0){Vx = -Vx;}
    tossentity(vSpawn, Vy, Vx, Vz);
 
    //SPAWN WITH A SPECIFIC ANIMATION??
    if(ani != NULL()){changeentityproperty(vSpawn, "animation", ani);}
 
    //THIS ENTITY IS USED FOR ATTACKS??
    if(atk != NULL()){
        void type        = getentityproperty(self, "type");
        void hostile    = getentityproperty(self, "hostile");
        void candamage    = getentityproperty(self, "candamage");
        void anim        = getentityproperty(self, "animationID");
        float offense    = getentityproperty(self, "offense", 0);
        int disable        = getentityproperty(self, "energycost", "disable", getlocalvar("animnum"));
    
        if(getglobalvar("projectileDamage") == "damage_all"){
            candamage = openborconstant("type_player")+openborconstant("type_enemy")+openborconstant("type_npc")+openborconstant("type_obstacle");
        }
    
        changeentityproperty(vSpawn, "parent", self);
        changeentityproperty(vSpawn, "owner", self);
        changeentityproperty(vSpawn, "hostile", hostile);
        changeentityproperty(vSpawn, "candamage", candamage);
        changeentityproperty(vSpawn, "offense", openborconstant("ATK_NORMAL"), offense);
        changeentityproperty(vSpawn, "offense", openborconstant("ATK_NORMAL2"), offense);
        changeentityproperty(vSpawn, "offense", openborconstant("ATK_NORMAL6"), offense);
        changeentityproperty(vSpawn, "offense", openborconstant("ATK_NORMAL8"), offense);
        changeentityproperty(vSpawn, "offense", openborconstant("ATK_NORMAL9"), offense);
        changeentityproperty(vSpawn, "offense", openborconstant("ATK_BURN"), offense);
        changeentityproperty(vSpawn, "offense", openborconstant("ATK_SHOCK"), offense);
        changeentityproperty(vSpawn, "aiflag", "attacking", 1);
        setentityvar(vSpawn, "parentAnimation", anim);
        setentityvar(vSpawn, "disable", disable);

EDIT: @DCurrent we posted at the same time haha, thanks for the explanation :)
 
Last edited:
@Kratus,

Owner doesn't tell the engine to share attack data. Actually, there's no sharing at all. The native projectile functions just copy the hostile and candamage values of the spawning entity to the projectile entity right as the projectile spawns. It also populates the projectile's Owner with property the entity that triggered the projectile spawn. As in my post above, downstream logic then treats entities with an Owner in a way fitting for typical projectiles.

Parent doesn't really do much natively, and it isn't supposed to. The only functions it performs at all are:
  • Entity to unsummon on death or with unsummon command.
  • Entity that a follow type NPC tries to follow.
DC
 
@Kratus,

Owner doesn't tell the engine to share attack data. Actually, there's no sharing at all. The native projectile functions just copy the hostile and candamage values of the spawning entity to the projectile entity right as the projectile spawns. It also populates the projectile's Owner with property the entity that triggered the projectile spawn. As in my post above, downstream logic then treats entities with an Owner in a way fitting for typical projectiles.

Parent doesn't really do much natively, and it isn't supposed to. The only functions it performs at all are:
  • Entity to unsummon on death or with unsummon command.
  • Entity that a follow type NPC tries to follow.
DC
Interesting, thanks for the clarification. It explains why we still need to apply the owner property for entities that were spawned using the spawn(), different from the projectile() command. Because rush count does not work if I remove it, this is why I thought it shares the same attack data.
 
Back
Top Bottom