Colourmap & Vars

O Ilusionista

Captain 100K
I am making a function where I will change my colourmap to a specific one then revert to the previous colourmap if I use the right value. The goal here is since I will be using the same burn and shock sprites for almost every char on the mod, I don't want to add those colors on each characters palette.

So:

-I get my current map and store it as a variable, if the variable is NULL
-if the value is that I want is greater than 4 (the chars have 4 palettes. palette 5 is for burn and 6 for shock),  change to the desired value
- if not, change to the original palette (I will me using the function two times).

On the frame 1, I will use "@cmd paleta 5" and on the last one "@cmd paleta 0"


The code

void paleta(int Pal)
{//
    void self = getlocalvar("self"); //Get calling entity.
    int oPal = getentityproperty(self, "colourmap"); // get actual colourmap
    int cor = getindexedvar(0); //store it on a var

if (cor==NULL()){ //if the var is NULL
setindexedvar(0, oPal);
}

    if (Pal > 4){
changeentityproperty(self, "colourmap", Pal);
  }
else{
changeentityproperty(self, "colourmap", getindexedvar(0));
setindexedvar(0, NULL());
}

}

But it return the following error:

Script function 'getindexedvar' returned an exception, check the manual for details.
OpCode: 8
OpCode: 8

What is wrong? And where I can see more about this and that OpCode, since it isn't in any manual?
 
That error message means you are missing script.txt in data folder (placed together with models.txt etc).

This script.txt should have this at least:

maxindexedvars  10

You can set bigger value if needed.
BTW indexed variable is global, for entity's personal use, you can use local variable or entity variable. For the latter you need to add

maxentityvars  15

in script.txt.
 
Back
Top Bottom