the native way is to have a model called planet_00.m3, planet_01.m3 and so on and just set variation to the number of models. setting the modelfile of the model to planet.m3 (must be done in raw editing). my approach was to have an effect on creation which adds a random behaviour to the unit (set effect, max number 1, random on). in actor events react to the buff and do a model swap, texture swap.
I'm using models from a pre-existing mod, how would I go about adding variance?
Some of them are pretty terribad, uvw mapping is all messed up, and they don't rotate, so perhaps I'll make my own, how do I export multiple models to a mod thru art tools? (I figured out singles)
I think there is an easier way with triggers, Are you placing them on the map or are they created on the map with a trigger? If you are simply placing them on the map like X----------X----------------X------------X then all you need is 1 unit and add this trigger: Just using a Marine as an example.
General - Repeat (Actions) 10 times <--change 10 to however many units you have on the map.
Actions
Unit Group - Pick each unit in (Marine units in (Entire map) owned by player Any Player matching (No Value), with at most 1) and do (Actions)
Actions
General - Pick each integer from (Random integer between 0 and 100) to (Random integer between 0 and 100), and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked integer) == 1
Then
Unit - Set unit (Picked unit) model to Crate with variation 0 and textures ""
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked integer) == 2
Then
Unit - Set unit (Picked unit) model to Crate with variation 0 and textures ""
Else
This will select them 1 at a time and change them to a random texture. Keep adding a General - If (Conditions) then do (Actions) else do (Actions) for how many variations you want. IF - 1,2,3,4,5,6,7,8,9....ect. I know its not DATA but it would also work, lol.
Data is the perferred method, and while triggers is an alternative solution if data is too tough, the solution you've provided is wrong on soooo many accounts. For one you do not need the repeat loop at all since its already basically built into the pick each unit loop. Also in the event there are like 100 variations do would never want to create the if-then or switch for each condition; you can just set the random integer within the model variation action or worst case set the random integer and run a loop with a single condition that uses the integer. Your integer loop of instance is using a range between 2 random integers (what if they happened to be 42 and 0?)
To further explain how wrong this is, I will break down your trigger for you; it may help you understand triggering overall a bit more.
General - Repeat (Actions) 10 times <--change 10 to however many units you have on the map.
Everything below this will happen 10 times
Unit Group - Pick each unit in (Marine units in (Entire map) owned by player Any Player matching (No Value), with at most 1) and do (Actions)
Sort through all units in the game, and pick a single marine. (Note, you could have " at most 1" set to "any" here, to avoid the repeat at the top)
General - Pick each integer from (Random integer between 0 and 100) to (Random integer between 0 and 100), and do (Actions)
This is a loop, which will be run X times, based on the difference between random integer 1, and random integer 2 (Which can be 42 and 0, or 1 and 4)
***A short break to point out; you have this run 10 times, then within that 10, it runs again, up to 101 times, for a total loop of 1010; checking ~100 if then statements. Seems like a lot of lag...
Assuming whoever needs this is looking for a simple solution, say they have very poor trigger skills; the above is a rough outline of what could work.
"Pick every unit in map of type marine, with at most any"
--This picks all marines
switch based on "random integer between 1-100"
--this picks a random number based on the number of possible objects, 100 being the max in this case.
Insane list of cases (If 1, then. if 2 then.)
--Lots of legwork if you have more than a dozen options, but doable, even with 100.
instead of having an insane list of cases you can also have an insane list of models with naming conventions, for example model1, model2, ... model100.
then use combined strings and conversions to actor msg to build your modelswap actor msg with the random integer.
I was wondering if there was a change model option, the map is randomly generated, so each planet is made from that start, I can just set it to a random number when being generated.
What is the best way to choose a random model or actor for a unit to use?
I am making planet units and I don't want to have to make a unit for each one, simply change the actor/model
Thanks
@Sapphire_united: Go
the native way is to have a model called planet_00.m3, planet_01.m3 and so on and just set variation to the number of models. setting the modelfile of the model to planet.m3 (must be done in raw editing). my approach was to have an effect on creation which adds a random behaviour to the unit (set effect, max number 1, random on). in actor events react to the buff and do a model swap, texture swap.
I'm using models from a pre-existing mod, how would I go about adding variance? Some of them are pretty terribad, uvw mapping is all messed up, and they don't rotate, so perhaps I'll make my own, how do I export multiple models to a mod thru art tools? (I figured out singles)
Thanks
@Sapphire_united: Go
it always one model, planet_00 is one, planet_01 is one and so on, by selecting planet.m3 it will choose a random one by default.
I think there is an easier way with triggers, Are you placing them on the map or are they created on the map with a trigger? If you are simply placing them on the map like X----------X----------------X------------X then all you need is 1 unit and add this trigger: Just using a Marine as an example.
General - Repeat (Actions) 10 times <--change 10 to however many units you have on the map.
Actions
Unit Group - Pick each unit in (Marine units in (Entire map) owned by player Any Player matching (No Value), with at most 1) and do (Actions)
Actions
General - Pick each integer from (Random integer between 0 and 100) to (Random integer between 0 and 100), and do (Actions)
Actions
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked integer) == 1
Then
Unit - Set unit (Picked unit) model to Crate with variation 0 and textures ""
Else
General - If (Conditions) then do (Actions) else do (Actions)
If
(Picked integer) == 2
Then
Unit - Set unit (Picked unit) model to Crate with variation 0 and textures ""
Else
This will select them 1 at a time and change them to a random texture. Keep adding a General - If (Conditions) then do (Actions) else do (Actions) for how many variations you want. IF - 1,2,3,4,5,6,7,8,9....ect. I know its not DATA but it would also work, lol.
@SC2UniversalDomination: Go
Data is the perferred method, and while triggers is an alternative solution if data is too tough, the solution you've provided is wrong on soooo many accounts. For one you do not need the repeat loop at all since its already basically built into the pick each unit loop. Also in the event there are like 100 variations do would never want to create the if-then or switch for each condition; you can just set the random integer within the model variation action or worst case set the random integer and run a loop with a single condition that uses the integer. Your integer loop of instance is using a range between 2 random integers (what if they happened to be 42 and 0?)
To further explain how wrong this is, I will break down your trigger for you; it may help you understand triggering overall a bit more.
General - Repeat (Actions) 10 times <--change 10 to however many units you have on the map.
Everything below this will happen 10 times
Unit Group - Pick each unit in (Marine units in (Entire map) owned by player Any Player matching (No Value), with at most 1) and do (Actions)
Sort through all units in the game, and pick a single marine. (Note, you could have " at most 1" set to "any" here, to avoid the repeat at the top)
General - Pick each integer from (Random integer between 0 and 100) to (Random integer between 0 and 100), and do (Actions)
This is a loop, which will be run X times, based on the difference between random integer 1, and random integer 2 (Which can be 42 and 0, or 1 and 4)
***A short break to point out; you have this run 10 times, then within that 10, it runs again, up to 101 times, for a total loop of 1010; checking ~100 if then statements. Seems like a lot of lag...
Assuming whoever needs this is looking for a simple solution, say they have very poor trigger skills; the above is a rough outline of what could work.
"Pick every unit in map of type marine, with at most any"
--This picks all marines
switch based on "random integer between 1-100"
--this picks a random number based on the number of possible objects, 100 being the max in this case.
Insane list of cases (If 1, then. if 2 then.)
--Lots of legwork if you have more than a dozen options, but doable, even with 100.
Skype: [email protected] Current Project: Custom Hero Arena! US: battlenet:://starcraft/map/1/263274 EU: battlenet:://starcraft/map/2/186418
instead of having an insane list of cases you can also have an insane list of models with naming conventions, for example model1, model2, ... model100. then use combined strings and conversions to actor msg to build your modelswap actor msg with the random integer.
I was wondering if there was a change model option, the map is randomly generated, so each planet is made from that start, I can just set it to a random number when being generated.
Thanks
I've spent over 7 years using the wc3 trigger system, and it is almost identical to sc2, so I know what I'm doing. c:
Local variables are quite handy i must say
maybe i should of said ..... EXAMPLE:::
LMAO.
Does each copy of the unit require a different model?
No, there are repeats..
I'm starting to think I will just make my own planets.. the ones I'm using don't rotate.. :/
@Sapphire_united: Go
Always the option of using site operations, turrets, or something like that to do the rotating in editor/game.