Jump to content

[SHOWCASE] GTA Style Npc Peds, Gangs, Cops and Mafia/Wanted Levels/Npc Drops


EnemyChad

Recommended Posts

52 minutes ago, TheLegend-EG said:

wow good job

Thanks!

 

10 minutes ago, Danex said:

no need to download link if this is a client :D rofl

There is simply not enough stuff to make this server-side without causing very noticable lag, and that's assuming you can replicate all the features.  It's a pipe dream and I highly doubt you'll be seeing that anytime soon without causing massive lag. Zombies and NPC HLC (really well made and well known server-side scripts) are the biggest example of this.

That being said, the peds will still respond to what other players do in your screen. The script's main purpose is to fill the space and make the world feel alive, not to roleplay with 300 other fake players.

Another reason I have no plans to even attempt server-side sync is that some players might want to change certain things such as reducing maximum ped count in a certain area, change their spawning radius, despawn radius, chase duration, panic distance, police chance and attitude, gang attitude etc. etc. which can give them a performance boost if their computer can't handle the script. The script is optimised from head to toe but after a point you will feel the performance impact of having so many peds on your screen with their own brains.

Edited by EnemyChad
Link to comment

Very cool, I played around with it on your server for a few minutes. It's nice to see an attempt being made at something like this since the only alternative, NPC HLC, is a real resource hog for servers even with the number of peds toned down. Do you have any plans to release it? I'd love to poke around the code.

Link to comment
11 hours ago, Lergen said:

Very cool, I played around with it on your server for a few minutes. It's nice to see an attempt being made at something like this since the only alternative, NPC HLC, is a real resource hog for servers even with the number of peds toned down. Do you have any plans to release it? I'd love to poke around the code.

Thank you. :) 

I originally made this only for my own project, but I will definitely release it when I feel like it's ready. It's perfectly playable at the moment with only a few minor bugs, but I still have some stuff I want to add. 

Link to comment
  • 1 year later...
On 30/06/2020 at 11:43, EnemyChad said:

 

Hello everyone. Before anything else, this script works client-side and it will not disrupt the server-side balance and it will NOT cause lag. It's a showcase, download is not available yet but there is a test server you can join.

 

Explanation:

This is a script we've been working on. It introduces peds all around the map with custom attitudes of their own. All killed peds will drop some amount of cash, and their weapon if they have one. When you alt tab, the "game" will pause like the single player. The bullets and the peds will freeze. When you alt-tab back on, everything will continue from the last second you left it on.

Peds: Peds will be minding their own business and they are not hostile unles provoked. They will react to world events such as someone walking past them, gunshots, explosions, vehicles near them and obstacles. They will put their hands up when threathened and start running or fight back. Some of them will defend when attacked,ome of them will run. Some of them will even defend others from trouble. A few of them have some custom behaviors but I won't spoil that. Most of them will be unarmed but some of them will carry weapons. They prefer melee weapons such as a bat or a knife, but there are some paranoid nutjobs who can't go outside without a gun. :)

Cops: If the police is near, commiting a crime will alert them and your wanted level will increase. As your wanted level goes up, more dangerous cops will start chasing you. You can stay away the police in order to reduce your wanted level, or find bail pickup I put around the map. All of them can be found in their original San Andreas locations, as well ass some I have added to suit the gamemode. That's not all though! If a ped kills another ped, the police will be agressive towards them instead. If a ped punches another, they will respond back. Some of them will defend their friends, some of them will bail etc.- This makes the world feel alive.

Military/Swat: They will be introduced when your wanted level is above 4 stars. They will carry more dangerous weapons such as Deagle, M4 and MP5. They will reward you with really good EXP when killed, but they are really challenging.

Gangs: In suitable ares, gang members will spawn as groups. They will all carry weapons and they will defend their group when one of them is attacked.

Mafia: The mafia will spawn in certain areas, mostly being San Fierro. They are not agressive unless provoked, and they are REALLY dangerous. They will grant good loot and experience if you have the balls to mess with them. ;) 

 

There are more features I couldn't show off because I don't want to make the video too long to sit through. Check the description in the video if you want to play-test the script. Have a good one!

 

Screenshots:

 

  Reveal hidden contents

rtcv4E0.png

TaxHJpG.png

D1Bnba9.pngbsvMXeb.png

FrMvNQl.png

SxVGNPO.png

OaPYDYW.jpg

i9XfIZ4.jpg

 

I don't want to tell you that but you can give me the resource or the server to have it on the pc to play with my friends when I don't have internet, also I'm not going to use it for online but for lan. Can you do me the favor?

 

Link to comment
8 hours ago, VARS_ea said:

I don't want to tell you that but you can give me the resource or the server to have it on the pc to play with my friends when I don't have internet, also I'm not going to use it for online but for lan. Can you do me the favor?

 

Unfortunately I can't give away the resource, but feel free to join my server with your friends and play the updated version. You might have a good time with added vehicle traffic and other players to help you out. It's called Forseti. Cheers.

Link to comment

This is amazing! It was because of lack of scripts like this that I created the traffic script. Except maybe that if peds aren't synced, I would still have created it. My logic was that MTA deserved to have traffic, and since no one was making it, I had to do it. It is heavy indeed, because it's not optimized well. But yours looks great, even if it's not synced. At least peds are much more interactive - something I had planned but didn't find time to do. I remember wondering why the hell no one makes use of peds in MTA. It was this kind of thing that I was looking for :)

Link to comment
On 11/09/2021 at 14:45, CrystalMV said:

This is amazing! It was because of lack of scripts like this that I created the traffic script. Except maybe that if peds aren't synced, I would still have created it. My logic was that MTA deserved to have traffic, and since no one was making it, I had to do it. It is heavy indeed, because it's not optimized well. But yours looks great, even if it's not synced. At least peds are much more interactive - something I had planned but didn't find time to do. I remember wondering why the hell no one makes use of peds in MTA. It was this kind of thing that I was looking for :)

@CrystalMV Yes it does, this is the power behind on your NPC HLC Traffic.

Big ❤️ for creating this legendary tool :).

 

  • Like 2
Link to comment
6 hours ago, Nurupo said:

@CrystalMV Yes it does, this is the power behind on your NPC HLC Traffic.

Big ❤️ for creating this legendary tool :).

This is great, I can't believe I missed it. And I never thought anyone would ever make that much use of it. But this topic is not exactly the right place for this, because this is where @EnemyChad demonstrates his NPC system, so posts that only focus on other systems are a bit out of place here.

Link to comment
52 minutes ago, CrystalMV said:

This is great, I can't believe I missed it. And I never thought anyone would ever make that much use of it. But this topic is not exactly the right place for this, because this is where @EnemyChad demonstrates his NPC system, so posts that only focus on other systems are a bit out of place here.

@CrystalMV

That's true, sorry for being overeact i just a bit excited to see the original author in here  ☺️ 

Edited by Nurupo
Link to comment
On 11/09/2021 at 14:45, CrystalMV said:

This is amazing! It was because of lack of scripts like this that I created the traffic script. Except maybe that if peds aren't synced, I would still have created it. My logic was that MTA deserved to have traffic, and since no one was making it, I had to do it. It is heavy indeed, because it's not optimized well. But yours looks great, even if it's not synced. At least peds are much more interactive - something I had planned but didn't find time to do. I remember wondering why the hell no one makes use of peds in MTA. It was this kind of thing that I was looking for :)

Thank you. :) I'm really surprised to see you here. Your scripts were definitely a big inspiration. They blew my mind when I first came across them. I don't think I'd have created this script without seeing yours first. I was really surprised more people weren't working with peds. Though my experience with them hasn't exactly been relaxing and I had to work around a lot of weird stuff I never even considered, so I can see why not many people wanted to go through the hassle, haha.

