AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Create functional NPC? (Boss-like, player-like) (https://forums.alliedmods.net/showthread.php?t=332479)

Desktop 05-14-2021 17:13

Create functional NPC? (Boss-like, player-like)
 
Hello, i've been searching information about NPCs here in alliedmods, but still haven't found anything useful to achieve what i really need to do.

The idea is the following one:
- Im trying to make a replica of players, that has a pattern to hide in places, attack other entities and simulates to be a player, but NOT A BOT.

My idea's heart is to create a gamemode that you can play being alone in the server, creating waves of attackers while you have to survive.

These attackers cannot be bots, because they consume an actual slot in the server, so.. they must be NPCs.

But.. that's a very complex task to achieve this, i've found some includes, even modules with API that can create NPCs very easily, but the physics are not even close to be fine..

Those are the issues i found with that:
1. When you set the npc to be offensive to players, they approach players but if the player is at a mountain, and the npc is in the floor, it will fly towards the player.
2. No animation controller.
3. No pathroute can be defined so they look like common enemies.

And some more, does anyone have any piece of code or idea that figures this out?

I would thank a lot (and obviously release the final code when achieved)!!

This is from @rogeraabbccdd: https://github.com/rogeraabbccdd/CSGO-Monster-API

tpr 05-17-2021 18:31

Re: Create functional NPC? (Boss-like, player-like)
 
Quote:

Originally Posted by Desktop (Post 2746835)
Hello, i've been searching information about NPCs here in alliedmods, but still haven't found anything useful to achieve what i really need to do.

The idea is the following one:
- Im trying to make a replica of players, that has a pattern to hide in places, attack other entities and simulates to be a player, but NOT A BOT.

My idea's heart is to create a gamemode that you can play being alone in the server, creating waves of attackers while you have to survive.

These attackers cannot be bots, because they consume an actual slot in the server, so.. they must be NPCs.

But.. that's a very complex task to achieve this, i've found some includes, even modules with API that can create NPCs very easily, but the physics are not even close to be fine..

Those are the issues i found with that:
1. When you set the npc to be offensive to players, they approach players but if the player is at a mountain, and the npc is in the floor, it will fly towards the player.
2. No animation controller.
3. No pathroute can be defined so they look like common enemies.

And some more, does anyone have any piece of code or idea that figures this out?

I would thank a lot (and obviously release the final code when achieved)!!

This is from @rogeraabbccdd: https://github.com/rogeraabbccdd/CSGO-Monster-API


Nice Idea.

I had this idea too .

I will give it a try for CsS.


For 1 : Maybe you can force NPCs to attack the players that are near to them and not too higher !?
for example not higher than 1 meter ?

Desktop 05-18-2021 00:39

Re: Create functional NPC? (Boss-like, player-like)
 
Found some info:

- Creating a "monster" with the code attached in the previous post isn't really performant as it updates OnGameFrame, so, high resource demand is a fact.
- Func_track_train is not fully working in CSGO.
- Maybe creating a timer to update the entity is needed to create smart-like behaviour.
- Animating isn't as easy as i thought, but i added another ELSE so i can change animation's playbackrate:

PHP Code:

else if (StrEqual(attribute"playbackrate")){
            
            
float speed StringToFloat(value);
            
SetVariantFloat(speed);
            
AcceptEntityInput(monster"SetPlaybackRate");
            
SetArrayCell(MonsterPlayBackRatemIndexspeed);
        } 

This will help to use "move_knife_w" animation and make it walk forward instead of backward.

Still haven't tried it all, nor studied it all, but, path_track isn't a reliable option it seems.

And TrainTrack plugin (category ANY) isn't properly working, just couldn't make any model to follow a path_track, it just disappears doing nothing.

andi67 05-18-2021 07:14

Re: Create functional NPC? (Boss-like, player-like)
 
Maybe you get some inspiration by following this:

https://forums.alliedmods.net/showth...unc_tracktrain

path_track, func_tracktrain working Well in CSGO...

Desktop 05-18-2021 16:30

Re: Create functional NPC? (Boss-like, player-like)
 
I tried to use that, Stugger's plugin is based on that and seems to work fine in the video he uploaded

https://forums.alliedmods.net/showthread.php?t=318751


Tried creating a path and a train with that plugin and the behaviour is strange, it creates the track, the cans appear, but when i start the train it just makes cans disappear, no model is shown there.
(Yeah, i have set a model before that)

Console:
Setting CBaseEntity to non-brush model models/props/cs_office/vending_machine.mdl
PrecacheScriptSound 'none' failed, no such sound script entry
Dynamic prop [U:1:108073217]_trainprop0: no sequence named:idle
func_track_train must be on a path of path_track

Video of what i got
https://youtu.be/_GIV9FHuS2Q

andi67 05-19-2021 15:20

Re: Create functional NPC? (Boss-like, player-like)
 
When I get home I could give you a working example....

andi67 05-20-2021 06:35

Re: Create functional NPC? (Boss-like, player-like)
 
1 Attachment(s)
So here is something I was working on for while but havenīt finished ....just upload all to your server and the material-/modelfiles to game- and fastdownloadserver..
Inside the sourcemod/sm_vec datafolder there is a generated navfile for de_lake , load the de_lake map than write in chat !test. A tank will spawn on the map in the near of the houses/rocks, to make it moving you need to go near the tank....

Desktop 05-21-2021 01:52

Re: Create functional NPC? (Boss-like, player-like)
 
Quote:

Originally Posted by andi67 (Post 2747335)
So here is something I was working on for while but havenīt finished ....just upload all to your server and the material-/modelfiles to game- and fastdownloadserver..
Inside the sourcemod/sm_vec datafolder there is a generated navfile for de_lake , load the de_lake map than write in chat !test. A tank will spawn on the map in the near of the houses/rocks, to make it moving you need to go near the tank....

Nice! im testing it, but i couldn't make it move, since i think the model cannot detect OnStartTouch, because i see it entirely black (no textures)

andi67 05-21-2021 02:46

Re: Create functional NPC? (Boss-like, player-like)
 
Well you can look at the code and see how path_tracks work...

Check ⁴if the files for the model are on Web and gameserver...sv_pure 0...


edit: added short video.

https://www.youtube.com/watch?v=pyRyy0Kwh3o


All times are GMT -4. The time now is 16:06.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.