• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Randomized Models (like Dark Templar)

Status
Not open for further replies.
Level 10
Joined
Sep 29, 2006
Messages
447
How can I make it so that when a unit is trained it will have a randomized portrait? I'm trying to do this with the multitude of Marine portraits that there are. It would be exactly like the dark templar - whenever you train one you get a random model of the two, each with it's own portrait. I want the marines to all have the same model, but different portraits. How do I do this?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
It uses a special file format for the unit model thus allowing the use of the varience field. The varience then trigger a change in portrait via the actor events.

You could try messing with model variance and using the same method but it might cause the actor to create invalid models so it would be an experiment.

Any way, what you are after is actor events, you can change unit portraits via them.

If worst comes to worst, use triggers to add behaviours which change the portrait via actor events.
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,188
Well you need to make it so that effects or behaviours (usable by triggers) change the units portrait via actor events. Look at how the dark templars do it and then copy and edit the events and conditions to suit your needs.

Then when the unit is created, get a trigger to run a random effect of behaviour which alters the units portrait apperances. As the effect or behaviour used is random, the portrait result will be random.
 
Level 9
Joined
Nov 4, 2007
Messages
931
Theoretically this can also be done all in the data editor, though it would require more work then doing it via trigger, but I'll try to give a way you can do DSG's method with the data editor alone.
Step 1: Make your behaviors, one to for each actor event that you want to detect and create a unit portrait for. (Hidden flag is optional, really its up to you if you want this behavior to appear on the unit)
Step 2: Make apply behavior effects for each one of your behaviors in Step 1.
Step 3: Make a Set effect and add your apply effects to it, set the min. and max count to 1 and enable Random.
Step 4: Make an ability of type Effect - Instant, give it any command button you desire (the button doesn't matter, the ability will disappear quickly as it is) and check the flags to make it Auto Cast and Auto Cast On, and add your effect Set.
Step 5: Make a Requirement that counts the behavior completed at unit is equal to 0 (use And between each behavior you created) in the Show category (I do Used as well, but I'm picky)
Step 6: Add your ability to your unit, and set its ability command card anywhere, (preferably underneath a current command card button so its never visible) and add the requirement from Step 5 into its requirement field (this will ensure that when your ability fires, a random behavior will be addec, causing your requirement to return false and preventing the ability from firing again, and will cause it to become hidden even if you gave it its own command card button.)
Yes it is probably longer than what it would take to just trigger a random effect or behavior to be applied whenever the unit is created, but to me I'd much rather do things that can be done in an object (data) editor than with a trigger editor if it can be done.
 
Status
Not open for further replies.
Top