I always thought MTA needed some life in it. The video is quite old and I've done some major work since then. With server-side vehicle traffic and some major improvements and attitude diversity, I'm extremely happy with how it feels at the moment.

Here is a short video from when I first started working on traffic. I should really update these I guess.

 

 

Thanks again for the kind words. It means a lot coming from you. :) Feel free to pay a visit and play around with it.

Edited by EnemyChad
added video
  • Like 1
Link to comment

Wow guys, I'm very happy to know you appreciate my work! When I was making the traffic in 2012, even though I stayed around for quite a while afterwards and even made my own server, it was already MTA scripting sunset for me. I had no idea where my life was going, and since I still had barely made anything usable on MTA in general, I wanted to finally produce something that actually works. But I didn't know what would come of it. And I wouldn't have thought that after this many years, my scripts would still have such an impact. It seems like not only it didn't fade away with time, but to the contrary, over time more and more people see them, get inspired and make their own works that impress me.

It's a little hard to believe that this much time has passed, and I miss those days I scripted on MTA. Not making any actual plans yet, but maybe after the sunset the new day has to come :)

On 13/09/2021 at 00:28, EnemyChad said:

I was really surprised more people weren't working with peds. Though my experience with them hasn't exactly been relaxing and I had to work around a lot of weird stuff I never even considered, so I can see why not many people wanted to go through the hassle, haha.

Precisely what I used to think, though depends on what that "weird stuff" is. Some things may be unexpected and look very weird at first but totally understandable once you get to know them, like ped without syncer ending up in completely different positions for server and clients. Others, such as health or ammo not being preserved between stream out and stream in, look like bugs, although I don't know if that's still the case.

On 12/09/2021 at 23:16, Nurupo said:

@CrystalMV

That's true, sorry for being overeact i just a bit excited to see the original author in here  ☺️ 

I was a little worried we might hijack this topic if I start commenting about your videos without saying anything else, but now I feel as if I had done some backseat moderating or something like that, I don't know, maybe I'm just thinking too much 😆

  • Like 1
Link to comment
16 hours ago, CrystalMV said:

Precisely what I used to think, though depends on what that "weird stuff" is. Some things may be unexpected and look very weird at first but totally understandable once you get to know them, like ped without syncer ending up in completely different positions for server and clients. Others, such as health or ammo not being preserved between stream out and stream in, look like bugs, although I don't know if that's still the case.

My kind of "weird stuff" is mostly technical if that's the right word for it. My favorite example is probably weapon pickups. Something that should've been so easy.

I'm using createWeapon and attach to weaponise my peds. Turns out you can't disable collisions for them (not sure if that's still the case) which means when they are equipped with a weapon, you aren't able to shoot them. Their weapons will block your bullets. Not only that, but they will also attempt to jump over their own weapons since their collision is still there, resulting in extremely buggy behavior. I replaced weapon collision files with empty files in order to fix this. It worked, but there is now another problem. Empty .col files apparently make weapon pickups invisible. So I had to make my own client-side pickups, which is no big deal. The problem is I'm using a lot of weapon pickups on my server for deathmatch events and hidden weapons on the map. Eventually I had to make a very small collision file and use that one instead, which seems to solve the problem and it works perfectly fine. It's something very unassuming, but it was a headache. Had to deal with a lot of similar annoyances that I didn't expect. Some of them are pretty funny looking back. :) 

Other than that I'm quite content with its current state, and I think it's great at what it was intended to do. Which was something that can fill up the world and offer some life without littering other aspects. A good example is how peds will panic and start running when there is player conflict around them (including cops), and no new ones will spawn until pvp has stopped in that area. They are mostly absent when there is hostile player activity going on nearby. They are there to fill up the world and offer something when there isn't much player activity going on, so client-side peds are perfect for what I wanted this script to be. It saves a lot of headache. Traffic is synced and based on the traffic script that comes with mta, so that's a different story of course.

I'd like to improve path finding eventually and give peds a bit more freedom, but I think I'll pass on that since it might cause performance issues for low-end computers. I'd rather keep it accessible. Everyone seems happy with how it is at the moment. Currently the script optimizes itself depending on client performance by reducing ped count, adding delay between spawns, reducing despawn distance etc., maybe I could add some settings for players to play around with. All things considered I think I'm done with major updates to peds.

Anyway sorry for rambling. I'm just excited to talk about peds with someone who knows them and inspired me to make my own. Scripting for MTA is definitely nostalgic in a way. I always feel the urge to make something even if I know I'll never release, use or showcase it. No other game has that effect for some reason. I'm excited to see what you can come up with if you get back to scripting. It's fun to play around with stuff nobody else wanted to touch, haha.

  • Like 2
Link to comment
1 hour ago, EnemyChad said:

My kind of "weird stuff" is mostly technical if that's the right word for it. My favorite example is probably weapon pickups. Something that should've been so easy.

I'm using createWeapon and attach to weaponise my peds. Turns out you can't disable collisions for them (not sure if that's still the case) which means when they are equipped with a weapon, you aren't able to shoot them. Their weapons will block your bullets. Not only that, but they will also attempt to jump over their own weapons since their collision is still there, resulting in extremely buggy behavior. I replaced weapon collision files with empty files in order to fix this. It worked, but there is now another problem. Empty .col files apparently make weapon pickups invisible. So I had to make my own client-side pickups, which is no big deal. The problem is I'm using a lot of weapon pickups on my server for deathmatch events and hidden weapons on the map. Eventually I had to make a very small collision file and use that one instead, which seems to solve the problem and it works perfectly fine. It's something very unassuming, but it was a headache. Had to deal with a lot of similar annoyances that I didn't expect. Some of them are pretty funny looking back. :)

Oh, so that's what you've gone through. Workaround after workaround. Never tried custom weapons myself, but that's not the standard way to make peds shoot, so it's not really peds that you had a problem with, but rather a separate MTA feature that I've never seen being used anywhere else in GTA. But I guess you did it that way because you had issues getting them to shoot the standard way? I used to call setPedAimTarget and set the fire control state, and the peds would appear to shoot, the weapons would appear to fire, but the bullets sometimes wouldn't fly out. Turns out a NaN would appear somewhere in calculations in the game itself. But the problem would not occur at longer distances, so the workaround was simple: put the target thousands of units further in the same direction.

Drive-by was even more problematic, I called setPedDoingGangDriveby along with setPedAimTarget, and while peds did appear to shoot, I never managed to get their bullets to fly out reliably, plus they were visually aiming in the wrong direction.

And regarding info not being preserved between stream out and stream in: I create a ped. I give that ped a weapon using giveWeapon. Seems okay. Then I go further away and return back. The ped only has one bullet. If I try to make it shoot, it shoots one bullet and then continues the shooting animation but the weapon doesn't fire and no bullets appear. With no client-side giveWeapon, my workaround was to call it on the server side every couple seconds or so.

Many other properties were not preserved either. Health being one of them, but this didn't get in the way when I had my own server because I had a custom health system anyway.

I don't know how much the situation changed since then, I have been assuming things have improved, considering peds can enter/exit vehicles now.

2 hours ago, EnemyChad said:

Other than that I'm quite content with its current state, and I think it's great at what it was intended to do. Which was something that can fill up the world and offer some life without littering other aspects. A good example is how peds will panic and start running when there is player conflict around them (including cops), and no new ones will spawn until pvp has stopped in that area. They are mostly absent when there is hostile player activity going on nearby. They are there to fill up the world and offer something when there isn't much player activity going on, so client-side peds are perfect for what I wanted this script to be. It saves a lot of headache. Traffic is synced and based on the traffic script that comes with mta, so that's a different story of course.

I'd like to improve path finding eventually and give peds a bit more freedom, but I think I'll pass on that since it might cause performance issues for low-end computers. I'd rather keep it accessible. Everyone seems happy with how it is at the moment. Currently the script optimizes itself depending on client performance by reducing ped count, adding delay between spawns, reducing despawn distance etc., maybe I could add some settings for players to play around with. All things considered I think I'm done with major updates to peds.

It's surely interesting to know how it all works. I agree, the game world just doesn't feel that empty with peds around. And you did what I didn't find time to do. You made peds more interactive, which is why yours feel more alive. But I couldn't limit myself to client-side peds. I understand your reasons, but when I make peds for players to interact with, I want them to be synced, because that's one of the things I love about MTA: synced peds. And if actual server-side peds were still too heavy for my purposes, I would try implementing my own using client-side peds and triggerServerEvent/triggerClientEvent. But to each their own, sometimes I get a bit perfectionistic with things like these 😄

2 hours ago, EnemyChad said:

Anyway sorry for rambling. I'm just excited to talk about peds with someone who knows them and inspired me to make my own. Scripting for MTA is definitely nostalgic in a way. I always feel the urge to make something even if I know I'll never release, use or showcase it. No other game has that effect for some reason. I'm excited to see what you can come up with if you get back to scripting. It's fun to play around with stuff nobody else wanted to touch, haha.

I'm also happy to have someone to talk to about peds. When I was scripting mine, I felt alone. All I could see was people occasionally posting things like "is there a resource to have peds walking and driving everywhere?" People only wanting a traffic resource but not trying to make one themselves. It's not even that hard to make something basic that works.

I currently can't run MTA because of some hardware issues (should be simple to resolve, just haven't gotten myself to do it for a while), but that isn't my focus. I've become better at programming in the recent years and I've learned to make my code much more reusable. What I've been thinking is that I could try making something that runs on anything running Lua, with minimal additional code needed to bind it specifically to MTA API.

  • Like 2
Link to comment

 

7 hours ago, CrystalMV said:

But I guess you did it that way because you had issues getting them to shoot the standard way? I used to call setPedAimTarget and set the fire control state, and the peds would appear to shoot, the weapons would appear to fire, but the bullets sometimes wouldn't fly out. Turns out a NaN would appear somewhere in calculations in the game itself. But the problem would not occur at longer distances, so the workaround was simple: put the target thousands of units further in the same direction.

That was definitely a reason. Though I switched to createWeapon quite early so I didn't think much about it. It's also fun to be able to play around with weapon properties. They have a lot of custom attributes depending on ped type and random chance. I guess setPedAimTarget being a bit of a wreck was a blessing in disguise. :D

I never played around with server peds so I can't be certain, but I'd be surprised if most of the issues you mentioned hasn't been fixed.

 

7 hours ago, CrystalMV said:

But I couldn't limit myself to client-side peds. I understand your reasons, but when I make peds for players to interact with, I want them to be synced, because that's one of the things I love about MTA: synced peds. And if actual server-side peds were still too heavy for my purposes, I would try implementing my own using client-side peds and triggerServerEvent/triggerClientEvent. But to each their own, sometimes I get a bit perfectionistic with things like these 

Nothing wrong with being a perfectionist! I wanted to make a server of my own and launch it before it's too late, so I've been getting better at compromising and settling with a little less than what I'd consider to be perfect. Whether it's better or worse is up debate, haha.

 

7 hours ago, CrystalMV said:

What I've been thinking is that I could try making something that runs on anything running Lua, with minimal additional code needed to bind it specifically to MTA API.

Sounds interesting! I'd love to see what you might come up with. I appreciate the feedback as well. I might play around with synced peds sometime in the future. Best of luck with whatever you do next :)

  • Like 1
Link to comment
On 15/09/2021 at 22:56, EnemyChad said:

 

That was definitely a reason. Though I switched to createWeapon quite early so I didn't think much about it. It's also fun to be able to play around with weapon properties. They have a lot of custom attributes depending on ped type and random chance. I guess setPedAimTarget being a bit of a wreck was a blessing in disguise. :D

I never played around with server peds so I can't be certain, but I'd be surprised if most of the issues you mentioned hasn't been fixed.

 

Nothing wrong with being a perfectionist! I wanted to make a server of my own and launch it before it's too late, so I've been getting better at compromising and settling with a little less than what I'd consider to be perfect. Whether it's better or worse is up debate, haha.

 

Sounds interesting! I'd love to see what you might come up with. I appreciate the feedback as well. I might play around with synced peds sometime in the future. Best of luck with whatever you do next :)

mmm... come on. It was only if you can pass your resources to me because one day I will not be able to play on network lines, that is why I wanted that to play on lan. but if you can't pass me, it doesn't matter, it's not that it's an obligation and thanks to the invitation from your server, I'll think about it.

Link to comment
On 16/09/2021 at 05:56, EnemyChad said:

That was definitely a reason. Though I switched to createWeapon quite early so I didn't think much about it. It's also fun to be able to play around with weapon properties. They have a lot of custom attributes depending on ped type and random chance. I guess setPedAimTarget being a bit of a wreck was a blessing in disguise. :D

Yeah, I guess even if creating a custom weapon and attaching it is kind of a workaround, it comes in handy. I see there's accuracy among properties - if they can shoot in a different direction than they're pointing at, then it's one of the things setPedAimTarget can't do. When I wanted to simulate imperfect accuracy using setPedAimTarget, I did it using math.sin with time as parameter. Everything looked okay until I looked at the ped from up close and realized that it's very noticeable how it waves the weapon around :D

Your approach reminds me of back when peds couldn't enter/exit vehicles apart from warping instantly (that's a recent addition, right?), and I was thinking of reimplementing vehicle enter/exit animations using attached elements, ped animations and vehicle door rotation. Didn't go anywhere with it though.

Had I done that, it would have helped me with train system that I was thinking of doing. I wanted to define my own train tracks, and in order to do this, I had to set the train as derailed and control its position from the script. But you can't enter the derailed train, and making my own vehicle enter/exit system would have solved this problem. I once did the "define my own tracks" thing for the tram by the way (wanted to use both tram tracks in SF), but later I lost the script, though it looks pretty easy to make now that I think about it.

It gets in the way when we have to resort to workarounds, especially when it's due to bugs like that one I had with setPedAimTarget, and yet, the very fact that we can implement those workarounds to begin with, just shows how powerful MTA is.

On 16/09/2021 at 05:56, EnemyChad said:

I never played around with server peds so I can't be certain, but I'd be surprised if most of the issues you mentioned hasn't been fixed.

I don't think that's specific to server peds, although I never checked this. Element streaming is a client-side thing, element disappears from GTA when you get further, but MTA client still remembers it. It just seemed not to remember things like stats, health and ammo. So unless this has been fixed, your peds might also be susceptible. It would be harder to notice on your peds since they're centered around the local player, plus if shooting is implemented using custom weapons, you can't observe the same bug with ammo.

On 16/09/2021 at 05:56, EnemyChad said:

Nothing wrong with being a perfectionist! I wanted to make a server of my own and launch it before it's too late, so I've been getting better at compromising and settling with a little less than what I'd consider to be perfect. Whether it's better or worse is up debate, haha.

Being pragmatic can get things done here and now, but perfectionism has its benefits in the long term. When I was making my traffic and my server, I was also being somewhat pragmatic. On the other hand, there have been many moments when I tried to code something but couldn't think of a good approach, data structures and stuff. And it felt like my perfectionism was holding me back. However, now I realize it wasn't for nothing. Far from it. I was just looking for something, and it was that "something" that made me much better at coding.

On 16/09/2021 at 05:56, EnemyChad said:

Sounds interesting! I'd love to see what you might come up with. I appreciate the feedback as well. I might play around with synced peds sometime in the future. Best of luck with whatever you do next :)

Glad to know it's interesting to you. But because I have lots of things to do, I don't want to get your hopes up too high - no idea when I'm going to make something. Anyway, I can say the same to you, good luck to you too :)

Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...