Will the randomize script work with Textures.

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

User avatar
swado95
Rebel Warrant Officer
Rebel Warrant Officer
Posts: 304
Joined: Wed Apr 08, 2009 7:36 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Where I whant to be.

Will the randomize script work with Textures.

Post by swado95 »

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?
RogueKnight
Space Ranger
Posts: 2512
Joined: Sat Nov 22, 2008 1:50 pm
Projects :: Life. Work.
Games I'm Playing :: League of Legends
xbox live or psn: No gamertag set
Location: Washington, US

Re: Will the randomize script work with Textures.

Post 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.
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Will the randomize script work with Textures.

Post 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?
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Will the randomize script work with Textures.

Post 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.
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Will the randomize script work with Textures.

Post 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.
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Will the randomize script work with Textures.

Post 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?).
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Will the randomize script work with Textures.

Post 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
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Will the randomize script work with Textures.

Post 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
Maybe have a look at this script? i don't know much about scripting but i thought it looked helpful.
http://www.gametoast.com/forums/viewtop ... 4&start=20
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Will the randomize script work with Textures.

Post by kinetosimpetus »

it works now :D
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



skin = skin + 1

if (skin > maxskin) then
skin = 1
end

--ShowTimer(nil)
--DestroyTimer(timer)



SetTimerValue(skintimer , interval )
StartTimer(skintimer)


end,
skintimer
)

-------------------------------------------------------------------------
--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]
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Will the randomize script work with Textures.

Post by Teancum »

I'm confused - doesn't SetClassProperty() only work on newly spawned units? Or are you just randomizing at spawn?
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Will the randomize script work with Textures.

Post by kinetosimpetus »

Yes, that is what I'm doing.
New spawning units will take the changes. Currently deployed units will not.
User avatar
Teancum
Jedi Admin
Jedi Admin
Posts: 11080
Joined: Wed Sep 07, 2005 11:42 pm
Projects :: No Mod project currently.
Games I'm Playing :: Destiny
xbox live or psn: No gamertag set
Location: Indiana

Re: Will the randomize script work with Textures.

Post by Teancum »

Ah -- still it's a slick little script. Nice work :thumbs:
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Will the randomize script work with Textures.

Post 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! :thumbs:
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Will the randomize script work with Textures.

Post 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.
Blade117
Command Sergeant Major
Command Sergeant Major
Posts: 293
Joined: Thu Nov 26, 2009 9:10 pm
Projects :: No Mod project currently.
Location: location, location

Re: Will the randomize script work with Textures.

Post by Blade117 »

This is an intriguing concept.
CressAlbane
Master Bounty Hunter
Master Bounty Hunter
Posts: 1519
Joined: Fri Dec 18, 2009 8:02 am
Projects :: CTF Arenas
Games I'm Playing :: Steam- cressalbane2
Location: ¿uoıʇɐɔoן ʎɯ sıɥʇ sı

Re: Will the randomize script work with Textures.

Post by CressAlbane »

WOW THANKS!
I can think of many uses for this...
Randomized civilians, anyone?
User avatar
impspy
Captain
Captain
Posts: 493
Joined: Wed Dec 31, 2008 1:54 pm
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Pax Empiricae; check WIP

Re: Will the randomize script work with Textures.

Post 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:

Code: Select all

SetProperty("unit_name_here", "SkeltonName", "skeleton_name_here")
To both

Code: Select all

if (skin == x) then
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 :thumbs:
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Will the randomize script work with Textures.

Post by kinetosimpetus »

Hm, interesting. Good info impspy.
Lephenix

Re: Will the randomize script work with Textures.

Post by Lephenix »

This topic would be in the FAQ .
kinetosimpetus
Imperial Systems Expert
Imperial Systems Expert
Posts: 2381
Joined: Wed Mar 25, 2009 4:15 pm
Projects :: A secret project
Games I'm Playing :: Warframe STO

Re: Will the randomize script work with Textures.

Post 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.
Post Reply