• 🏆 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!

Research questions + team colors for neutral buildings

Status
Not open for further replies.
Level 13
Joined
Jan 2, 2016
Messages
973
Okay, I'm finally back from the ship, and I have 2 questions:
1.a) Is there a way for me to detect event "a player has ordered a unit to start a research"?
(Let me clarify): When I use the event "A player begins a research" - it runs only when the research begins. If you start training a unit before starting the research you want, and AFTER that - you click on the research, the event will run only after the unit has been trained (and the research begins), while I want the event to run as soon as the player clicks on it.
1.b) Is there a way to order a unit to start a research via scripts??
1.c) Is there a way to order a unit to stop a research via scripts??

2) Can anyone explain me how to add team colors to neutral buildings, or give me a link to a guide how to do it?
 
Level 15
Joined
Sep 6, 2015
Messages
576
2) You can do it by changing the model:

1. Extract the texture of a building from the MPQ and converti it from BLP to TGA.

2. Open it in an image-editing program.

3. Make the parts of the building you want team color to be transparent (erase them so alpha texture (that means, no texture) can be seen) or semi-transparent and save the texture. Then, convert it back to BLP.

4. Extract the model of the building from the MPQ and open it in Magos' Model Editor.

5. Open the Texture Manager, create a new texture and edit it to set its Replaceable ID to 1 (if the Rep. ID 1 texture isn't there already).

6. Find which of the geosets (or model parts) contain the transparent part of the texture you added in Geoset Manager, and see which Material(s) it uses (you can use the program Mdlvis to open your model and go through the geosets on the right side with textured view enabled to see which one has your transparent texture part).

7. Go to the Material Manager in Magos' Model Editor and edit the material to add a new Material Layer in its edit menu which uses the Replaceable ID 1 texture.

8. Go to the Texture Manager and import the new texture you created, and delete the old texture of the model (possibly with the same name), go to the Material Manager and wherever the old texture was written in Material Layers, put the new texture you imported.

8. Save your model, convert it back to BLP, and import it on the map. Also import the skin with the same path that you imported it in the Texture Manager.
As you can see, it's easier done than said.
 
Level 37
Joined
Jul 22, 2015
Messages
3,485
1.a) Is there a way for me to detect event "a player has ordered a unit to start a research"?
A unit is Issued an order with no target.

I use this little trigger snippet a lot:
  • Order Checker
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: call BJDebugMsg(OrderId2String(GetIssuedOrderId()) + " - " + I2S(GetIssuedOrderId()))
Maybe it will be useful for you o:

1.b) Is there a way to order a unit to start a research via scripts??
Well there is a GUI function for it, so there is most definitely a native for it:
JASS:
function IssueUpgradeOrderByIdBJ takes unit whichUnit, integer techId returns boolean
    return IssueImmediateOrderById(whichUnit, techId)
endfunction

1.c) Is there a way to order a unit to stop a research via scripts??
You are only able to stop it once the research order has been given. I'm not sure if its possible to stop it if its in que with other researches. You just use "A unit is issued an order with no target" again, do your necessary checks to see if you need to stop it, and then IssueImmediateOrderById(whichUnit, 851976). You will need to add some sort of small wait timer because this fires literally right before the research starts, so the cancel order will not actually stop it.
 
Level 13
Joined
Jan 2, 2016
Messages
973
A unit is Issued an order with no target.

I use this little trigger snippet a lot:
  • Order Checker
    • Events
      • Unit - A unit Is issued an order targeting a point
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting an object
    • Conditions
    • Actions
      • Custom script: call BJDebugMsg(OrderId2String(GetIssuedOrderId()) + " - " + I2S(GetIssuedOrderId()))
Maybe it will be useful for you o:

I have already tried that, but when I start a research - it doesn't run for some reason...
 
Level 13
Joined
Jan 2, 2016
Messages
973
Okay... after I started doing it your way - it started working.
Before I was doing it with:
  • Game - Display to (All players) the text: (String((Issued order)))
Still.. no string order is displayed... I only get "- xxxxxxxx" as message :p
But I guess that's good enough.
 
Status
Not open for further replies.
Top