11.07.2012, 09:47
(
Последний раз редактировалось Mauzen; 31.07.2013 в 18:19.
Причина: Link moved to new domain
)
This is a script i developed for testing and tutorial purposes.
Basically its a ai script for police officers. You can create police npcs and assign them a set of waypoints, where they are walking continuosly. If a player near a police officer fires a weapon, the officer chases him, and fires at him if he is close enough. If the player dies, or runs too far away, the officer stops chasing him and continues his waypoint route.
The script contains quite a lot comments, especially in the RNPC relevant part, and is even easily extensible if you want the npcs to do more (like a third range level where the player is arrested, other conditions that start the chase, or whatever).
The script of course needs the RNPC plugin.
Then include the file, and create a police officer like this, all the rest is done automatically. Values like the attack or vision range can be modified through the defines at the beginning. See the include code for other provided functions, like removing the npcs.
Dont just copy&paste that code to OnGameModeInit() or main(), this wont work due to RNPC limitations. Instead execute this code delayed, with a timer or a command.
So heres the link to the script
And heres a short video showing an RNPC officer in action:
[ame]http://www.youtube.com/watch?v=mM4xCOvavZQ[/ame]
Hope this helps some guys, either in understanding RNPC, AI scripts in general, or with the offered police services itself
Basically its a ai script for police officers. You can create police npcs and assign them a set of waypoints, where they are walking continuosly. If a player near a police officer fires a weapon, the officer chases him, and fires at him if he is close enough. If the player dies, or runs too far away, the officer stops chasing him and continues his waypoint route.
The script contains quite a lot comments, especially in the RNPC relevant part, and is even easily extensible if you want the npcs to do more (like a third range level where the player is arrested, other conditions that start the chase, or whatever).
The script of course needs the RNPC plugin.
Then include the file, and create a police officer like this, all the rest is done automatically. Values like the attack or vision range can be modified through the defines at the beginning. See the include code for other provided functions, like removing the npcs.
pawn Код:
new rp = CreateRNPCPolice("Officerino", 280);
AddRPOLWaypoint(rp, 2029.42, 1354.34, 10.5);
AddRPOLWaypoint(rp, 2033.55, 1286.21, 10.5);
AddRPOLWaypoint(rp, 2079.03, 1286.00, 10.5);
AddRPOLWaypoint(rp, 2079.02, 1362.08, 10.5);
StartRPOLRoute(rp);
So heres the link to the script
And heres a short video showing an RNPC officer in action:
[ame]http://www.youtube.com/watch?v=mM4xCOvavZQ[/ame]
Hope this helps some guys, either in understanding RNPC, AI scripts in general, or with the offered police services itself