O Ilusionista
Captain 100K
I'm using an old @Bloodbane code to simplify branches, which takes the entity's alias and uses it as a value for a jumptobranch.
The problem is: after several reports, I realized that this happens exactly at the stage where I use this branch - a "silent crash", which doesn't generate any log entry, the engine just closes.
From my experience with OpenBOR, the only causes that generate this are:
Idle, with followanim and follow cond:
Follow animation with inline code:
My question is: is there any disadvantage in using this via animationscript and would it be better to use it via didhitscript?
The code already does this only on frame 1 (to avoid the case of the update not being completed on frame 0).
And maybe it would be good to put a safe check in case, for some reason, the "name" variable was not populated with the correct value and use a finishlevel()
Edit: I've added a safe check and log to catch the errors:
The problem is: after several reports, I realized that this happens exactly at the stage where I use this branch - a "silent crash", which doesn't generate any log entry, the engine just closes.
From my experience with OpenBOR, the only causes that generate this are:
- Declaring an invalid image as alternatepal - strangely, this doesn't happen if you declare it as "palette", because the engine returns this error in the log. This was already report on dev area, but I will open a github ticket soon.
- Using a weapon (alternate model) that wasn't loaded
- - A "Null point" - referring to a point in memory that doesn't exist. (Which is what happens in the options above in fact).
Idle, with followanim and follow cond:
Code:
anim idle
loop 1
delay 6
followanim 10
followcond 1
attack 25 30 30 30 0 0 1 1 0 30
hitfx data/sounds/silent.wav
noreflect 1
offset 40 60
frame data/chars/misc/branch/arrow_r.gif
offset 41 60
frame data/chars/misc/branch/arrow_r.gif
offset 40 60
frame data/chars/misc/branch/arrow_r.gif
offset 39 60
frame data/chars/misc/branch/arrow_r.gif
Follow animation with inline code:
C-like:
anim follow10
@script
void self = getlocalvar("self");
char Name = getentityproperty(self,"name");
if(frame == 1){
jumptobranch(Name, 1);
}
@end_script
delay 10
offset 27 27
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
frame data/chars/misc/empty.gif
My question is: is there any disadvantage in using this via animationscript and would it be better to use it via didhitscript?
The code already does this only on frame 1 (to avoid the case of the update not being completed on frame 0).
And maybe it would be good to put a safe check in case, for some reason, the "name" variable was not populated with the correct value and use a finishlevel()
Edit: I've added a safe check and log to catch the errors:
C-like:
@script
void self = getlocalvar("self");
char Name = getentityproperty(self,"name");
if(frame == 1){
if (Name){// safe check
log("\n\t ========= Branch Name: " + Name + "========= \n");
jumptobranch(Name, 1);
} else { // empty name variable
log("\n\t ========= Invalid branch name ========= \n");
finishlevel();
}
}
@end_script
Last edited: