English Make NPC always know where player are.

4 replies
Goto Page
To the start Previous 1 Next To the start
Up
FishyFinThing
User
Offline Off
Hi everyone!

I'm currently experimenting on these NPC packs:
Starkkz's NPC Pack
2Gen's Extension for Starkkz's NPC Pack

However, I'm not very experience in deconstructing such complex scripts. Therefore, I may not be able to understand their scripts enough do what I want.

I'm thinking on letting NPC know all player's locations and going after players instead of them waiting for player to enter their vision range.

If anyone can help me know how, please let me know. Thank you!
file cs2d Fishy's Zombie Mod v0.2.0 Beta (Nov 27th 2019) (4) Join my server at "142.11.240.170". I hope you will have a good time. Please give some feedback.
21.01.20 09:09:00 am
Up
TrialAndError
User
Offline Off
There is a
npc_class:checkVisual(x, y)
function that is in server.lua, try to see where it's called and try commenting it out. There's also some 'viewdist' properties for the classes that you can try tweaking
21.01.20 11:20:34 am
Up
FishyFinThing
User
Offline Off
Thanks for your hint!

It seems I can make NPC with unlimited view distance now.

However, they can't see through wall. Is there a way to change that?
file cs2d Fishy's Zombie Mod v0.2.0 Beta (Nov 27th 2019) (4) Join my server at "142.11.240.170". I hope you will have a good time. Please give some feedback.
21.01.20 11:27:08 am
Up
TrialAndError
User
Offline Off
If I remember, there's a freeline function in there somewhere, try searching for 'freeline' and see where it's used. Freeline is just checking if the line between 2 points has a wall blocking or not.
edited 1×, last 21.01.20 12:25:04 pm
21.01.20 12:45:24 pm
Up
FishyFinThing
User
Offline Off
After disable some freeline() function it seems I almost there.

When see player, the NPC will remember and chasing player till the end. Unless I go to a room, hit the switch to close the room with a dynamic wall and break vision with NPC. Strangely enough, the dynamic wall isn't count as a vision block and the NPC can walk through it if they still see me through the dynamic wall. But it's ok, I don't mind that minor detail.

I think there is one problem left:
When the player spawn with a wall between him/her and the NPC, the NPC can't see even if they are within the same screen. This is strange because it happen even without freeline(). Is it because the NPC have no target registered on spawn?

PS: Never mind! If NPC can't see player through wall, I can just script it so that they will go to some random entities like spawn, teleport and bot node. Hopefully while doing so they will encounter players. Thanks @user TrialAndError: !
edited 1×, last 22.01.20 01:52:43 am
file cs2d Fishy's Zombie Mod v0.2.0 Beta (Nov 27th 2019) (4) Join my server at "142.11.240.170". I hope you will have a good time. Please give some feedback.
To the start Previous 1 Next To the start