O Ilusionista
Captain 80K
This tutorial provides an example of switching animations if a specific entity is on screen.
Last edited by a moderator:
Also, because it is a very, very serious optimization issue, I updated the sample code to use upstream constants.
But how serious is this?
Also, I always uses animation variables as "void" but you changed for "int". Is there any specific reason for this?
int
type. For strings, I recommend char
.void ent = getentity(i);
if ( getentityproperty(ent, "exists")
void player = getplayerproperty(i, "entity");
1. if(getentityproperty(player, "exists")) {
vs
2. if(player != NULL()){
@DCurrent could explain it better but as far as I know, both check for a player but using different methods: one check if it exists, the other checks it the player isn't NULL().Can someone please explain the differences between the two codes below?
Thanks alot.@DCurrent could explain it better but as far as I know, both check for a player but using different methods: one check if it exists, the other checks it the player isn't NULL().
If I am not mistaken, something that don't exist is different than somenthing NULL().
getentityproperty(player, "exists")
is specific to OpenBOR. It has to do with OpenBOR having a lot of asynchronous actions going on. It's possible that one loop might remove an entity before another loop completes that still has a reference to that entity in it. Without some flag to let the second loop know, you'd be referencing something that does not exist. That's called a segmentation fault (similar to the NULL reference), and will produce similarly undefined behavior. So, OpenBOR has some internal code to deal with that. That's what the "exists" does.I am getting this error and I think it has to do with NULL?NULL is not specfic to OpenBOR. It's coding parlance for a variable that is undefined. If you try to reference something that is NULL, you're going to get a NULL pointer error (instant shutdown by the OS), or worse, what all coding languages call an "undefined behavior". Depending on the hardware you might discover secret nudes of Anna Kendrick... or accidentally divide by 0 and break the space time continuum. Who knows?
For obvious reasons, code is usually written so that variables are always defined. In the case where it's unavoidable to have a possible NULL reference, you always check for a NULL first.
getentityproperty(player, "exists")
is specific to OpenBOR. It has to do with OpenBOR having a lot of asynchronous actions going on. It's possible that one loop might remove an entity before another loop completes that still has a reference to that entity in it. Without some flag to let the second loop know, you'd be referencing something that does not exist. That's called a segmentation fault (similar to the NULL reference), and will produce similarly undefined behavior. So, OpenBOR has some internal code to deal with that. That's what the "exists" does.
HTH,
DC
Assertion `list->solidlist != NULL' failed in function 'ImportNode_Init' at source/scriptlib/ImportCache.c:136.
This is an OpenBOR bug. Please report this at www.chronocrash.com.
I am getting this error and I think it has to do with NULL?
Code:Assertion `list->solidlist != NULL' failed in function 'ImportNode_Init' at source/scriptlib/ImportCache.c:136. This is an OpenBOR bug. Please report this at www.chronocrash.com.
It doesn't let me know anything else beside this.
Thank you
I found the issue. I was trying to setup the didhitscript and I hadMost likely you have too many freespecials & cancels. You need to increase maxfreespecials.
DC
I found the issue. I was trying to setup the didhitscript and I had
#import "data/scripts/MainScript.c" instead of #include "data/scripts/MainScript.c"
I copied it from another game and I had no clue the difference between
#import vs #include
I changed it to #include and it is working now,
thank you
Thank you so much for this my friend. It works like a charm and it's exactly what I was looking for.This tutorial provides an example of switching animations if a specific entity is on screen.