Scripts / Wanted!!! - GTA Style Wanted System

Author
Message
PartTimeCoder
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location:
Posted: 16th Apr 2016 19:53
NOTICE: usage of this script will require some scripting of your own

So in the spirit of sharing I decided to slice a piece of functionality from my game and post it for the community, its a GTA style 5 star wanted system, I've made the script modular so it can just be dropped in and used

how it works, wanted points and level start at 0, call 'wanted_addpoints(value)' where value is the amount of points to add to the current level, the level threshold is set inside the script function 'wanted_load()' (read script notes)

when the current points meets the threshold for the current level the wanted level increases and resets points to zero until wanted level 5 is reached, after a 10 second delay after the last time 'wanted_addpoints' was called the points will start to go down by the amount set in 'g_wanted_ticker_subtract'

so typically, you would call 'wanted_addpoints' when the player commits a crime of some sort, shoots someone or steals something in view of people, for instance, place 'wanted_addpoints(50)' in the 'deathani' section of ai_soldier.lua, then whenever you shoot an enemy you will be wanted or gain wanted points, I have this setup with a custom civilian ai script but that broke with the last update so I cant share it just yet till I figure out whats going wrong

first of all, load the script


and a rather crude example, it simply adds 50 points to the current level when the player fires the gun and starts a small delay to prevent the script looping



and here's the nuts and bolts of the script



and attached full script, images and example

no video example sorry I ripped this out of my game so only a screenie

Attachments

Login to view attachments
PM
=VX=Doggy
15
Years of Service
User Offline
Joined: 29th Nov 2009
Location: USA NC
Posted: 17th Apr 2016 03:12
Nice idea, i'd like to see a working version of this script.
PM
0x7f
8
Years of Service
User Offline
Joined: 31st Mar 2016
Location:
Posted: 17th Apr 2016 16:58
finally someone here who keeps his code clean, nice one!
PM
PartTimeCoder
9
Years of Service
User Offline
Joined: 9th Mar 2015
Location:
Posted: 18th Apr 2016 15:37
lol, I'll take that as a complement

@VXD, you can use the example script in the zip, attach it to a dynamic object, place a start marker, give yourself a gun, when you fire points are added, when you stop after 10 seconds the points start to subtract

my game is broken at mo as I changed part of my core code and now need to adjust a few things in a lot of places (perils of changing your mind while in a half written system) once I've got everything communicating as it should again I'll post a video showing this and a few other scripts in action
PM
Teabone
Forum Support
18
Years of Service
User Offline
Joined: 8th Jun 2006
Location: Earth
Posted: 26th Apr 2016 18:04
This would also be good for even Medieval style games. Where as you gain infamy or bad karma.
Twitter - Teabone3 | Youtube - Teabone3 | Twitch - Teabone3

i7 -2600 CPU @ 3.40GHz - Windows 7 - 8GB RAM - Nivida GeForce GT 740

Login to post a reply

Server time is: 2024-12-22 17:55:13
Your offset time is: 2024-12-22 17:55:13