I've exported, modified (in Photoshop), and imported a custom texture, which I have based on and want to apply to the "Assets\Units\Critters\War3_HermitCrab\War3_HermitCrab.m3" model. This model is now available through the "Warcraft III Art Mod" dependency.
I have created a Unit, Model, and Actor, and tied everything nicely together. The hermit crab, which I named "Pinchling", appears as it should in the terrain editor.
I created my Texture, setting Slot="body" and File to my imported texture. So far so good.
Now, I attempted to apply the same logic as in Kueken531 example to my Hermit Crab, using "TextureSelectById" and all that. No success. The "Messages" dialog keeps outputting error messages like:
[5/9/2015 3:40:36 PM] Warning: USER: [ 26 8] CActorUnit[Pinchling] Pinchling Assets\Units\Critters\War3_HermitCrab\War3_HermitCrab.m3; Could not find texture with id Pinchling_Normal.
Note that I did intentionally name the texture "Pinchling_Normal".
I'm thinking that perhaps the attachment slots ("main", "body", etc.) could be different on the War3 models? Indeed, when I "Show Model Data" for the Crab model, under materials, it's called "Body2"; not just "Body".
I played around a bit more with the Actors. The Sound actor works perfectly. But it seems like the main unit Actor simply won't accept any changes in the "Events - Send", where I previously tried to apply "TextureSelectById".
As seen in the attached screenshot, I tried a different Event. In this example I simply want to start a timer on unit death. But it becomes red (invalid or overridden). This goes for any and all Events I attempt to add.
Red does not mean that? As far as I can tell Red means that it is a modified event, even if not intentionally. For example deleting an event high up the list usually makes everything below it red. This corresponds to a lot of XML to alter all the event array indices.
As for your texture problem, do make sure the model actually uses a normal map texture. Traditional WC3 skins come in on a different layer (diffuse?) and unless blizzard enhanced the model I would imagine it would only have a diffuse texture. The normal should all be per-vertex as they were in WC3 unless they baked these onto a texture. I will look into this tomorrow. Maybe post a map showing what you have done in-case people can sport any mistakes as well as mess around with it to find a solution.
Things have become a lot more advanced for models in Starcraft 2 compared to Warcraft 3, indeed.
I've created and attached a map illustrating my problem.
The new Unit, "Pinchling", is duplicated from the Zergling, also duplicating the Model and Actor (for the unit). I have modified a few entries to clean things up a bit, e.g. removing Abilities and Custom Death Models & Sounds.
Next, I've imported a modified texture (made it pink for clear visual distinction), and I've added a new "Pinchling" Texture.
Now, in the Actor, under "Events+", I cleared away the zergling specific events, leaving only the gray text entries. I then added an "ActorCreation" event with "TextureSelectById Pinchling". But it's red. See attached screenshot.
True. I forgot to do that in the example map I posted above. I just replicated the work I did in another map into the example map and forgot that field.
I filled out the fields and attached the map again. But it still does squat. All new Events (i.e. those below the gray ones) I add to the Actor are still red.
I hammered a bit more on this, but I am not yet successful. I got the Actor working perfectly. I just can't seem to get the texture swap to work. I also did the timer trick in the Actor's Events, i.e.:
ActorCreation
TimerSet 0.010000 TextureSwapTimer
TimerExpired
TimerName TextureSwapTimer
TextureSelectById Pinchling
When I use the slot "body" in both Texture and Model, I get the error message:
USER: [ 7 17] CActorUnit[Pinchling] Model[Pinchling] m3[War3_HermitCrab]; No mapping for slot body.
When I use the slot "main" likewise, I get the error message:
USER: [ 7 17] CActorUnit[Pinchling] Model[Pinchling] m3[War3_HermitCrab]; No mapping for slot main.
So the slot appears to be neither "body" nor "main". But then, what is it?
I also attempted with "main.diffuse", "body.diffuse", and many more combinations.
The "Prefix" in the Model's "Texture Declarations +" is apparently now required (source).
How to replicate step-by-step
Import (F9) your custom texture (commonly a "diffuse" image).
In the Data Editor (F7), go to the "Texture" tab, and create a new texture. Set File to the path of your imported texture. Set Slot to "body".
Go to the "Model" tab and select the model you wish to replace the texture for. Click "Texture Declarations +" and a dialog window appears. See . Add an index by clicking the green "+". Under "Adapations", click the green "+" as well. Now, in Slot write "body". In Trigger On Substring and Prefix write the name (not path) of the original texture filling that slot (may be found browsing "Model Data" in the Cutscene Editor; help here).
Go to the Actor tab and select the respective Actor for your Model. Click "Events +" and a dialog window appears. Add an Event, "ActorCreation", and the action should be "TextureSelectById" where you provide the texture you created in stage 2. To make the texture appear in the editor as well, you may do (again, more help here).
Solution
See: http://www.sc2mapster.com/forums/development/data/78464-problem-changing-texture-on-a-war3-model/#p9
Original post
I've exported, modified (in Photoshop), and imported a custom texture, which I have based on and want to apply to the "Assets\Units\Critters\War3_HermitCrab\War3_HermitCrab.m3" model. This model is now available through the "Warcraft III Art Mod" dependency.
I have created a Unit, Model, and Actor, and tied everything nicely together. The hermit crab, which I named "Pinchling", appears as it should in the terrain editor.
However, I want to change its texture. I went here - http:www.sc2mapster.com/forums/resources/tutorials/20772-data-actor-events-message-texture-select-by-id/ - to find out this approach was hopelessly outdated. But on page 24, Kueken531 made a post where he'd successfully changed the texture of a Thor and he included an example map. Many thanks for this, Kueken531!
I created my Texture, setting Slot="body" and File to my imported texture. So far so good.
Now, I attempted to apply the same logic as in Kueken531 example to my Hermit Crab, using "TextureSelectById" and all that. No success. The "Messages" dialog keeps outputting error messages like:
[5/9/2015 3:40:36 PM] Warning: USER: [ 26 8] CActorUnit[Pinchling] Pinchling Assets\Units\Critters\War3_HermitCrab\War3_HermitCrab.m3; Could not find texture with id Pinchling_Normal.
Note that I did intentionally name the texture "Pinchling_Normal".
I'm thinking that perhaps the attachment slots ("main", "body", etc.) could be different on the War3 models? Indeed, when I "Show Model Data" for the Crab model, under materials, it's called "Body2"; not just "Body".
Anyone who can crack this one?
Thanks in advance!
I played around a bit more with the Actors. The Sound actor works perfectly. But it seems like the main unit Actor simply won't accept any changes in the "Events - Send", where I previously tried to apply "TextureSelectById".
As seen in the attached screenshot, I tried a different Event. In this example I simply want to start a timer on unit death. But it becomes red (invalid or overridden). This goes for any and all Events I attempt to add.
Red does not mean that? As far as I can tell Red means that it is a modified event, even if not intentionally. For example deleting an event high up the list usually makes everything below it red. This corresponds to a lot of XML to alter all the event array indices.
As for your texture problem, do make sure the model actually uses a normal map texture. Traditional WC3 skins come in on a different layer (diffuse?) and unless blizzard enhanced the model I would imagine it would only have a diffuse texture. The normal should all be per-vertex as they were in WC3 unless they baked these onto a texture. I will look into this tomorrow. Maybe post a map showing what you have done in-case people can sport any mistakes as well as mess around with it to find a solution.
@ImperialGood: Go
Thanks for your interest!
Things have become a lot more advanced for models in Starcraft 2 compared to Warcraft 3, indeed.
I've created and attached a map illustrating my problem.
The new Unit, "Pinchling", is duplicated from the Zergling, also duplicating the Model and Actor (for the unit). I have modified a few entries to clean things up a bit, e.g. removing Abilities and Custom Death Models & Sounds.
Next, I've imported a modified texture (made it pink for clear visual distinction), and I've added a new "Pinchling" Texture.
Now, in the Actor, under "Events+", I cleared away the zergling specific events, leaving only the gray text entries. I then added an "ActorCreation" event with "TextureSelectById Pinchling". But it's red. See attached screenshot.
You didn't do the texture declarations inside the model. Follow this guide to change textures easy. http://www.sc2mapster.com/forums/resources/tutorials/20772-data-actor-events-message-texture-select-by-id/
@Zer0skiller: Go
True. I forgot to do that in the example map I posted above. I just replicated the work I did in another map into the example map and forgot that field.
I filled out the fields and attached the map again. But it still does squat. All new Events (i.e. those below the gray ones) I add to the Actor are still red.
I hammered a bit more on this, but I am not yet successful. I got the Actor working perfectly. I just can't seem to get the texture swap to work. I also did the timer trick in the Actor's Events, i.e.:
When I use the slot "body" in both Texture and Model, I get the error message:
When I use the slot "main" likewise, I get the error message:
So the slot appears to be neither "body" nor "main". But then, what is it?
I also attempted with "main.diffuse", "body.diffuse", and many more combinations.
Still having problems with this one. No one who can help? :(
I figured it out!
Solution map is attached.
The "Prefix" in the Model's "Texture Declarations +" is apparently now required (source).
How to replicate step-by-step
It should now work.
Enjoy!