Everything posted by LtFlash
-
Native Checkpoint question
Here's a constructor of my Checkpoint class used in Transportation: public Checkpoint(Vector3 Position, float Radius, System.Drawing.Color Color) { _fRadius = Radius; _vPosition = Position; handle = Rage.Native.NativeFunction.CallByName<uint>( "CREATE_CHECKPOINT", 5, //5 is a type ID, check natives documentation @ http://www.dev-c.com/nativedb/ Position.X, Position.Y, Position.Z - 7.0f, Position.X, Position.Y, Position.Z, Radius, (int)Color.R, (int)Color.G, (int)Color.B, 100, 0); _bExists = true; }
-
Rage recordperformance
Heh, it always was a loop xD If not a loop it's a missing resource. Oh wait... Is is about a blip or a ped the blip is attached to? The error occurs in End() so I suppose you want to free resources, is that right? ainesophaur is completely right, try to create blip this way: Blip b = new Blip(ped); then remove it: if(b.Exists()) b.Delete(); in Wasteland I always checked if b != null && b.Exists(), it happened to be more reliable.
-
Suggestion: 'force' officers to return to car if losing chase?
Let's assume two situations: 1) a suspect is fleeing on foot -> one officer get out of the car, the 2nd stays in the car and try to cut the suspect off, 2) a suspect surrenders -> both get out of the car to back up the arresting officer, get back to their vehicle when the situation is code 4. I can imagine it'd be hard to protect peds on foot from being run over, that'd be my main concern.
-
Rage recordperformance
Wow, now it looks much better! I assume you are completely sure you call runthings() only once, not in some kind of loop, right? Using the functions I posted above, please check how much time takes this part: post the result of "Elapsed" property (it should look like this: "00:00:00.0003365").
-
Rage recordperformance
It looks like it shouldn't cause any performance issues. Does your mod influence your frame rate? What I can recommend is to use switch...case to code any sequential tasks, that's how Rockstar create missions. Here's an example from Wasteland: to enable >=2 states at the same you can use bit flags:
-
Rage recordperformance
5ms can be alot if there's not much code, in my "Transportation" the whole status-bar-drawing class takes ~1ms to get all needed data and draw bars on the screen. It's highly depended on your hardware how different operations influence the performance. You need to review the code, it might create new object(s) inside a loop which SIGNIFICANTLY slows your plugin down. You can post your main loop here so we can take a look and give you more detailed tips.
-
Small programming questions - API
@LMS I'll be thankful though it's not urgent.
-
Rage recordperformance
I use System.Diagnostics.Stopwatch to measure time of execution of specific parts = I profile problematic spots instead of checking the exec time of the plugin from A to Z. public static void LogPerformanceStart(string id) { if (!Transportation.Configuration.LOG_PERFORMANCE) return; if (_performance.ContainsKey(id)) { _performance[id].Restart(); } else { System.Diagnostics.Stopwatch s = System.Diagnostics.Stopwatch.StartNew(); _performance.Add(id, s); } } public static void LogPerformanceStop(string id, string description) { if (!Transportation.Configuration.LOG_PERFORMANCE) return; if (!_performance.ContainsKey(id)) return; _performance[id].Stop(); LogPerformance(description, _performance[id].Elapsed.ToString()); } I use it this way: LogPerformanceStart("mainLoop"); //loop code LogPerformanceStop("mainLoop", "[Main] Main loop exec time"); In terms of optimization: pay attention to not to create a new instance of a Stopwatch in every tick. It might slow your mod.
-
Small programming questions - API
Under a new project it shows me that... Metadata file '...\LCPD First Response.dll' could not be opened -- Invalid public key.
-
Small programming questions - API
@LMS How's it goin'? Have you checked the issue we were talking about?
-
Small programming questions - API
@phoenixpolice Here's a link to my post, I described the 1st step:
-
Small programming questions - API
@LMS I opened the previously working *.sln file in VS 2015, it does not recognize any identifier nor namespace (reference not found) from LCPD First Response.dll file (I re-downloaded the latest version ofc and included it into the project). When I open Object Browser I can browse all namespaces and content of ScriptHook.NET, SlimDX but LCPDFR seems empty, when trying to expand only the arrow changes from closed (>) to opened (_|) and nothing shows up. The file itself seems OK - I opened it in ILSpy and it shows the content properly. Solution platform is set to x86 and .NET to 4.5. I can download VS12 but that's 12 gigs of an installation folder just for 1 project.
-
Small programming questions - API
@LMS The new VS versions does not work with LCPD:FR library - shows no classes in dll. Is there any way to by-pass this or I got to download VS 2012?
-
Callouts Discussion
@phoenixpolice I'm glad it works as intended! It is so because the mod checks if ped/vehicle exists before any manipulation is done. There's more checks than actual behavior and scenarios code xD
-
Beat Cop - 80's Retro Pixel Game
FU%^ ME! The guys who make the game are from Poland! Gotta support them and pre-order.
-
Mafia III Announced
http://www.pcgamer.com/mafia-3s-driving-model-inspired-by-bullitt/ Wonder if it could be used to build a police mod, maybe the guys from RAGE team could create some hook xD
-
Callouts Discussion
I believe LCPD:FR callout modding is practically dead. I might be back and play with Wasteland a little bit more but that's nothing certain. GTA 4 has one problem which even for me is too much to bear: stability. I can't alt-tab to do changes in code and reload because I won't be able to alt-tab back to game - it crashes. It's extremely hard to code like that, especially because you need to do many things in tricky and indirect way because of native functionality limitations. It's also old, well known and has that dark atmosphere - not everyone likes that.
-
The Mind-Boggling Classic Cop Car Thread
@FCV96 Yep, this is the location where "Wolfen" was shot. What's interesting, that "burned down church" was a set for the movie, there was no actual church at that place. Here's an aerial which shows how it looked before the bomb... in 1951: http://nycma.lunaimaging.com/luna/servlet/detail/RECORDSPHOTOUNITARC~24~24~1602861~161940:am_1951_03?sort=identifier%2Cdate%2Cplace%2Ccreator&qvq=q:bronx;sort:identifier%2Cdate%2Cplace%2Ccreator;lc:RECORDSPHOTOUNITARC~24~24&mi=2&trs=354
-
How to make one ped pull another ped out of a vehicle
I wonder how it is done when one ped pull another one (usually it's the the player) out of his vehicle when angry. I'd check in decompiled scripts for some kind of ped behavior controller. Maybe there's a native which does not have a literal name yet.
-
Unit Testing
My "Transportation" mod has almost 130 *.cs files but I managed to debug it using RAGE logging system only because of a very intuitive architecture in core parts. In a problematic area I log info about specific stages being executed + current value of variables. I usually have more troubles with specific architecture decisions (they are as good for one reason as bad for another) than fixing bugs => pay close attention to a project of your plugin since it will influence how easy it'll be to maintain. I did not use any advanced techniques of debugging in my mods, as it was said it's impossible at this moment.
-
The Mind-Boggling Classic Cop Car Thread
4-2 PCT Volare, 170th and Charlotte in the Bronx, NYC, 1980:
-
Key Detection Problems
Great to hear it worked!
-
Key Detection Problems
Definitely, it should not happen but I don't see a reason why it is so. You can put the while(true) into new fiber like that: GameFiber.StartNew(delegate { while (true) { // GameFiber.Yield(); } } ); and see what happens.
-
Key Detection Problems
Try to insert "break;" after "toAcceptTimer.Enabled = false;" It will stop the while(true) loop so the control will return where it should be.
-
Retired Cop, want to make Callouts, but...
I think you should start from getting the basics of C#. The knowledge you need to have to write simple scripts is very limited, I'd recommend you to check these websites: http://www.tutorialspoint.com/csharp/csharp_program_structure.htm http://csharp.net-tutorials.com/basics/introduction/ for eg.: read The Basics and first 7 parts of Classes. To better understand the concepts you should write your own code while reading, there are great online compilers, eg. this: https://dotnetfiddle.net/ You should play with flow of control, while(true) (infinite loop), switch..case constructions alot because it's used to create plugins alot. When you feel comfortable with basics, I'd recommend to start reading API examples to decipher how a working solution is built, how peds are created, dismissed, how to work in an infinite loop, how to separate parts of code etc. To actually create mods you'll need Visual Studio 2015 or newer when it gets released. You can start playing with it from the beginning or use the online compiler - it's simpler. When you'll be ready for further instructions, post here.