FAQFAQ    Board RulesBoard Rules    SearchSearch    LotteryLottery    RouletteRoulette    UsergroupsUsergroups
     RegisterRegister  ProfileProfile    Log in to check your private messagesLog in to check your private messages    Shop    Log inLog in 
View posts since last visit View your posts View unanswered posts

Somehow to make Police respond to NPC violations?(Mafia 1)

 
Post new topic   Reply to topic    Mafiascene.com Forum Index -> Ask a Modder - Modding
View previous topic :: View next topic  
Author Message
thekillergreece

New Member
New Member


Joined: 16 Dec 2015
Posts: 7

20 Bank Notes
Items

PostPosted: Fri Dec 18, 2015 8:37 pm    Post subject: Somehow to make Police respond to NPC violations?(Mafia 1) Reply with quote

Any how to do that?

They keep ignoring gangsters shooting at them.
Back to top
View user's profile Send private message
Muggy

Site Staff
Site Staff


Joined: 05 Jan 2005
Posts: 805
Location: Sydenham SE26
276214 Bank Notes
Items
more...

PostPosted: Sat Dec 19, 2015 12:16 am    Post subject: Somehow to make Police respond to NPC violations?(Mafia 1) Reply with quote

As a note on gameplay in Mafia:

The idea is that the police are in the pay of organized
crime in Lost Heaven. Even the normal driver NPC's
and citizens of LH are not touched by the law; only
the player can be fined, arrested or shot for violating
the laws.

Mind you it would be interesting to see if someone could
change how the police react for any violation whether by
the player (character), gangsters or anyone who causes
any infraction of the law.

Good luck in getting someone to do this, and welcome
to Mafia Scene btw.
_________________

Back to top
View user's profile Send private message Visit poster's website
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 116

263 Bank Notes
Items

PostPosted: Sat Dec 19, 2015 3:54 pm    Post subject: Somehow to make Police respond to NPC violations?(Mafia 1) Reply with quote

The script command policemanager_add allows NPCs to be added to the "watch list" so they're treated like the player. If I remember correctly, there were a few quirks though:

  • If a NPC gets a wanted level, the corresponding wanted icon is shown on screen just like as if it's the player who's wanted.
  • If a NPC gets arrested, the game ends.

By the way you can play around with the policemanager and wanted levels with MafiaCon.
Back to top
View user's profile Send private message
thekillergreece

New Member
New Member


Joined: 16 Dec 2015
Posts: 7

20 Bank Notes
Items

