When a unit dies, its current mana is converted to gold

Status
Not open for further replies.
Level 2
Joined
Sep 21, 2018
Messages
12
If I have a Sheep, its max mana is 100 and it has 1 mana/sec regen. When its current mana reaches, for example, 60. The player then kills the Sheep and the player gains 60 gold.

How do I make a trigger for that? Please explain with a STEP-BY-STEP guide.

EDIT: Garfield1337 posted a very logical answer which seem to have worked according to the reply. I don't understand or rather know how to do it though. Which tab to open etc, there are so many tabs in the Trigger Editor, it is a nightmare navigating through that.

//Sidenote//

Would like if there is a way for floating text of sorts to pop up when you kill the Sheep, the text being how much gold you have gained. Then the text disappears.
 

Attachments

  • garfield1337.PNG
    garfield1337.PNG
    13.5 KB · Views: 51
Last edited:
Level 41
Joined
Feb 27, 2007
Messages
5,233
You really need to learn how to remake an example trigger yourself or you are never, ever going to be able to complete your project and getting help on a site like this will be very difficult. It's really not very complicated and you will be happy to have learned! The buttons have simple icons and when you hover your mouse over them they say what they do. Here are two (admittedly old) tutorials that may help you to learn the interface:
So make a new trigger and click the event button to add an event, choose "generic unit event", then click the blue parts to change what generic unit event it is (I think the default is "a unit dies" though). Same thing with conditions: click the button to add a condition, find "or - multiple conditions", click okay. Repeat to add the 2 "unit-type comparisons"; you can click-drag lines around to move them inside the Or block. Same thing with Events, just look for the one with the name that does what you want and then click on the blue fields to modify them. You can also use the "search for text" box in the window that shows up after you've clicked to add a new event/condition/action, or narrow down the category of things you're looking at.
Would like if there is a way for floating text of sorts to pop up when you kill the Sheep, the text being how much gold you have gained. Then the text disappears.
Look at the floating text commands. One thing you need to know is that you need to set the FT to "disable permanence" (aka "it can go away") before you give it a lifespan, so the order there is important. To make a longer string in the text field you'll have to use "concatenate strings" to 'add' two together.

  • Floating Text - Create a floating text that reads (+ + Integer(Mana of (Triggering Unit))) above (Triggering Unit) with Z offset <the height you want> using font size <the font size you want>, color (Red%, Green%, Blue%) and 0% transparency
  • Floating Text - Change (Last created floating text): Disable permanence
  • Floating Text - Change the lifespan of (Last created floating text) to <however long you want it to be visible>
 
Level 2
Joined
Sep 21, 2018
Messages
12
You really need to learn how to remake an example trigger yourself or you are never, ever going to be able to complete your project and getting help on a site like this will be very difficult. It's really not very complicated and you will be happy to have learned! The buttons have simple icons and when you hover your mouse over them they say what they do. Here are two (admittedly old) tutorials that may help you to learn the interface:
So make a new trigger and click the event button to add an event, choose "generic unit event", then click the blue parts to change what generic unit event it is (I think the default is "a unit dies" though). Same thing with conditions: click the button to add a condition, find "or - multiple conditions", click okay. Repeat to add the 2 "unit-type comparisons"; you can click-drag lines around to move them inside the Or block. Same thing with Events, just look for the one with the name that does what you want and then click on the blue fields to modify them. You can also use the "search for text" box in the window that shows up after you've clicked to add a new event/condition/action, or narrow down the category of things you're looking at.

Look at the floating text commands. One thing you need to know is that you need to set the FT to "disable permanence" (aka "it can go away") before you give it a lifespan, so the order there is important. To make a longer string in the text field you'll have to use "concatenate strings" to 'add' two together.

  • Floating Text - Create a floating text that reads (+ + Integer(Mana of (Triggering Unit))) above (Triggering Unit) with Z offset <the height you want> using font size <the font size you want>, color (Red%, Green%, Blue%) and 0% transparency
  • Floating Text - Change (Last created floating text): Disable permanence
  • Floating Text - Change the lifespan of (Last created floating text) to <however long you want it to be visible>

Thank you but I still don't know how to "Add integer mana of triggering unit..." There is just a bunch hastable from what I can find and if you click on it, it just opens endless new windows. I do appreciate the help, I have checked those links you have given me, but they have not helped me in completing this "mana to gold" conversion. Although I have learned about the Sunken Bridge and Opening Gates which I can use in the future.

HelpThisThing.PNG


This is how my triggers are at the current moment. What I am thinking is that I should move onto "Actions" and then "Add property" to the player. But yeah I get stuck.
 
Last edited:
Level 41
Joined
Feb 27, 2007
Messages
5,233
  1. Player - Add Property
  2. Click the Blue 1000
    • Click the drop-down list of functions (default is a Hashtable function) and select "Conversion - Convert Real to Integer"
    • Click OK
  3. Click the blue (Life of (Triggering Unit))
  4. Click the blue Life
    • Select "Mana" from the list of functions
    • Don't need to change the unit because the default is "Triggering Unit"
    • Click OK
  5. Click OK 3 times (should only have the base "configure action" window open now)
  6. Click the blue Player 1 (Red)
    • Select "Owner of Unit" from the list of functions.
    • Don't need to change the player because the default is "Owner of (Triggering Unit)"
    • Click OK
  7. Click OK

If this excessive menu-hopping and hunting bothers you and you have any programming gumption it may behoove you just to learn JASS right off the bat and skip the GUI menu fuckery. Would be glad to assist with that, and there are numerous tutorials on getting started. GUI is a nice reference to remember what functions exist and what they can do, though.

Beginning JASS Tutorial Series
Learning JASS
JASS: Moving From GUI to Jass, the Start
JASS Tutorial
[JASS/AI] - Simple JASS tutorial - for beginners
Tutorials forum: JASS/AI Scripts Tutorials
 
Last edited:
Level 2
Joined
Sep 21, 2018
Messages
12
  1. Player - Add Property
  2. Click the Blue 1000
    • Click the drop-down list of functions (default is a Hashtable function) and select "Conversion - Convert Real to Integer"
    • Click OK
  3. Click the blue (Life of (Triggering Unit))
  4. Click the blue Life
    • Select "Mana" from the list of functions
    • Don't need to change the unit because the default is "Triggering Unit"
    • Click OK
  5. Click OK 3 times (should only have the base "configure action" window open now)
  6. Click the blue Player 1 (Red)
    • Select "Owner of Unit" from the list of functions.
    • Don't need to change the player because the default is "Owner of (Triggering Unit)"
    • Click OK
  7. Click OK
If this excessive menu-hopping and hunting bothers you and you have any programming gumption it may behoove you just to learn JASS right off the bat and skip the GUI menu fuckery. Would be glad to assist with that, and there are numerous tutorials on getting started. GUI is a nice reference to remember what functions exist and what they can do, though.

Beginning JASS Tutorial Series
Learning JASS
JASS: Moving From GUI to Jass, the Start
JASS Tutorial
[JASS/AI] - Simple JASS tutorial - for beginners
Tutorials forum: JASS/AI Scripts Tutorials

Thank you very much! You made my day today, I managed to get the text disappear and the mana convertion working. Thank you for a good step-by-step guide. :)
 
Status
Not open for further replies.
Top