Solved Player Cannot Interact with Enemies Randomly Bug

Question that is answered or resolved.

Aerisetta

Active member
I have a very strange bug that began after I altered Bbox or player and enemy with CMT, but I cannot find the cause. Hoping someone could think of some clues why this is happening.

  1. Start the game
  2. Everything seems normal
  3. Randomly the player will not be able to interact (hit, get hit) an enemy anymore.
  4. This could be the 2nd enemy or 10th enemy, but seems to never be the 1st enemy.
  5. NPC can still interact with the enemy (in my game, via the spawned dummy at 1:34 in video below)
The player can ALWAYS GET weapon items from the ground, no problem there
This bug DOES happen to coins randomly, which is collected by (coin item) attack box and player bbox collision

Please see below video for example
Bugged enemy appears at 0:52
The bug is clearly visible starting 1:40

 
Last edited:
I have a very strange bug that began after I altered Bbox or player and enemy with CMT, but I cannot find the cause. Hoping someone could think of some clues why this is happening.

  1. Start the game
  2. Everything seems normal
  3. Randomly the player will not be able to interact (hit, get hit) an enemy anymore.
  4. This could be the 2nd enemy or 10th enemy, but seems to never be the 1st enemy.
  5. NPC can still interact with the enemy (in my game, via the spawned dummy at 1:34 in video below)
The player can ALWAYS GET weapon items from the ground, no problem there
This bug DOES happen to coins randomly, which is collected by (coin item) attack box and player bbox collision

Please see below video for example
Bugged enemy appears at 0:52
The bug is clearly visible starting 1:40

Are you using some additional properties in your bullets? I see that the bugged enemy receives at least 1 shot after the spawn and before the collision is disabled.

I had a similar problem and in my case it was connected to the aiflag "projectile", which I solved by adding the "damage_on_landing" property in the player didhit event in order to reset the bboxes as soon as the falling enemy hits the ground.

I would like to know how the bullet entity works and how you defined the "candamage/projectilehit" properties on the characters.
 
Are you using some additional properties in your bullets? I see that the bugged enemy receives at least 1 shot after the spawn and before the collision is disabled.

I had a similar problem and in my case it was connected to the aiflag "projectile", which I solved by adding the "damage_on_landing" property in the player didhit event in order to reset the bboxes as soon as the falling enemy hits the ground.

I would like to know how the bullet entity works and how you defined the "candamage/projectilehit" properties on the characters.

Thanks for quick reply

PLAYER
Code:
name            Lucifer
type            player
health            99
speed            70
running         70 3.1 1.2 1 0
jumpheight         6 # overidden by script
jumpspeed         20
mpset             100 0 100 0 0
grabdistance         100
jugglepoints        30
riseinv            1 1
makeinv            2 0
combostyle        2
atchain            1 1 2 3
gfxshadow        1 1
dust            dust
bflash            block
death            2
riseinv            1
weapons            Lucifer_Shotgun Lucifer_MP5 Lucifer_Rifle Lucifer_Rocket Lucifer
#icon            data/chars/aerisetta/icon.png
diesound        data/sounds/A_Death.wav
animationscript        data/scripts/player.c
keyscript        data/chars/lucifer/amakey.c
didhitscript        data/chars/aerisetta/aerihit.c
ondrawscript data/scripts/ondraw.c
takedamagescript    data/scripts/enemdmg.c
projectilehit        enemy obstacle trap
grabforce        -1
grabfinish        1

ENEMY
Code:
name            Badgirl_Rifle
type            enemy
aimove            avoidx
health            30
speed            10
running         40 3.1 1.2 1 0
gfxshadow        1 3
atchain            1
death            2
nopain            1
dust            dust
candamage        player npc
animationscript        data/scripts/player.c
takedamagescript    data/scripts/enemdmg.c
onblocksscript        data/scripts/wallbons.c
onblockwscript        data/scripts/wallbons.c
diesound        data/sounds/Maid_Death.wav
jugglepoints         100
projectilehit   enemy obstacle trap
falldie        1

PLAYER BULLET
Code:
name    bullene2
type    none
health  1
speed    200
noquake 1
remove    1
nolife  1
lifespan  3
candamage    enemy obstacle
offscreenkill     50

ENEMEY BULLET

Code:
name    bullet1
health  1
type    none
speed    30
noquake 1
remove    1
nolife  1
antigrab    173
candamage       player npc obstacle
lifespan  4
offscreenkill     200
 
I see some script events that may cause this bug. The first thing I suggest is to gradually disable each one and make continuous tests, mainly the didhit/takedamage.
In addition, I would like to know the bullet spawn method, both player and bullet's animations too.

I saw that you are using "nopain" in the enemy and the player's candamage is not defined. I suggest to make tests on these two elements too.
 
I see some script events that may cause this bug. The first thing I suggest is to gradually disable each one and make continuous tests, mainly the didhit/takedamage.
In addition, I would like to know the bullet spawn method, both player and bullet's animations too.

I saw that you are using "nopain" in the enemy and the player's candamage is not defined. I suggest to make tests on these two elements too.
Will do

I use generic @cmd shooter for bullets
 
@Aerisetta

FYI, there's an option for attacks (noreflect 1) that allows them to hit and cause damage with no stun or knockdown unless the target dies. It might be something to consider if that's the reason your enemy has nopain active.

As for the bug, @Kratus is right. I don't see anything immediately either, so the best thing to do is make a copy of your data folder, then walk back scripts and additions one by one until you find it.

In the future, I'd highly recommend making your module into a private GitHub project. That way each change you make becomes an iteration that you can go back to or undo without any hassle.

DC
 
@Aerisetta

FYI, there's an option for attacks (noreflect 1) that allows them to hit and cause damage with no stun or knockdown unless the target dies. It might be something to consider if that's the reason your enemy has nopain active.

As for the bug, @Kratus is right. I don't see anything immediately either, so the best thing to do is make a copy of your data folder, then walk back scripts and additions one by one until you find it.

In the future, I'd highly recommend making your module into a private GitHub project. That way each change you make becomes an iteration that you can go back to or undo without any hassle.

DC
Yup, still trying to unravel it bit by bit but have not found the cause...

Thanks for the recommendation, I just started a github...but it looks very confusing lol.
 
i found the problem and solved it, ill update you all when i actually pinpoint what it was
Great! I removed many things to the point the issue didn't happen but I was not able to test properly rolling back the changes because the game randomly crashes with no error on the log. Most of these crashes happened after a player or enemy's death, apparently the engine tries to load a missing cutscene or script event.

Please, share with us the solution if you can :)

EDIT:
I'd highly recommend making your module into a private GitHub project.
I totally agree and recommend it too. The combo "GitHub Desktop + Visual Studio Code" gives a much better control over the projects.
 
Last edited:
Back
Top Bottom