ziggi / FCNPC

FCNPC - Fully Controllable NPC
Apache License 2.0
138 stars 31 forks source link

Faulty callback calls when using the plugin in more than 1 script #128

Closed WoutProvost closed 6 years ago

WoutProvost commented 6 years ago

Used gamemode: https://gist.github.com/WoutProvost/198897527065c748cb9e47d7236d9427 Used filterscript: https://gist.github.com/WoutProvost/ab367ab8ab399b8f47a7468836a66d10 Server.cfg:

gamemode0 bare 1
filterscripts
plugins FCNPC

Logs when only the gamemode is loaded:

ONPLAYERGIVEDAMAGE TICK 1177505375 HEALTH BEFORE 100.000000 DAMAGE 46.200000
ONPLAYERGIVEDAMAGE TICK 1177506173 HEALTH BEFORE 53.799999 DAMAGE 46.200000
ONPLAYERGIVEDAMAGE TICK 1177506957 HEALTH BEFORE 7.599998 DAMAGE 46.200000

FCNPC_ONTAKEDAMAGE TICK 1177614926 HEALTH BEFORE 100.000000 DAMAGE 46.200000
FCNPC_ONTAKEDAMAGE TICK 1177615970 HEALTH BEFORE 53.799999 DAMAGE 46.200000
FCNPC_ONTAKEDAMAGE TICK 1177616843 HEALTH BEFORE 7.599998 DAMAGE 46.200000

The NPC was shot 3 times with the deagle before dying, which is what it should be.

Logs when both the gamemode and filterscript are loaded:

ONPLAYERGIVEDAMAGE TICK 1177525879 HEALTH BEFORE 53.799999 DAMAGE 46.200000
ONPLAYERGIVEDAMAGE TICK 1177526779 HEALTH BEFORE 0.000000 DAMAGE 46.200000

FCNPC_ONTAKEDAMAGE TICK 1177627262 HEALTH BEFORE 100.000000 DAMAGE 46.200000
FCNPC_ONTAKEDAMAGE TICK 1177627262 HEALTH BEFORE 53.799999 DAMAGE 46.200000
FCNPC_ONTAKEDAMAGE TICK 1177628041 HEALTH BEFORE 7.599998 DAMAGE 46.200000
FCNPC_ONTAKEDAMAGE TICK 1177628041 HEALTH BEFORE 0.000000 DAMAGE 46.200000

Only 2 shots killed the NPC, which is not what it should be.

EDIT: Don't compare the tickcount values across the 2 callbacks, only within 1 callback.

ziggi commented 6 years ago

Should be fixed in 83c054086c018496fd14c989d94581dd1816be6e