Random Units all properties [will be solved in other topic]

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

Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Random Units all properties [will be solved in other topic]

Post by Deviss »

hi there to all :) , i was using random units for change model only, but is possible change all property (change directly all of rep_inf_ep3_rifleman.odf properties to rep_inf_ep3_rocketeer.odf properties)
here is my chunk from lua, this only change model:
Hidden/Spoiler:
------------------------------------------------------------
--This is code for cycling rifleman models
------------------------------------------------------------
--KinetosImpetus

SetClassProperty("rep_327th_clon1", "GeometryName", "rep_inf_187th_Trooper")
SetClassProperty("rep_327th_clon1", "GeometryLowRes", "rep_inf_187th_Trooper_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 = 3 --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("rep_327th_clon1", "GeometryName", "rep_inf_327th_trooper_A")
SetClassProperty("rep_327th_clon1", "GeometryLowRes", "rep_inf_327th_trooper_A_low1")
end
if (skin == 2) then
SetClassProperty("rep_327th_clon1", "GeometryName", "rep_inf_187th_Trooper")
SetClassProperty("rep_327th_clon1", "GeometryLowRes", "rep_inf_187th_Trooper_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...
---------------------------------------------------------------------
i would like make this: (but this crash xD)
Hidden/Spoiler:
------------------------------------------------------------
--This is code for cycling rifleman models
------------------------------------------------------------
--KinetosImpetus

SetClassProperty("rep_inf_ep3_rocketeer")
--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 = 3 --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("rep_inf_ep3_rifleman")
end
if (skin == 2) then
SetClassProperty("rep_inf_ep3_rocketeer")
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...
---------------------------------------------------------------------
help please :D
Last edited by Deviss on Mon Sep 20, 2010 3:41 pm, edited 1 time in total.
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: Random Units but all properties

Post by skelltor »

What if instead of changing its model propertie you have it use rep_inf_default_rocketeer or whatever the rocketeers class parents name is.
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: Random Units but all properties

Post by Deviss »

skelltor wrote:What if instead of changing its model propertie you have it use rep_inf_default_rocketeer or whatever the rocketeers class parents name is.
you mean make this ???
Hidden/Spoiler:
------------------------------------------------------------
--This is code for cycling rifleman models
------------------------------------------------------------
--KinetosImpetus

SetClassProperty("rep_inf_ep3_rifleman", "ClassParent", "rep_inf_default_rocketeer")
--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 = 3 --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("rep_inf_ep3_rifleman", "ClassParent", "rep_inf_default_rifleman")
end
if (skin == 2) then
SetClassProperty("rep_inf_ep3_rifleman", "ClassParent", "rep_inf_default_rocketeer")
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...
---------------------------------------------------------------------
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: Random Units but all properties

Post by skelltor »

yea
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: Random Units but all properties

Post by Deviss »

dont work :S here is my new lua chunk:
Hidden/Spoiler:
------------------------------------------------------------
--This is code for cycling rifleman models
------------------------------------------------------------
--KinetosImpetus

SetClassProperty("rep_327th_clon1", "ClassParent", "rep_inf_default_187th_clon1")
--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 = 3 --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("rep_327th_clon1", "ClassParent", "rep_inf_default_327th_clon1")
end
if (skin == 2) then
SetClassProperty("rep_327th_clon1", "ClassParent", "rep_inf_default_187th_clon1")
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...
---------------------------------------------------------------------
i saw i am not changin class properties, i am trying change gameobjectclass now maybe for this reason? if yes, how i change setclassproperty to one work with gameobjectclass??
Hidden/Spoiler:
[GameObjectClass]
ClassParent = "rep_inf_default_327th_clon1"

[Properties]
EDIT: i found problem :
[GameObjectClass]
ClassParent = "rep_inf_default_rifleman"

[Properties]
GeometryName = "rep_inf_ep3trooper"
GeometryLowRes = "rep_inf_ep3trooper_low1"
FirstPerson = "REP\reptroop;rep_1st_trooper"


blue chunk use the line SetClassproperty, but i need modify yellow chunk, i tried putting in lua SetProperty, SetObjectClass, SetGameObjectClass but dont work :S i believe only Zerted know how :S
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: Random Units but all properties

Post by lucasfart »

You don't need to modify the yellow part to change the mesh thats used. All that line is is where all the stats for the unit are gathered, unless they are overwritten by the lua you're in. What you need to change is the GeometryName. Kinetos script should work fine.
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: Random Units but all properties

Post by skelltor »

no he wants to change the parent odf and the model not just the model.
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: Random Units but all properties

Post by Deviss »

skelltor wrote:no he wants to change the parent odf and the model not just the model.
exactly :D , i want change the yellow chunk part
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: Random Units but all properties

Post by Teancum »

I don't think you can do that. You have to use SetProperty() to change the weapons and health as well.

This is an interesting idea. I think I might use it to give rebel soldiers random "faces" (models) so not every rebel looks the same.
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: Random Units but all properties

Post by Deviss »

Teancum wrote:I don't think you can do that. You have to use SetProperty() to change the weapons and health as well.

This is an interesting idea. I think I might use it to give rebel soldiers random "faces" (models) so not every rebel looks the same.
i know, i can change weapons model etc, but chainging Class i can change whole thing (directly ODF) :) , and yeah indianajoe made random faces for his mod :P
User avatar
skelltor
Sith
Sith
Posts: 1431
Joined: Fri Dec 11, 2009 6:24 pm
Projects :: BFSM
Games I'm Playing :: SWBFII
xbox live or psn: skelltor95
Location: minisnowta
Contact:

Re: Random Units but all properties

Post by skelltor »

You coulde set the class properties one by one it woulde take a lot more space in your lua up but woulde work i think....
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Random Units but all properties

Post by Maveritchell »

Teancum wrote:This is an interesting idea. I think I might use it to give rebel soldiers random "faces" (models) so not every rebel looks the same.
That's a huge waste of space for a relatively minor change. Models and textures are the big space-wasters, and the more changes you make for purely aesthetic reasons, the bigger your bloat.
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: Random Units but all properties

Post by Deviss »

any suggestion for my problem, mav :D ?
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Random Units but all properties

Post by Maveritchell »

Deviss wrote:any suggestion for my problem, mav :D ?
Teancum already told you the answer - you need to use individual SetProperty/SetClassProperty statements for whatever you want to change (and you may not be able to change all of them anyway). You can't change an entity's classparent because that's not an odf property, it's an odf definition.
Image
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: Random Units but all properties

Post by Deviss »

so that way is impossible :S , other way for make random units but entity, for example first 3 second be rep_inf_ep3_rifleman, after 3 seconds change to rep_inf_ep3_rocketeer :) ? i tried getentityclass line but dont work :S
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: Random Units but all properties

