What are the Script Disadvantages?

Bruce

Active member
Hi everyone,
I'm sorry if this question has been asked before.
I've been trying to reduce the messy in the character.c files,
so I've been creating a bunch of scripts in the animationscript to use them throughout the character.c files.
Everything seems to work great, but I would like to code the right way to eliminate issues for later.

Can you someone please kindly explain the disadvantages for creating scripts in the animationscript?
Thank you so much
 
i have been adviced to avoid inline script as much as possible, & instead use scripts that you can summon like this :

@cmd spawnbind

to do this type, usually you import the spawnbind script into your entity's script and then in the character's text file you need to have this:

animationscript data/scripts/fatboyNo1.c

there are other .c stuff that you can use besides animationscript, like onthink, ondeath, onspawn, etc

if you have been doing this , i suppose that further improvement is to have some scripts tied to the right/most correct category of an event instead of trying to do everything with animationscript
 
DC explained in his post about optimizing scripts, and there are advantages and disadvantages of using scripts especially animation scripts. You can read the discussion too.

 
Thank you very much for the link to the guide, which is great info there, but I still need to re-read it over and over to fully understand it.
I guess I was using the wrong term "script"
What I meant was like this,
for example,
Code:
void GrabDistance(int MP_Cost, int TargetX, int TargetY, int TargetZ, void Ani) {
    void self = getlocalvar("self");
    void mp = getentityproperty(self,"mp");
    void target = getentityproperty(self, "opponent");  // get the opponent closeby
    //void target = getlocalvar("Target" + self);   //get the target that has been hit
    void x, y, z;
    
    x= getentityproperty(self, "x") - getentityproperty(target, "x");
    y= getentityproperty(self, "y") - getentityproperty(target, "y");
    z= getentityproperty(self, "z") - getentityproperty(target, "z");
    
    if (x < 0){
        x *= -1;
    }
    if (y < 0){
        y *= -1;
    }
    if (z < 0){
        z *= -1;
    }

    if(mp>=0){           
        if(x>TargetX || y>TargetY || z>TargetZ){
            changeentityproperty(self, "animation", openborconstant(Ani));
        } else {
                int mp = mp - MP_Cost;
                changeentityproperty(self, "mp", mp);
        }
    }else {
        playsample(loadsample("data/sounds/not_enough_MP.wav"), 1, 170, 170, 100, 0);
        changeentityproperty(self, "animation", openborconstant(Ani));
    }         
}

Instead of using it in the grab animations over and over in the player.c, I made this function, so that it won't be too messy in the player.c
Another example is
Code:
void NextSkill(void Ani)
{
    void self = getlocalvar("self");
    changeentityproperty(self, "animation", openborconstant(Ani));
}

I hope it makes sense :-)
 
Back
Top Bottom