PostPosted: Sat Dec 19, 2015 7:45 pm    Post subject: Re: Somehow to make Police respond to NPC violations?(Mafia Reply with quote

ASM. wrote:
The script command policemanager_add allows NPCs to be added to the "watch list" so they're treated like the player. If I remember correctly, there were a few quirks though:

  • If a NPC gets a wanted level, the corresponding wanted icon is shown on screen just like as if it's the player who's wanted.
  • If a NPC gets arrested, the game ends.

By the way you can play around with the policemanager and wanted levels with MafiaCon.


Uh, odd, it says it's not found.
Back to top
View user's profile Send private message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 116

263 Bank Notes
Items

PostPosted: Sat Dec 19, 2015 11:17 pm    Post subject: Somehow to make Police respond to NPC violations?(Mafia 1) Reply with quote

thekillergreece wrote:

Uh, odd, it says it's not found.

The console command is pm_add. policemanager_add is the MafiaScript command.
Back to top
View user's profile Send private message
thekillergreece

New Member
New Member


Joined: 16 Dec 2015
Posts: 7

20 Bank Notes
Items

PostPosted: Sun Dec 20, 2015 7:24 am    Post subject: Re: Somehow to make Police respond to NPC violations?(Mafia Reply with quote

ASM. wrote:
thekillergreece wrote:

Uh, odd, it says it's not found.

The console command is pm_add. policemanager_add is the MafiaScript command.


Police ignores everyone, including the player. No reactions to NPC Shocked what I do?

NOTE: It also needs ID something.
Back to top
View user's profile Send private message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 116

263 Bank Notes
Items

PostPosted: Sun Dec 20, 2015 3:53 pm    Post subject: Somehow to make Police respond to NPC violations?(Mafia 1) Reply with quote

thekillergreece wrote:

Police ignores everyone, including the player. No reactions to NPC Shocked what I do?

What mission are you testing on? There're some missions where the policemanager is disabled.

Quote:

NOTE: It also needs ID something.

The id is necessary to identify the actor you'd like to add to the watch list. You can get a list of actors by executing
Code:

listobjects 27

For testing you could start one of the story missions where you have buddies. Use listobjects as described above to get their ids, add one of them to the watch list via pm_add, find a patrol car or police officer and run pm_setlevel <actor_id> 3 0 to set the actor's wanted level. Make sure he's in sight of the police at the time of execution of pm_setlevel. If everything went right, the police should now try to take down your buddy.

Note that pedestrians are handled differently by the game and don't appear in that list. The freeride gangsters for example won't be listed until they turn hostile.
Back to top
View user's profile Send private message
thekillergreece

New Member
New Member


Joined: 16 Dec 2015
Posts: 7

20 Bank Notes
Items

PostPosted: Sun Dec 20, 2015 4:50 pm    Post subject: Re: Somehow to make Police respond to NPC violations?(Mafia Reply with quote

ASM. wrote:
thekillergreece wrote:

Police ignores everyone, including the player. No reactions to NPC Shocked what I do?

What mission are you testing on? There're some missions where the policemanager is disabled.

Quote:

NOTE: It also needs ID something.

The id is necessary to identify the actor you'd like to add to the watch list. You can get a list of actors by executing
Code:

listobjects 27

For testing you could start one of the story missions where you have buddies. Use listobjects as described above to get their ids, add one of them to the watch list via pm_add, find a patrol car or police officer and run pm_setlevel <actor_id> 3 0 to set the actor's wanted level. Make sure he's in sight of the police at the time of execution of pm_setlevel. If everything went right, the police should now try to take down your buddy.

Note that pedestrians are handled differently by the game and don't appear in that list. The freeride gangsters for example won't be listed until they turn hostile.


Does it work on free ride mode though? And btw is there video tutorial? It kinda sounds complicated but I will try it, whats the ID of gangsters and normal civilians if one exists may I know?

EDIT: Does it really work? They keep being unresponsive towards to me and everyone else on freeride, can't get it to work on missions, too many objects and I have no clue which of 500 objects uses my actor. A tutorial video would be nice..
Back to top
View user's profile Send private message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 116

263 Bank Notes
Items

PostPosted: Mon Dec 21, 2015 8:37 pm    Post subject: Somehow to make Police respond to NPC violations?(Mafia 1) Reply with quote

thekillergreece wrote:

Does it work on free ride mode though?

Yes.

thekillergreece wrote:

And btw is there video tutorial?

I'm afraid not. I myself never made one and I don't think anyone else ever did since it's a rather obscure feature.

thekillergreece wrote:

whats the ID of gangsters and normal civilians if one exists may I know?

As I pointed out in my previous post civilians are not stored in the entity pool and as such they can't be accessed by MafiaCon. They're handled differently by the game compared to mission characters, possibly in order to reduce processing power/memory requirements. Freeride gangsters and police officers are merely peds and are converted to/replaced by fully-blown characters when turning hostile. Only then they're accessible via the entity pool.

thekillergreece wrote:

EDIT: Does it really work? They keep being unresponsive towards to me and everyone else on freeride, can't get it to work on missions

Yes, I'm fairly sure it works. Keep in mind that pm_add merely adds the character to the police watch list. It does not set the characters wanted level. In order to set the wanted level you either need to get the character to break the law (speeding, shooting, etc.) in sight of the police, or call pm_setlevel on that character.

thekillergreece wrote:

too many objects and I have no clue which of 500 objects uses my actor.

Sounds like you're invoking listobjects incorrectly. It accepts a type id as optional parameter and filters the list accordingly. The type id for characters is 27. Executing listobjects 27 in freeride should yield an empty list unless you're being chased by someone (cops, gangsters, angry civilians) or doing a taxi mission.

Let's try a different example maybe:

  1. Start freeride.
  2. Execute pm_delete -1. This removes the player from the police watch list.
  3. Execute setproperty -1 Health -1 in order to make the player invincible.
  4. Execute listobjects 27. This should yield an empty list.
  5. Attack a gangster. When he's shooting back, run listobjects 27 again. You should now see exactly one entry.
  6. Execute pm_add <entity_id> with <entity_id> being the id reported by listobjects. If the police is nearby, they should now respond to the shooting of the gangster and try to take him down. If there's no police nearby, you can spawn a patrol unit via pm_support <entity_id> 4 20 by passing the same entity id that you used for pm_add above. The last parameter denotes the distance to spawn the unit at, relative to the character.

Steps 2 and 3 are of course not necessary for the whole thing to work, but are recommended to avoid potential interference in this example.

I just tried that myself and it worked nicely. I do have to admit I was wrong regarding the wanted level icon though: There's no icon shown if a NPC is being wanted.

Note that the pm_* commands are really just toys for studying the policemanager and maybe for setting up a skirmish with the police. For any serious work you'll definitely want to write a script.
Back to top
View user's profile Send private message
thekillergreece

New Member
New Member


Joined: 16 Dec 2015
Posts: 7

20 Bank Notes
Items

PostPosted: Tue Dec 22, 2015 4:59 am    Post subject: Somehow to make Police respond to NPC violations?(Mafia 1) Reply with quote

Wow, this worked, you explained very nice and detailed! Thank you very much, I love you! No wonder why Illusion Softworks made the police unresponsive to NPC, maybe it would cause too many bugs. Cops seem way more stupid and dull when it comes gunfighting with gangsters, heh.

A few more questions:

Is it possible for gangsters to ignore me during gunfights and fight with police?

So overall, it is not possible to make NPC(Friendly) to be on watchlist of police?

EDIT: Seems like it also crashes the game sometimes. Is it also possible to make gangsters always on watch list without having to command it?
Back to top
View user's profile Send private message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 116

263 Bank Notes
Items

PostPosted: Wed Dec 23, 2015 2:53 am    Post subject: Somehow to make Police respond to NPC violations?(Mafia 1) Reply with quote

thekillergreece wrote:

Wow, this worked, you explained very nice and detailed! Thank you very much, I love you!

You're welcome. Smile

thekillergreece wrote:

No wonder why Illusion Softworks made the police unresponsive to NPC, maybe it would cause too many bugs. Cops seem way more stupid and dull when it comes gunfighting with gangsters, heh.

Yeah, police interaction with NPCs definitely needs some polish. As I said, when a NPC is fined/arrested, the usual fine/arrest cutscene is played and in case of arrests the game even ends. I do, however, think that shootouts with NPCs are 'ok' as-is and could have been added to the game. It's kinda weird how the police just ignores gun-blazing gangsters, but immediately goes after Tommy (and only Tommy) when he shoots back.

thekillergreece wrote:

Is it possible for gangsters to ignore me during gunfights and fight with police?

Sometimes gangsters stop shooting the player and attempt to take down the attacking officers. Once they're done with that they continue with the player. I guess it's possible to scratch the player from a gangster's attack list via a brain reset or something, but MafiaCon does not provide such functionality.

thekillergreece wrote:

So overall, it is not possible to make NPC(Friendly) to be on watchlist of police?

If you mean peds then no, I don't think so, but then I've never had a closer look at the pedestrian system to give a definite answer. My impression is that peds are just lite-NPCs that are cheap to (de)spawn but lack the required capabilities for more sophisticated interactions with the environment other than walking, fleeing/hiding and waving for taxis.

thekillergreece wrote:

Is it also possible to make gangsters always on watch list without having to command it?

That's potentially difficult, at least if you want to do it via MafiaScript. You'd need a way to query them so you get a handle you could pass to policemanager_add. Maybe someone more knowledgable in MafiaScript than me knows a way, though. Alternatively one could possibly write a hack like MafiaCon that hooks the entity creation function of the game and automatically adds all spawned NPCs to the list or something.
Back to top
View user's profile Send private message
thekillergreece

New Member
New Member


Joined: 16 Dec 2015
Posts: 7

20 Bank Notes
Items

PostPosted: Fri Dec 25, 2015 3:17 pm    Post subject: Somehow to make Police respond to NPC violations?(Mafia 1) Reply with quote

Thanks again. After some tests, I gotta conclude something, it seems like the game WILL crash if too many stuff happening, too many commands executed for police to watch, etc.

However, when I did pm_support onto gangster ID, the police kill them, I stay on same area, provoke gangster, add him on watch list, police do nothing, stays there idle.

I have noticed a major bug which could be the reason of removal Police reaction to NPC: When a gangster(s) get killed, cops get into their cruiser and stay idle permanently or will freeze themselves with guns removed, not walking if they are on foot.

Police cars sometimes drive by shoot at gangsters, foot offficers are more likely to shoot but roadblock police definitely shoots gangsters immediately on sight. I wish it was the opposite way.

Is there a mod to make a gangster invisible from any form of damages? Couldnt get a NPC to get fined, the only I could get is arrest and shootout.

Nice modding though.
Back to top
View user's profile Send private message
ASM.

Mafiascene Veteran Modder
Mafiascene Veteran Modder


Joined: 10 Jan 2014
Posts: 116

263 Bank Notes
Items

PostPosted: Mon Jan 04, 2016 5:18 pm    Post subject: Somehow to make Police respond to NPC violations?(Mafia 1) Reply with quote

thekillergreece wrote:

Thanks again. After some tests, I gotta conclude something, it seems like the game WILL crash if too many stuff happening, too many commands executed for police to watch, etc.

However, when I did pm_support onto gangster ID, the police kill them, I stay on same area, provoke gangster, add him on watch list, police do nothing, stays there idle.

I have noticed a major bug which could be the reason of removal Police reaction to NPC: When a gangster(s) get killed, cops get into their cruiser and stay idle permanently or will freeze themselves with guns removed, not walking if they are on foot.

Yeah, there're quite a few quirks present. It's of course quite possible that some of them are induced by MafiaCon. It more or less just calls the policemanager_* script commands but maybe it uses some of them incorrectly. However given the fact that everything works relatively smoothly when applied on the player suggests there're probably systemic issues in the police system as far as interaction with NPCs is concerned.

thekillergreece wrote:

Is there a mod to make a gangster invisible from any form of damages?

You could use setproperty <entity_id> Health -1.

thekillergreece wrote:

Couldnt get a NPC to get fined, the only I could get is arrest and shootout.

The problem with fining/arresting NPCs is that the AI often gets in the way as it continues to try to complete its goals while the fine/arrest sequence is played. It should work fine if you try it on an idling NPC. By the way, there's yet another quirk: The game doesn't reset the camera after the fining sequence.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Mafiascene.com Forum Index -> Ask a Modder - Modding All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group

Generation Time: 0.046 | Queries: 19