Having an odd issue with entity disappearing on seemingly random, but consistent parts of the map depending on where the observer is. Not sure what's causing it as I haven't worked with entities in this game that much. I've tried a few different methods of creating the entity, different rendermodes and perhaps other things. All seems to have this same effect.
In some maps like dust2 and nuke the entity doesn't actually appear at all.
On a bigger map it does appear but disappears once the observer walks into seemingly random parts of the map, so clearly something is not right.
Here's the function where entity in question is being created:
Spoiler
PHP Code:
stock createThink()
{
/* createThink()
- parameters : ( )
- description : creates an entity that runs recorded paths back and forth, called on mapstart
- return : -
*/
// new ent = create_entity("info_player_deathmatch");
new ent = engfunc( EngFunc_CreateNamedEntity,engfunc( EngFunc_AllocString, "info_target") );
if(!ent) {
log_amx("Failed to create think entity");
return;
}
entity_set_model(ent, BOT_MODEL);
new Float:maxs[3] = {16.0, 16.0, 36.0};
new Float:mins[3] = {-16.0, -16.0, -36.0};
Try using what phant said or env_sprite. Don't set any rendering or scaling options.
IMO try removing this completely and see what happens and also try to spawn entity with dllfunc_spawn:
Did you tried to use "cycler_sprite" instead of "info_target"?
Now I have. That just makes it really laggy, and the same issue persists
Quote:
Originally Posted by georgik57
Try using what phant said or env_sprite. Don't set any rendering or scaling options.
IMO try removing this completely and see what happens and also try to spawn entity with dllfunc_spawn:
Thanks for the replies, already tried both of these. Whether there was rendering / scaling, DLLFunc_Spawn / DispatchSpawn or not, it makes no difference.
However, looking at hlsdk_const.inc, this was fixed by just setting movetype to 10, it seems to be 0 by default (NONE). I tried 12 before (FOLLOW) and that had the same problem.
But MOVETYPE_BOUNCE fixes this. If you get some unwanted bouncing, MOVETYPE_FLY also works.
If anyone has this problem you can fiddle with different movetypes to see what suits you.
Spoiler
PHP Code:
#define MOVETYPE_NONE 0 // Never moves
#define MOVETYPE_WALK 3 // Player only - moving on the ground
#define MOVETYPE_STEP 4 // Gravity, special edge handling -- monsters use this
#define MOVETYPE_FLY 5 // No gravity, but still collides with stuff
#define MOVETYPE_TOSS 6 // Gravity/Collisions
#define MOVETYPE_PUSH 7 // No clip to world, push and crush
#define MOVETYPE_NOCLIP 8 // No gravity, no collisions, still do velocity/avelocity
#define MOVETYPE_FLYMISSILE 9 // Extra size to monsters
#define MOVETYPE_BOUNCE 10 // Just like Toss, but reflect velocity when contacting surfaces
#define MOVETYPE_BOUNCEMISSILE 11 // Bounce w/o gravity
#define MOVETYPE_FOLLOW 12 // Track movement of aiment
#define MOVETYPE_PUSHSTEP 13 // BSP model that needs physics/world collisions (uses nearest hull for world collision)
Here's the working function:
Spoiler
PHP Code:
stock createThink()
{
/* createThink()
- parameters : ( )
- description : creates an entity that runs recorded paths back and forth, called on mapstart
- return : -
*/
new ent = create_entity("info_player_deathmatch");
// new ent = engfunc( EngFunc_CreateNamedEntity,engfunc( EngFunc_AllocString, "cycler_sprite") );
if(!ent) {
log_amx("Failed to create think entity");
return;
}
entity_set_model(ent, BOT_MODEL);
new Float:maxs[3] = {16.0, 16.0, 36.0};
new Float:mins[3] = {-16.0, -16.0, -36.0};
engfunc(EngFunc_SetSize, ent, mins, maxs);