I thinks its reps randomize script but im not sure. But anyways I was wondering if I could set it up so my guy has a different skin each time he spawns using the script. If this is possible how?
Re: Will the randomize script work with Textures.
Posted: Wed Mar 31, 2010 6:10 pm
by RogueKnight
swado95 wrote:I thinks its reps randomize script but im not sure. But anyways I was wondering if I could set it up so my guy has a different skin each time he spawns using the script. If this is possible how?
No, but you could load a different unit with a different skin every time.
Re: Will the randomize script work with Textures.
Posted: Thu Apr 01, 2010 1:25 am
by lucasfart
related to this, is it possible to have one unit selectable in the list, say a local of some sort, but upon spawning in, it randomly selects a skin/unit. I would only want it to show up once in the list, as one unit, but to have a random skin for each unit.....is this possible?
Re: Will the randomize script work with Textures.
Posted: Sat Apr 03, 2010 12:39 pm
by Fiodis
You can force spawn the player as a specific class, and you can have the LUA select this class at random. I'm not sure if it has to be a class in the SetupTeams section, or just one previously loaded in the LUA.
Re: Will the randomize script work with Textures.
Posted: Sat Apr 03, 2010 12:42 pm
by kinetosimpetus
SetClassProperty doesn't affect units already spawned right?
maybe make a loop that cycles through SetClassProperty calls so when someone spawns, they get different skins.
Re: Will the randomize script work with Textures.
Posted: Sun Apr 04, 2010 7:03 pm
by lucasfart
I get the general gist of what you're saying, kinetos, but i have no idea how to write that into the lua.
I'm guessing it goes something like this.
Checks if the player/ai is a certain unit. if they are, commence the function which randomly selects a skin(using override texture function?).
Re: Will the randomize script work with Textures.
Posted: Sun Apr 04, 2010 7:58 pm
by kinetosimpetus
I'm actually trying to get it to work right now, but a timer that loops overandover is supposed to check a counter variable, set the class property to the apporopriate model, increment the counter. if the counter gets too high, set it to the first one.
except im having trouble getting the counter to change
Re: Will the randomize script work with Textures.
Posted: Sun Apr 04, 2010 8:26 pm
by lucasfart
Good luck getting that to work Kinetos. It would be a great help if you could post it here when you find out...
kinetosimpetus wrote:I'm actually trying to get it to work right now, but a timer that loops overandover is supposed to check a counter variable, set the class property to the apporopriate model, increment the counter. if the counter gets too high, set it to the first one.
except im having trouble getting the counter to change
it works now
ok, here is the chunk of code, goes inside SciptPostLoad
interval is the number of seconds between model changes
maxskin is the number of versions to use
Hidden/Spoiler:
[code]
------------------------------------------------------------
--This is code for cycling rifleman models
------------------------------------------------------------
--KinetosImpetus
SetClassProperty("zahn_inf_rifleman", "GeometryName", "zahn_inf_engineer")
SetClassProperty("zahn_inf_rifleman", "GeometryLowRes", "zahn_inf_engineer_low1")
--this little part ^ was for debugging really, it isn't necessary
-- Timer for skins--
--interval is the number of seconds between model changes
--maxskin is the number of versions to use
interval = 10 --i had been testing this at 10 second waves, but it could be changed
--in MP, it will probably cause each 15 second spawn-wave to be the same model
skintimer = CreateTimer("timeout") -- i don't know what significance "timeout" has, copied from hoth campaign this way
SetTimerValue(skintimer , interval )
--ShowTimer(skintimer ) --uncomment this line to see the timer onscreen
skin = 1
maxskin = 2
OnTimerElapse(
function(timer)
if (skin == 1) then
SetClassProperty("zahn_inf_rifleman", "GeometryName", "zahn_inf_tantive4trooper")
SetClassProperty("zahn_inf_rifleman", "GeometryLowRes", "zahn_inf_tantive4trooper_low1")
end
if (skin == 2) then
SetClassProperty("zahn_inf_rifleman", "GeometryName", "zahn_inf_engineer")
SetClassProperty("zahn_inf_rifleman", "GeometryLowRes", "zahn_inf_engineer_low1")
end
-------------------------------------------------------------------------
--resume normal conquest script, or whatever gamemode...
--------------------------------------------------------------------------
StartTimer(skintimer) --starts the timer the first time, after it starts, it will restart itself one ending.
--------------wait start the timer first! ok, now go...
---------------------------------------------------------------------[/code]
Re: Will the randomize script work with Textures.
Posted: Sun Apr 04, 2010 9:23 pm
by Teancum
I'm confused - doesn't SetClassProperty() only work on newly spawned units? Or are you just randomizing at spawn?
Re: Will the randomize script work with Textures.
Posted: Sun Apr 04, 2010 9:26 pm
by kinetosimpetus
Yes, that is what I'm doing.
New spawning units will take the changes. Currently deployed units will not.
Re: Will the randomize script work with Textures.
Posted: Sun Apr 04, 2010 10:08 pm
by Teancum
Ah -- still it's a slick little script. Nice work
Re: Will the randomize script work with Textures.
Posted: Sun Apr 04, 2010 11:36 pm
by lucasfart
Awesome Kinetos! this is an extremely handy little script. Do you think this could be put in the FAQ? people should definitely use this...
Just to confirm a few parts of this, the max skin defines how many different skin numbers to choose from. Does interval have to be a full number, or can you make it 0.5 for example......
And to make this cycle skins, would you use something along these lines?
SetProperty("unit_name_here", "OverrideTexture", "skin_name_here")
Will that work? or would i need to reference a new model with the relevant texture every time?
apart from that, it looks pretty simple to understand.
Brilliant work Kinetos!
Re: Will the randomize script work with Textures.
Posted: Mon Apr 05, 2010 12:26 am
by kinetosimpetus
maxskin: yes this is the number of configurations to use, inside the if()then...end block goes 1 config, you can change one or many units within one block, with as many blocks as you want configs, the maxskin should equal the number of configs
interval: idk, try it.
override: yes, if the model supports it, the ovveride should work.
Dont change any weapon slots or gameplay properties, they may crash Mp, but geometry and addon mesh at least can be changed this way and work fine in mp.
Re: Will the randomize script work with Textures.
Posted: Mon Apr 05, 2010 6:31 pm
by Blade117
This is an intriguing concept.
Re: Will the randomize script work with Textures.
Posted: Thu Apr 08, 2010 6:58 am
by CressAlbane
WOW THANKS!
I can think of many uses for this...
Randomized civilians, anyone?
Re: Will the randomize script work with Textures.
Posted: Fri Apr 09, 2010 8:02 am
by impspy
Nice work Kinetos, I am so using this in Pax Empiricae.
However, I was unable to get "OverrideTexture" to work; every ten seconds the skin cycled, but it also affected the already spawned units. Also, units with non-stock skeletons did not work, even if I added:
functions; they always used the default human one.
Also, first person msh's cycled like "OverrideTexture".
I was however, able to successfully integrate the random models
Re: Will the randomize script work with Textures.
Posted: Fri Apr 09, 2010 10:07 am
by kinetosimpetus
Hm, interesting. Good info impspy.
Re: Will the randomize script work with Textures.
Posted: Fri Apr 09, 2010 11:14 am
by Lephenix
This topic would be in the FAQ .
Re: Will the randomize script work with Textures.
Posted: Sat Apr 10, 2010 12:03 am
by kinetosimpetus
Hm, I just played with this in MP, and it worked for the host, but had no effect on the clients.
The setclassproperty lines called in the timer did not get used by the client, so their sides didn't change, I'm not sure why, but I'm guessing the timer didn't work, the other setclassproperty's outside the timer seemed to work.