Page 1 of 2

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

Posted: Thu Aug 12, 2010 4:57 pm
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

Re: Random Units but all properties

Posted: Thu Aug 12, 2010 5:46 pm
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.

Re: Random Units but all properties

Posted: Thu Aug 12, 2010 6:03 pm
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...
---------------------------------------------------------------------

Re: Random Units but all properties

Posted: Thu Aug 12, 2010 6:16 pm
by skelltor
yea

Re: Random Units but all properties

Posted: Thu Aug 12, 2010 9:49 pm
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

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 3:26 am
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.

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 9:11 am
by skelltor
no he wants to change the parent odf and the model not just the model.

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 10:34 am
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

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 10:57 am
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.

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 11:04 am
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

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 11:11 am
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....

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 11:13 am
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.

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 11:48 am
by Deviss
any suggestion for my problem, mav :D ?

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 12:07 pm
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

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 12:11 pm
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

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 12:19 pm
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:

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 12:20 pm
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.

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 12:30 pm
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

Re: Random Units but all properties

Posted: Fri Aug 13, 2010 12:46 pm
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.

Re: Random Units but all properties

Posted: Sat Aug 14, 2010 11:13 am
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.