[Update 1.0 - 2015.03.13] Emergency Lights CLEO script by nyolc8

Started by nyolc8, February 08, 2015, 13:59

BeastyBill88

Oh doesn't it? That's strange I don't remember turning off embedding. I'll have a look. Well v0.9.5 didn't work in SP it would crash on the loading bar :( I'll try this one in SP and if not I'll change the description lol.

Ah yes! That will be something I need lol I just set the strobes on the front of the vehicle to both.

Do you think there would be a way to have the lights work like the ImVehFt mod so the lights running on multiple vehicles at once?

EDIT 1: Video should work on the embedded player now.
EDIT 2: Just tried the mod in SP and it definitely doesn't work, it crashes on the loading screen both on a new game & a loaded game. Also tried it with just the emergency script (and needed files) in the cleo folder and it still crashed :( oh well.

nyolc8

The only thing which comes into my mind is basically a script which "clones" itself in the memory and each cloned script is for one vehicle. So each vehicle which have emergency light enabled, would have it's own script running. So I mean there would be only one cs file, but that script could clone itself for all vehicle which have enabled lights. But even this is so hard to make... The problem with this, I have no idea how to control (furthermore how to identify) the cloned scripts... so how to find out which script I want to control... But sometime I'll make a test script to see if I can make it or not.

BeastyBill88

Hmm it might work, only problem is having so many scripts would probably cause the game to lag massively or cause alot of bugs and memory issues.

The way I was thinking (but it probably won't ever work) would to have the mod show the all random patterns on another players vehicle if that person had the mod installed. BUT how would it be able to know if someone else has the EL mod :( that's the biggest problem I think.

nyolc8

yeah, samp does not sync any additional things (which is not stock game feature), so it's not possible to check which player have it, and also the same thing what I described in previous post. Each car requires it's own thread("clone" of script).

BeastyBill88

I thought so, which is a shame because that would be amazing for RP seeing a dozen cop cars all lit up behind you lol.

So cloning the script for each vehicle. It might work something like if there is another player in the copcarla you will see the lights working on that vehicle while they are driving it IF you have your lights turned on. Don't quote me on that. Its just how I think it could work lol, but like I've said before I haven't got a clue about scripting.

nyolc8

No, the problem is that the script has to select a vehicle (only one can be selected as target) and then apply the lightcoronas, shadows etc relative to that car position and attached to that selected vehicle. So this process (too) need to be run for each vehicle seperately. This can't be done in one thread.

nyolc8

Managed to make lights more like ELM/EVLS, so if the car model have parts for lights, then the script will read coordinates for lights from the model instead of vehicles.ini, also it will possible to make lighted textures for lights (into vehicle model dff), not just coronas. I only made strobe2 for now as testing, and it looks like it works nicely. :)

edit: all lights can work now like this (light texture, if car dff contains required parts)

R3public[PL]

Very hot!
Love you!
Will you relase version where other ppl will see your lights? (if they will have installed your mod)

nyolc8

Thanks!
Release a version? It's not even possible to do that. I'll happy if I can make some light appear for people who enabled the stock siren.

nyolc8

Some progress, figured out and managed to make a test script which starts a new thread(which draws a corona over the car) for every car in a close range. So "EL lights for other copcars which have siren enabled" is slowly getting possible. But I still have many problems what I don't know how to make... Also I think I'll need to make 2 threads for each car... ><

edit: the problem is that even only one light system uses so many variables that is not possible to make with local varibles (I can't use globals for a thread which cloned multiple times) ><

so I could make it, if there would be not only 31 local variable available...

here's an image, multiple car with siren light (not blinking for now):


BeastyBill88

Great progress! But wouldn't using the variables give you strange bugs like it did before? But anyway 1 step at a time :)

nyolc8

I can't use global variables at all, that's why I can't make it... :D Because 0 global variables, and only 31 local variables are simply not enough for each light coordinates, colors, sizes, shadows, etc... I'll try to use that "35@(31@,1i)" method, but last time when I tried, it didn't work properly.

BeastyBill88

Well at least you have tried though :D it would be cool to see the lights on other vehicles nearby. But I'm content with having it on my vehicle only. Plus I think have an extra script or 2 for each vehicle will add up... I mean I'm already on 21 scripts when I run SAMP and 17 of them are for the lights ;) haha.

nyolc8

I'll try to store all infos from .ini file into custom memory storage, then read them from that. (like I did with many variables in the EL script itself)

BeastyBill88

Well I'll let you work it out. As I don't really know lol.