Steven1985
Active member
Hi, I created this script to have mpbar of npc as he is player2. In the file header of npc I put ondrawscript data/scripts/ondraw/npcmpbar.c.
This is the script:
But I have this error: Can't compile script 'ondrawscript' data/chars/players/nick_fury/nick_fury_cpu.txt
Thank you in advance.
This is the script:
C:
void main()
{
createMPBar();
updateMPBar();
destroyMPBar();
}
void createMPBar(int target) {
int x = 201;
int y = 19;
int w = getlocalvar("w", 100);
int h = getlocalvar("h", 2);
int noborder = getlocalvar("noborder", 0);
int type = getlocalvar("type", 0);
int orientation = getlocalvar("orientation", 0);
int border = getlocalvar("border", 0);
int shadow = getlocalvar("shadow", 0);
int graph = getlocalvar("graph", 0);
int backfill = getlocalvar("backfill", 0);
int color1 = rgbcolor(0x00, 0xFF, 0xFF); // CYAN BAR, MP REMAINING
int color2 = rgbcolor(0x00, 0x00, 0xFF); // BLUE BAR, MP LOST
void bar = bindentity(target);
if (bar) {
setentityvar(bar, "mp", 100); // Imposta la quantità di MP iniziale
setentityvar(bar, "mp_max", 100); // Imposta il massimo numero di MP
setentityvar(bar, "mp_color1", color1);
setentityvar(bar, "mp_color2", color2);
// Crea la barra
void mpbar = makebar(bar, x, y, w, h, noborder, type, orientation, border, shadow, graph, backfill);
setentityvar(bar, "mp_bar", mpbar);
}
}
void updateMPBar(int target, int mp, int mp_max) {
void bar = bindentity(target);
if (bar) {
setentityvar(bar, "mp", mp);
setentityvar(bar, "mp_max", mp_max);
// Aggiorna la barra
updatebar(getentityvar(bar, "mp_bar"));
}
}
void destroyMPBar(int target) {
void bar = bindentity(target);
if (bar) {
void mpbar = getentityvar(bar, "mp_bar");
killentity(mpbar); // Distruggi la barra
}
}
But I have this error: Can't compile script 'ondrawscript' data/chars/players/nick_fury/nick_fury_cpu.txt
Thank you in advance.