Hello.
I was wondering how to make a script (graphics function, perhaps?) that would assign a random colour to each particle of some element, out of a specified set.
I've searched the forum, but I wasn't able to find something like this exactly.
I also looked at the source for QRTZ/PQRT, and found out it's somehow dependent on the TMP2 value. This would be the effect I'm looking for, making the colour brighter or darker for each particle in a random way.
Could this be achieved through Lua scripting?
Check out TRON. Maybe that will help you. It's also dependent on TMP but well, you know.
I'm not sure if this helps in any way but I was just messing around and did this:
local function glow(i, colr, colg, colb)
a = math.random(1,255)
b = math.random(1,255)
c = math.random(1,255)
d = math.random(1,255)
e = math.random(1,255)
f = math.random(1,255)
g = math.random(1,255)
h = math.random(1,255)
return 1,0x00000001,a,b,c,d,e,f,g,h
end
tpt.graphics_func(glow,elements.DEFAULT_PT_IRON)
While the effect is nice, would it be possible to make the set colour constant to the particle? Like it is with QRTZ, there is a random colour assigned, which persists and doesn't change for the given particle.
I really have no clue... I'll mess around with it and see if i figure it out
You'd have to change it in the constructor for the particle... I think.
I don't know if it works.
Well, I guess I'm gonna have to leave it for now and get back to it if I would ever be making a source-based mod.
No need to trouble yourself, I was just wondering if there was an easy way of achieving this through Lua, but it appears there isn't.
Yes, this is exactly the effect I want, but I'd like it to be native to the element itself, and not be a decor layer or option switched on by the user.
Thanks for the help, anyways.
Does anyone here have a sample of the code used in TRON? Because every time you make a particle of it, it would randomly generate its own color (TMP-based). Is that what you want?
Maybe if you want it to look less weird in debug mode, it should be using TMP2 instead so that people who always like to have it turned on don't get bothered by that huge random number sitting in the TMP variable.
And modifications so that it also covers the colors you usually don't find in TRON?
TRON is so neglected.