Sphereserver / Source

http://spherecommunity.net
Apache License 2.0
108 stars 58 forks source link

ADDNPC overlap infinitely #228

Closed Khaldor48 closed 4 years ago

Khaldor48 commented 4 years ago

Hello again,

when I'm on linux build and .addnpc 038 (which is skeleton) or 037 which is troll and target any place. It will add infinite amount of these monsters on same place and sphere immediately freezes and this causing memory leaks and also removing items & chars from save.

I've tested on latest Windows build (with same files and settings) and it works normally. Just adds 1 monster

coruja747 commented 4 years ago

addnpc is a function softcoded on sphere_backward_compatibility.scp, try copy/paste your function here to check if there's something wrong

Khaldor48 commented 4 years ago

Hello, Happy New Year :-)

[FUNCTION addnpc]
ARGS=<QVAL (<isnum <ARGS>>)? <ARGS>|08c000000 : <DEF.<ARGS>>>
IF (<SERV.CHARDEF.<dARGS>>)
 ADD <ARGS>
 return 1
ENDIF
SYSMESSAGE <DEFMSG.cmd_invalid>

This is the function.. it's the same as in freshly downloaded script pack.

If I add the same NPC with .add c_skeleton_w_axe -> it works fine, but when I do this via addnpc command (.addnpc 038) it starts to add infinite amount of these skeletons causing memory leaks and corrupting save files :)...

When I use .addnpc 038 on latest Windows Build it works fine..

I wish I was more helpful with definition of issue. Hope you'll make it :)

coruja747 commented 4 years ago

Hey happy new year too 😄 After some quick testing I found that the problem is on hardcoded ADD function and not on softcoded ADDNPC. But I already fixed it on latest build, so just update to latest build and it will work fine

Fixed https://github.com/Sphereserver/Source/commit/b823a536d01de8693992b5d25d366f65e08376aa

Khaldor48 commented 4 years ago

Thank you very much!