Projectile's palette according the parent's one

16-bit Fighter

Active member
In my mod a char uses the projectile command and I'd like the projectile's palette to be according the char's one.

I created an onspawnscript for the projectile's entity but nothing happens:

C:
void main ()

{

    void self = getlocalvar("self");

    void parent = getentityproperty(self, "parent");

    int PMap = getentityproperty(parent, "map");

    if(parent!=NULL()){

    changeentityproperty(self, "map", PMap);

    }

}

Any idea about the problem please?
 
Solution
@Kratus:
It makes OB shut down.

The log:
I looked the code again and added a necessary step, please try this new one.

C:
void toss(void Bomb, float dx, float dy, float dz)
{ // Tossing bomb
    void vShot;
    void self = getlocalvar("self");
    int Direction = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int z = getentityproperty(self, "z");
    int map = getentityproperty(self, "map");

    if (Direction == 0){ //Is entity facing left?                
        dx = -dx; //Reverse X direction to match facing
    }
    vShot = projectile(Bomb, x+dx, z+dz, y+dy, Direction, 0, 1, 0);
    changeentityproperty(vShot, "map", map);
    return...
@Kratus:
It makes OB shut down.

The log:
I looked the code again and added a necessary step, please try this new one.

C:
void toss(void Bomb, float dx, float dy, float dz)
{ // Tossing bomb
    void vShot;
    void self = getlocalvar("self");
    int Direction = getentityproperty(self, "direction");
    int x = getentityproperty(self, "x");
    int y = getentityproperty(self, "a");
    int z = getentityproperty(self, "z");
    int map = getentityproperty(self, "map");

    if (Direction == 0){ //Is entity facing left?                
        dx = -dx; //Reverse X direction to match facing
    }
    vShot = projectile(Bomb, x+dx, z+dz, y+dy, Direction, 0, 1, 0);
    changeentityproperty(vShot, "map", map);
    return vShot;
}
 
Last edited:
Solution
Back
Top Bottom