- Joined
- Jan 28, 2012
- Messages
- 266
1.0 Modeling
2.0 Using this in your map
3.0 Conclusion
1.0 Modeling
to do this I used Magos's Model Editor
1.1 Overview
all you are going to do is add an alpha tile texture to your model, set its replaceable id to 31 then add as a material layer on top of materials that you want to change their texture, and making sure to set filter type to transparent
if this is enough information for you, edit a model and head onto 2.0 if not keep reading
Go To Index
if this is enough information for you, edit a model and head onto 2.0 if not keep reading
Go To Index
1.2 Walkthrough
First off you will want to go to the texture manager window>Texture Manager
next import a alpha tile into the texture manager: RightClick>Import
i am using the alpha tile from De.Factos Tutorial
then edit the new texture: Right Click it>Edit
Then set its replacable id to 31
Go To Index
next import a alpha tile into the texture manager: RightClick>Import
i am using the alpha tile from De.Factos Tutorial
then edit the new texture: Right Click it>Edit
Then set its replacable id to 31
Go To Index
1.3 Editing Materials
First Go to the Material Manager: Window>Material Manager
then right click the first material edit it and then look at its material layers,if it is the main texture of the model
Create a new material: Right click> Create New
set its texture to your texture
set its filter mode to transparent, if you look at the model, when your done, and it is completely black you forgot to set its filter mode to transparent
Go To Index
then right click the first material edit it and then look at its material layers,if it is the main texture of the model
Create a new material: Right click> Create New
set its texture to your texture
set its filter mode to transparent, if you look at the model, when your done, and it is completely black you forgot to set its filter mode to transparent
Go To Index
2.0 Using This in your map
Have any of you evr noticed the mountain giants warclub ability? and how depending on what tree He picks up, he has a different looking club? This will require one ability + however many textures you intend on using.
2.1 Making the Abilityfirst off, in the object editor create a new ability based on warclub, name it Texture Changer
then select it and set Data- maximum attacks to 0
then select disable attacks, press shift enter and set it to 3
do the same thing for Data - Enable Attack and then set the other purple data to the values i have set them(this is to make it almost instant)
2.2 Making the Destructablesthen select it and set Data- maximum attacks to 0
then select disable attacks, press shift enter and set it to 3
do the same thing for Data - Enable Attack and then set the other purple data to the values i have set them(this is to make it almost instant)
First off you are going to create a new destructible, base it off of a tree
Next set its Fly height to 0.00 this is to prevent it from modifying flying units heights for a brief instant.
set its replaceable texture to your textures path,
set its pathing to none this is to prevent it from pushing units around
Go To Index
Next set its Fly height to 0.00 this is to prevent it from modifying flying units heights for a brief instant.
set its replaceable texture to your textures path,
set its pathing to none this is to prevent it from pushing units around
Go To Index
2.3 Triggering it
Look at at which ever explanation you want, what you'll be doing is creating a destructible, adding Texture Changer(the ability you made early) to the unit, ordering it to cast, removing Texture Changer, and then waiting and removing the destructible(to prevent a build up of destructible's.
you will also need to use a method to make units who enter the map change their texture to the alpha tile(I use bribes unit indexer), because for some reason the units appear white(anyone who figures out a solution for this problem please tell me)
Go To Index
JASS:
function change texture takes unit u, integer dtype returns nothing
local real a = GetUnitFacing(u)*bj_DEGTORAD//What i am doing here is converting the units facing angle into radians, though why blizzard doesn't have them use a radians is beyond me
local destructable d = CreateDestructible(dtype,GetUnitX(u) + 12*Cos(a),GetUnitY(u) + 12*Sin(a),0,.1,1)
//this just creates a destructable in front of the unit, to make so
// that the unit can insta cast
// IMPORTANT remembber to make sure all destructables that you are
// using have no pathing, otherwise they will move the unit backwards.
call UnitAddAbility(u,TEXTURE_CHANGER)
// adding the texture changing ability to the unit, WARNING
// this could conflict with a unit that has war club, if this could be a
// concern add an if here that checks if the unit has the ability warclub
call IssueTargetOrder(u,"warclub",d)
//a better way to do this would be using IssueTargetOrderById,
// but i am to lazy to look up the order id:)
call UnitRemoveAbility(u,TEXTURE_CHANGER)
//what this does is cause warcraft 3 to instantly cast this spell
// i wish i had a long complicated reason to give you, but i don't.
call RemoveDestructable(d)
// originally I put a wait between this and the remove ability but it isn't needed
endfunction
-
Actions
- Set TempPoint = (Position of (Triggering unit))
- -------- ---------- ------------ --------- --------
- -------- Setting the position of the unit to a --------
- -------- point in order to prevent leaks --------
- -------- using xy coords is better but that --------
- -------- requires some jass knowledge --------
- -------- ---------- ------------ --------- --------
- Set TempPoint2 = (TempPoint offset by 12.00 towards (Facing of (Triggering unit)) degrees)
- -------- ---------- ------------ --------- --------
- -------- same as above, but this time we are --------
- -------- putting the point in front of the unit, --------
- -------- so it doesn't have to turn to cast --------
- -------- ---------- ------------ --------- --------
- Destructible - Create a Alpha at TempPoint facing 0.00 with scale 0.01 and variation 0
- -------- ---------- ------------ --------- --------
- -------- Creating a destructable, remember --------
- -------- make sure the destructable you are --------
- -------- using does not have any pathing --------
- -------- ---------- ------------ --------- --------
- Unit - Add TextureChanger to (Triggering unit)
- -------- ---------- ------------ --------- --------
- -------- Add the ability to the unit, so it can cast --------
- -------- it --------
- -------- ---------- ------------ --------- --------
- Unit - Order (Triggering unit) to Night Elf Mountain Giant - War Club (Last created destructible)
- -------- ---------- ------------ --------- --------
- -------- pretty basic, just ordering the unit to --------
- -------- cast the ability WARNING this can --------
- -------- conflict with the warclub ability --------
- -------- so i recomend that you don't use --------
- -------- units that have the warclub ability --------
- -------- ---------- ------------ --------- --------
- Unit - Remove TextureChanger from (Triggering unit)
- -------- ---------- ------------ --------- --------
- -------- removing an ability after you order a unit --------
- -------- to cast it causes the unit to instant --------
- -------- cast that ability, provided that the --------
- -------- unit doesn't have to turn to face the --------
- -------- target --------
- -------- ---------- ------------ --------- --------
- Destructible - Remove (Last created destructible)
- -------- ---------- ------------ --------- --------
- -------- Removing the destructible to prevent --------
- -------- a build up of dead destructables --------
- -------- ---------- ------------ --------- --------
- Custom script: call RemoveLocation(udg_TempPoint)
- Custom script: call RemoveLocation(udg_TempPoint2)
- Custom script: set udg_TempPoint = null
- Custom script: set udg_TempPoint2 = null
- -------- ---------- ------------ --------- --------
- -------- Removing location leaks --------
- -------- ---------- ------------ --------- --------
- Custom script: set bj_lastCreatedDestructable = null
- -------- ---------- ------------ --------- --------
- -------- this is to prevent the destructable from --------
- -------- creating a minute leak which all --------
- -------- Handles will do if you don't null --------
- -------- variables that you set to them --------
- -------- ---------- ------------ --------- --------
Go To Index
3.0 Conclusion
I hoped you learned from this tutorial, please comment and give suggestions for improvment
Go To Index
Go To Index
3.1 View attachment Complicated Texture Switcher.w3x
Attachments
-
Texture Manager.jpg16.4 KB · Views: 4,880
-
Material Manager.jpg16.3 KB · Views: 4,720
-
EditTexture2.jpg26.6 KB · Views: 4,756
-
EditTexture.jpg5 KB · Views: 4,690
-
CreateNew Material Layer.jpg4 KB · Views: 4,637
-
MaterialEditLoksLike.jpg24.8 KB · Views: 4,747
-
Selecting Filter Mode.jpg5.2 KB · Views: 4,673
-
Selecting texture.jpg39 KB · Views: 4,768
-
Object Editor WarClub.jpg42.8 KB · Views: 4,790
-
ObjectEditor DeisableAttack.jpg65.6 KB · Views: 4,687
-
ObjectEditor Max Attacks.jpg64.6 KB · Views: 4,686
-
Destruct Make Your Destructable.jpg38.7 KB · Views: 4,688
-
Destruct FlyHeight.jpg83.1 KB · Views: 4,747
-
Destruct Pathing.jpg128.1 KB · Views: 4,702
-
Destruct Replace Texture.jpg136.9 KB · Views: 4,861
Last edited by a moderator: