Solved Missiles and another spawns doesn't get points to the parent player

Question that is answered or resolved.

Toranks

Active member
I have observed that with spawns via script (@cmd spawnXX), instead of using the built-in commands with openbor (as throwframe), hitting targets do not give points to the player. Is there an easy way to get points with scripted spawned missiles and similar?
 
Solution
If you are spawning projectiles with script, it's usually a good idea to use the projectile() function. This will take care of all the perfunctory values for you. Offense, candamage, and others. Otherwise you need to manually populate all of these manually. One of them is a property called owner. Owner tells the engine who gets score credit, and also HUD interaction display.
If you are spawning projectiles with script, it's usually a good idea to use the projectile() function. This will take care of all the perfunctory values for you. Offense, candamage, and others. Otherwise you need to manually populate all of these manually. One of them is a property called owner. Owner tells the engine who gets score credit, and also HUD interaction display.
 
Solution
For example... This extra line is correct?:

void spawn01(void vName, float fX, float fY, float fZ)
{
//spawn01 (Generic spawner)
//vName: Model name of entity to be spawned in.
//fX: X location adjustment.
//fZ: Y location adjustment.
//fY: Z location adjustment.

void self = getlocalvar("self"); //Get calling entity.
void vSpawn; //Spawn object.
int iDirection = getentityproperty(self, "direction");

clearspawnentry(); //Clear current spawn entry.
setspawnentry("name", vName); //Acquire spawn entity by name.

if (iDirection == 0){ //Is entity facing left?
fX = -fX; //Reverse X direction to match facing.
}

fX = fX + getentityproperty(self, "x"); //Get X location and add adjustment.
fY = fY + getentityproperty(self, "a"); //Get Y location and add adjustment.
fZ = fZ + getentityproperty(self, "z"); //Get Z location and add adjustment.

vSpawn = spawn(); //Spawn in entity.

changeentityproperty(vSpawn, "position", fX, fZ, fY); //Set spawn location.
changeentityproperty(vSpawn, "direction", iDirection); //Set direction.
changeentityproperty(vSpawn, "owner", self); //Set owner for hitpoints

return vSpawn; //Return spawn.
}
 
Last edited:
Back
Top Bottom