Post by Teancum »

Maveritchell wrote:
Teancum wrote:This is an interesting idea. I think I might use it to give rebel soldiers random "faces" (models) so not every rebel looks the same.
That's a huge waste of space for a relatively minor change. Models and textures are the big space-wasters, and the more changes you make for purely aesthetic reasons, the bigger your bloat.
To each their own. I can get away with it on the Xbox having 256x256 max texture size, meaning 3 "unique" models for each class isn't very expensive at run-time, and adds maybe 5mb to the install size. I would agree with the idea on the PC though, since in the hands of the entire community I could see it getting out of hand. :P :thumbs:
User avatar
Maveritchell
Jedi Admin
Jedi Admin
Posts: 7366
Joined: Mon Aug 21, 2006 11:03 pm

Re: Random Units but all properties

Post by Maveritchell »

Deviss wrote:so that way is impossible :S , other way for make random units but entity, for example first 3 second be rep_inf_ep3_rifleman, after 3 seconds change to rep_inf_ep3_rocketeer :) ?
It's completely impossible to change the unit entity a certain class uses after the script has already been loaded. All you can ever do is modify the entity.

Even if you were to do that, it would be a bad choice because you'd be changing units already in use halfway - some properties are immediately applied (health, movement values), others are applied as soon as a unit of that class is spawned (addhealth/addshield), others are only applied when the individual unit itself is respawned (i.e. entering a command post). What you would have is a mess.

And of course, as I mentioned above, even if all you're changing is the textures, that's still a waste of space if it's for minor changes like faces. Larger changes are more noticeable but even bigger wastes of space. You can of course choose to ignore my opinion, but in that opinion, don't waste your time or anyone's space adding random elements that don't pack in significant gameplay changes - it's randomness just for the sake of randomness. I've done that with skies before, but only because the space taken up for those changes is very minor compared to the space that would be used for something like this.
Deviss
Master of the Force
Master of the Force
Posts: 3772
Joined: Tue Aug 12, 2008 7:59 pm
Projects :: Clone Wars Extended
Games I'm Playing :: BF2

Re: Random Units but all properties

Post by Deviss »

mm you are right, is minor change and wont be certain so surely i will have more problems , so i stop it better, many thanks Mav :) , you always make things better I think :D
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: Random Units but all properties

Post by Teancum »

Remember that you can use any models you have already loaded into memory for these purposes. So if you have a sniper you want to look like the rifleman, you can change that without having to make additional character classes and add to the download size of your mod/map. Mav is right though, adding new models should probably be kept to a minimum, as it would only appeal to a some players. Others may feel it's just wasted hard drive space.
User avatar
[RDH]Zerted
Gametoast Staff
Gametoast Staff
Posts: 2982
Joined: Sun Feb 26, 2006 7:36 am
Projects :: Bos Wars AI - a RTS game
Games I'm Playing :: SWBF2 and Bos Wars
xbox live or psn: No gamertag set
Location: USA
Contact:

Re: Random Units but all properties

Post by [RDH]Zerted »

Deviss wrote:[GameObjectClass]
ClassParent = "rep_inf_default_rifleman"

[Properties]
GeometryName = "rep_inf_ep3trooper"
blue chunk use the line SetClassproperty, but i need modify yellow chunk...
It shouldn't be possible to change the class definitions (the yellow section). If those could be dynamically changed ingame, then swbf2 is way more awesome then we were lead to believe and the developers deserve more credit then they got.
Post Reply