-
Posts
610 -
Joined
-
Last visited
Content Type
Forums
Gallery
Downloads
Tutorials
News Stories
Wiki
Community Guidelines
LSPDFR BOLO Series
GTA5 Native Database
GTA5 Native Parameters
Release Highlights
LSPDFR Mod Showcase
LML User Contributions
Posts posted by LtFlash
-
-
Pawel,
one of the most troublesome and important aspect of scripting for GTA/LCPD:FR is to create chunks of code that will work in sequence. There were many techniques: switch...case + enum, bool flags, while loops but I managed to create probably the best solution which is to use a list of functions that might be switched on and off. Here are some resources:
https://github.com/LtFlash/LtFlash.Common/blob/master/LtFlash.Common/Processes/ProcessHost.cshttps://github.com/LtFlash/LtFlash.Common/blob/master/Examples/Processes/ProcessHost.cs
In your code it could be used like this:
public override void OnCalloutBegin() { proc.ActivateProcess(IsPlayerClose); } public override void Process() { proc.Process() } public void IsPlayerClose() { if(DistanceToPlayer < 200f) { //createblips proc.SwapStages(IsPlayerClose, HasPlayerClearTheArea); proc.ActivateStage(DisplayPlayerTaskOnScreen); } } private void DisplayPlayerTaskOnScreen() { //print msg "Eliminate enemies } private void HasPlayerClearTheArea() { if(AreEnemiesDead()) { //print msg End(); } } private bool AreEnemiesDead() { return (!Enemy1.Valid() || Enemy1.IsDead) && (!Enemy2.Valid() || Enemy2.IsDead); }
Here's some information on Action delegate behind that technique:
https://www.dotnetperls.com/action
Using that, I believe you can solve your problem quickly. -
https://github.com/LtFlash/LtFlash.Common/blob/master/LtFlash.Common/Serialization/Serializer.cs
First you would create a class to store data, then you use it to save/load values to/from a file using eg. 'public static void SaveToXML<T>(List<T> list, string filePath)' where T is your class.
-
I bet the crash is caused by something in your LSPDFRResolveEventHandler method. Put 2 log lines: one above the line where you subscribe that and one after and you'll see what happens.
-
-
What kind of problem do you have with this code? The style can definitely be better but there's no obvious bug. You could use an array/dictionary to store vectors and LINQ to check the condition so your code would look like this:
CalloutLocation = locations.All(l => DistanceToPlayer(l) > distToBackRoad) ? YouToolBackRoad : YouToolLot;
-
-
It is possible and not complicated at all if you familiarize yourself with files hierarchy. Try to analyze StagesData.xml of any case and follow IDs of entites to their config files, eg. SuspectsData.xml, VictimsData.xml, DialogsData.xml and so on. Every piece of information that form a case is located in those files. 20-30 minutes of learning and I'm sure you'll be an expert in creating cases. We are checking the forum regularly so feel free to ask questions. You might also contact us via our Discord server.
We'll probably push an update with some cosmetic changes to file formats, so have in mind you'll have to adapt your new case when this happens.
Fiskey is working on dedicated tools for creating cases but the release date is unknown due to how busy we are in real life.
-
Update
in Discussion
The current version has huge unused potential but the coding scene is pretty much dead. I'm still working on The Wasteland and it's refreshed version will be eventually released but that would be it in terms of active development for LCPD:FR. Despite of the available know-how we didn't have back in the days, no one seems to be interested in creating scripting mods nowadays. I just realized IV was released TEN years and nine days ago...
-
-
-
You got to use VS 2012, LCPD:FR obfuscation causes all the newer VS editions to crash. I contacted LMS about this long time ago but LCPD:FR is no longer in development and we can't expect any updates that would fix the problem.
-
You can check here how to create a dialog class to reuse it in different calls:
https://github.com/LtFlash/LtFlash.Common/blob/master/LtFlash.Common/EvidenceLibrary/Dialog.cs -
You can pick txt as an output format to easily paste your coords to your code.
- techgamer15, Cyan and JackNorris
-
3
-
You can start a new fiber with an infinite loop in the entry method like that:
void Main() { var fiber = GameFiber.StartNew(Process); } void Process() { while(true) { //your code GameFiber.Yield(); } }
That's only a general idea ofc. You can do whatever you want: a custom callout subsystem, world events, GUI. There are no limitations.
-
-
For some reason entity.GetAttachedBlip() returns null ref. You should store your blip in a variable: Blip policeBlip = new Blip(police); and refer in your code to that variable.
-
-
No, we slowed down significantly since both of us started regular jobs but expect a surprise in the next couple of days.
-
Okay, let's try to not to over-complicate it.
1) Extension methods:
create a separate static class and put your extension methods inside:
public static class MyExtensions { public static bool Valid(this LPed ped) { return ped != null && ped.Exists(); } }
then you can use Valid() on all LPeds like this:
LPed myPed = new LPed(...); if(myPed.Valid()) { //do something }
2) You need to understand classes to break your plugin into more comprehensible parts. For now I'd say keep it as it is and get some theory on classes.
3) You are not checking if the result of GetClosestVehicle() is a valid entity. It should be like this:
private bool GetEnforcerArmoryState() { Vehicle v = World.GetClosestVehicle(lcpdfrPlayer.Ped.Position, 3f); if(v != null && v.Exists()) { LVehicle closestVehicle = LVehicle.FromGTAVehicle(v); return closestVehicle != null && closestVehicle.Exists() && closestVehicle.Model.ModelInfo.Hash == Enforcer; } else return false; }
-
You use an existence check with an improper condition: "entity != null || entity.Exists()" means that it is enough for an entity to be not null. It should look like this: "entity != null && entity.Exists()". I recommend to add to your project an extension methods for all entities so you can make your life easier.
public static bool Valid(this LPed ped) { return ped != null && ped.Exists(); } public static bool Valid(this LVehicle veh) { return veh != null && veh.Exists(); } public static bool Valid(this GTA.@base.Object obj) { return obj != null && obj.Exists(); }
If you are not aware of what extension methods are and how to implement them, google will help you.
One more thing, you should consider breaking your class into smaller (eg. you could create a dedicated class for a squad). 2k lines is too much to comprehend.
-
A functional version is already available for our beta testers (https://www.fiskey111mods.com/). In the last month we caught some delay caused by quite serious real life changes but yesterday we decided about a deadline, I won't reveal specifics but I can assure you I'm determined to release the mod ASAP.
-
-
I really like you crafted an algorithm and managed to solve this by yourself, great job!
-
try..catch? Not string.Split(...)?
https://msdn.microsoft.com/pl-pl/library/tabh47cf(v=vs.110).aspx




Callout spawn location
in API Development
Posted · Edited by LtFlash
You can create a zone, collect coords of vertexes + center (might also be calculated) and get random position within that zone.
https://gtagmodding.com/maps/gta5/
https://math.stackexchange.com/questions/190111/how-to-check-if-a-point-is-inside-a-rectangle