Is there a way to make a summoned unit grant the caster attack ownership, similar to a projectile?

kimduck

Member
I created a skill that summons a Sorceress Thunder Cloud.
As shown in the video, it is a type = npc that follows enemies and attacks them.
When the Thunder Cloud attacks, however, the score and combo count do not increase.


Is there a way for a type = npc summoned via @cmd spawn to grant attack ownership to the caster, similar to how a projectile assigns hit ownership when it hits?


I would appreciate any help
 
The simplest means is to set the NPC's owner property. This is the property used by projectiles to credit owners with the hit.

It has side effects though. The engine will consider the NPC a projectile, and projectiles are not able to hit each other. Meaning the NPC will be immune to enemy projectiles. Moreover, you might not want this as much as you think, because it will also spam the player's HUD each time NPC hits an enemy - same as a projectile would.

If you want more a stable means to do this, you'll probably need to manually script the score and hit count gains yourself.

DC
 
The simplest means is to set the NPC's owner property. This is the property used by projectiles to credit owners with the hit.

It has side effects though. The engine will consider the NPC a projectile, and projectiles are not able to hit each other. Meaning the NPC will be immune to enemy projectiles. Moreover, you might not want this as much as you think, because it will also spam the player's HUD each time NPC hits an enemy - same as a projectile would.

If you want more a stable means to do this, you'll probably need to manually script the score and hit count gains yourself.

DC
That’s fine. The summoned Thunder Cloud is invincible anyway and only performs direct attacks.
I’m willing to try that approach.
If you could explain how to implement it, I would appreciate it.
 
If you want to set the spawner as owner of the NPC, you need to set it with script like in this function:
C:
void spawner(void Name, float dx, float dy, float dz)
{ // Spawn certain entity and set it as child
   void self = getlocalvar("self");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, dz);
   changeentityproperty(Spawn, "parent", self);
   changeentityproperty(Spawn, "owner", self);

   return Spawn; //Return spawn.
}
 
If you want to set the spawner as owner of the NPC, you need to set it with script like in this function:
C:
void spawner(void Name, float dx, float dy, float dz)
{ // Spawn certain entity and set it as child
   void self = getlocalvar("self");
   void Spawn;

   Spawn = spawn01(Name, dx, dy, dz);
   changeentityproperty(Spawn, "parent", self);
   changeentityproperty(Spawn, "owner", self);

   return Spawn; //Return spawn.
}
Should I create a .c file and apply it to the summoned creature?
Or should I put it directly into the summoning skill in the character .txt file?
 
Back
Top Bottom