• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How to make Professions

Level 17
Joined
Jun 12, 2007
Messages
1,261

What are we going to make?


To put it simple I'm going to explain how to make a profession inside a wc3 map using variables and items.
In this tutorial I will give you an example for the profession: smithing.
It's not very easy but if you read this [How-To] good you'll be able to make your professions in no time.
Also, this is MPI not MUI, this means that only one unit per player can use it at a time.

You can use this in for example; RPG maps or LoaP maps, be creative!
This will need a lot of triggering and take a lot of time so be prepared.

You might also see that most parts have been hidden, this is to reduce the size and give a better view of this tutorial.

_______________________________________

Creating the Basic Profession


Basic Knowledge


You need to know how to edit objects like making spells and items.
You need to know the basics about using variables with an array.
And of course you need to know about making triggers.

Also, this map has been fixed of leaks, if you do not understand the custom scripts and don't know what leaks are visits this link.

Difficulty: Normal [6/10]


What do we need?


1) You need a variable for the hero that Red has. (Unit Variable)
- I will name it PlayerHero, it needs to be an array because we want it to work for multiple players.
- This variable will store a unit for us (the hero you will use in your map) so we can use it later inside the actual profession trigger.

2) You need a variable that keeps track of the professions current level. (Integer Variable)
- I will name it Smithing and it must be an array of course.
- You have to put the starting value to 1.
- This will keep track of the current level of a players profession, we need this because some items are very hard to make and need a higher level.
- It will be part of a formula that will increase the chance that it succeeds.

3) A variable to store a real, this real variable needs to be an array as well.
- I will name it ProfessionRoll as the name of this real variable.
- The random number this variable will store is to create a chance to fail or succeed.

4) You need a dummy spell to start the whole thing, I based it of channel.
- Set the cool down at 15 sec! Of course it takes some time before the guy can start again but this is so the triggers wont collide.
- I removed all art but you can keep/change it if you want.
- You need to make it visible at "Data - Options".
- It should target nothing you can edit this at "Data - Target Type - Instant (No Target)".
- It should not disable other abilities at "Data - Disable Other Abilities - False"

5) Alot of dummy items, I devided them into two categories: tool items and material items.
- For smithing I make a dummy item that's called; 'Tools: Hammer'.
- A tool item will never disapear, it can be used multiple times to create stuf.
- A material item will be used as the ingredients for the item (a shield or something) you want the profession to make.
- When 'PlayerHero' has this item in slot 1 and has the required material items in the proper slots and has the required level and hits the spell: action. The material items will vanish and the item he wants to make with this profession will appear. (The tool will stay aswell.)

For this tutorial I want you to make these dummy items:
- Tools: Hammer
- Iron Ore
- Wood
(You can also decide it for yourself who what and where, this is just an example.)


The Triggers


To start with we need a trigger to put that PlayerHero variable assigned to the hero of the proper player.
You can do this when that hero is trained for the first time as an example.
(Take note, only one hero per player!)

  • PlayerHero
    • Events
      • Unit - A unit Finishes training a unit
    • Conditions
      • ((Trained unit) is A Hero) Equal to True
    • Actions
      • Set PlayerHero[(Player number of (Owner of (Trained unit)))] = (Trained unit)
That one is easy, is it not?
Let's move to the second trigger, this is a very big trigger but once you made it you can base all other profession triggers of it by editing some values, I will explain this later.
This is a beast! Take a look first, lets tame it after you took a good look.

This one will make a Torn Shield.

  • Torn Shield
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Action
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 1)) Equal to Tools: Hammer
          • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 2)) Equal to Iron Ore
          • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 3)) Equal to Wood
        • Then - Actions
          • Set ProfessionRoll[(Player number of (Owner of (Casting unit)))] = (Random real number between 0.00 and 100.00)
          • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
          • Floating Text - Create floating text that reads You try to create a... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
          • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
          • Wait 5.00 seconds
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ProfessionRoll[(Player number of (Owner of (Casting unit)))] Less than or equal to (60.00 + (Real(Smithing[(Player number of (Owner of (Casting unit)))])))
              • Smithing[(Player number of (Owner of (Casting unit)))] Greater than or equal to 1
            • Then - Actions
              • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 2)
              • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 3)
              • Hero - Create Torn Shield and give it to PlayerHero[(Player number of (Owner of (Casting unit)))]
              • Set Smithing[(Player number of (Owner of (Casting unit)))] = (Smithing[(Player number of (Owner of (Casting unit)))] + 1)
              • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
              • Floating Text - Create floating text that reads Succes! at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
              • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
            • Else - Actions
              • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 2)
              • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 3)
              • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
              • Floating Text - Create floating text that reads Failed... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
              • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
        • Else - Actions
Once you understand how it works it's pretty easy, lets tame this beast!


Taming the Trigger


Here I will explain to you what each part of the trigger does and what u need to edit for different recipes.

Lets start with event and condition first, this part is still easy!

  • Torn Shield
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Action
So basically, a unit casts the ability; action.
This will start the trigger! Now lets check the condition of the first If/Then/Else action!

  • Torn Shield
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 1)) Equal to Tools: Hammer
        • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 2)) Equal to Iron Ore
        • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 3)) Equal to Wood
First thing you will notice is the array, I use [(Player number of (Owner of (Casting unit)))] as the array, this will fill in the number of the owner of the hero that casts the spell.
So if the casting unit belongs to player1red it will fill in a 1.
I will use this array for all variables so keep that in mind.

This part will check if the hero that casts the spell has the proper items in their proper slots!
You need to be sure that each recipe you make for the profession has a different order of items!
Now when does not have the proper items, nothing will happen!
You can add more items by adding slots.
This part: 'slot 1)) Equal to Tools: Hammer' will say what slot needs to contain what item.

Lets check the then action of this if/then/else action! (This if/then/else action does not have a else action!)

  • Torn Shield
    • Then - Actions
      • Set ProfessionRoll[(Player number of (Owner of (Casting unit)))] = (Random real number between 0.00 and 100.00)
      • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
      • Floating Text - Create floating text that reads You try to create a... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
      • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
      • Wait 5.00 seconds
So first you see that ProfessionRoll will store a random real between 0.00 and 100.00 this is in order to create a chance to either succeed or fail later in this trigger.
I am aware that u don't need to store this however I'm more comfortable with it.

Second it will create a floating text above the hero that uses the spell telling him what he is trying to do, in this case it will tell him that he is trying to make a torn shield.
U can edit the text it will show depending on what item you are trying to make in the trigger.
The other floating text actions will determine how long it stay, when it will fade away, and how the velocity goes, I suggest using the values mentioned in the trigger.

The 5 second wait is there because it takes some time to create the item.

Now there is a second If/Then/Else action, lets take a look at its conditions.

  • Torn Shield
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ProfessionRoll[(Player number of (Owner of (Casting unit)))] Less than or equal to (60.00 + (Real(Smithing[(Player number of (Owner of (Casting unit)))])))
      • Smithing[(Player number of (Owner of (Casting unit)))] Greater than or equal to 1
This will check for 2 small yet very important things.
The first thing will be the chance that it has succeeded, you know we ordered the 'If/Then/Else Action I; Then Action' to create a random real number between 0.00 and 100.00? Well here we use it!
If the random real number it created is below 60 + the level of his profession it will succeed.
This means that the higher it's level is the higher the chance is it will succeed!
You can edit the 60 in this trigger to create lower or higher chances for the recipe.

The second thing it will check is the level of the profession. In this case if it's level is above 1 (and that's the default level) it will succeed. If his profession level is to low it will fail by default.

Example: You want the recipe: Golden Sword to have a initial 20% chance to succeed and the minimal smithing level you need for it is 50 you will need the following values:

  • Torn Shield
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
    • If - Conditions
      • ProfessionRoll[(Player number of (Owner of (Casting unit)))] Less than or equal to (-30.00 + (Real(Smithing[(Player number of (Owner of (Casting unit)))])))
      • Smithing[(Player number of (Owner of (Casting unit)))] Greater than or equal to 50
Why -30.00? This is simple, you take the % chance you want it to succeed, that will be 20.
You reduce it with the minimal level you need for it to create, that will be 50.
Now to check what value it needs: 20.00 - 50.00 = -30.00 get it?


Lets move on to the then action of this action.
Everything you see here will happen when the player that uses the profession has the required profession level for it, and has succeeded with the chance we created earlier.

  • Then - Actions
    • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 2)
    • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 3)
    • Hero - Create Torn Shield and give it to PlayerHero[(Player number of (Owner of (Casting unit)))]
    • Set Smithing[(Player number of (Owner of (Casting unit)))] = (Smithing[(Player number of (Owner of (Casting unit)))] + 1)
    • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
    • Floating Text - Create floating text that reads Succes! at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
    • Floating Text - Change (Last created floating text): Disable permanence
    • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
    • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
    • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
    • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
Oke, first it will remove the material items, you have to check what items you want to remove so take a good look at the condition of the first If/Then/Else action.

  • Torn Shield
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 1)) Equal to Tools: Hammer
        • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 2)) Equal to Iron Ore
        • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 3)) Equal to Wood
After that it will create the item the player wanted to make at his hero, we know there will be space because we remove the material items. Take note I use the variable PlayerHero to create the item at.
After this we increase the level of the profession by one. You can edit the level it will increase with, but for lower recipes I recommend sticking to 1.

It will also show a useful floating text at the unit of the player telling him is succeeded.
This part is basically the same as the first floating text, the only thing that's different its the color and the text it will show.

Lets move to the last part of this trigger, it's very easy.

  • Torn Shield
    • Else - Actions
      • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 2)
      • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 3)
      • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
      • Floating Text - Create floating text that reads Failed... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
      • Floating Text - Change (Last created floating text): Disable permanence
      • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
      • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
      • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
      • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
    • Else - Actions
It's basically the same like the then action but with a few changes.
- It will not create a item.
- It will not increase the level of the profession.
- The text message has a different color and says that it failed.

Now we have tamed this beast of a trigger! But we are not done yet!
We want players to check on their current profession levels so they know if they can create the item or not but this is very easy.


Level Check Command



Of course we also need to tell the people how high their current profession levels are.
We do this with this simple trigger:

  • Showing Levels
    • Events
      • Player - Player 1 (Red) types a chat message containing -profession as An exact match
      • Player - Player 2 (Blue) types a chat message containing -profession as An exact match
      • Player - Player 3 (Teal) types a chat message containing -profession as An exact match
      • Player - Player 4 (Purple) types a chat message containing -profession as An exact match
      • Player - Player 5 (Yellow) types a chat message containing -profession as An exact match
      • Player - Player 6 (Orange) types a chat message containing -profession as An exact match
      • Player - Player 7 (Green) types a chat message containing -profession as An exact match
      • Player - Player 8 (Pink) types a chat message containing -profession as An exact match
    • Conditions
    • Actions
      • Game - Display to (Player group((Triggering player))) the text: (Smithing Level: + (String(Smithing[(Player number of (Triggering player))])))
Basically what it does is telling the player typing: -profession the levels of his professions. Currently it only does this for player 1 through 8, just add the events with other players if you need them.

You can also just add more lines, just change the integer and text of the message for example:

  • Display to (Player group((Triggering player))) the text: (Alchemy Level: + (String(Alchemy[(Player number of (Triggering player))])))
You can also show the integers in a multiboard if you like, read a tutorial about multiboard to show you how to create one. Be creative!


_______________________________________

Limitations (Optional)


This will show you some things you can do with this trigger, for example adding limits.
This part however is not included in the first sample map, there is however a copy attached that has it with limits.

Basics


You don't want people to have all professions?
Well they can decide and purchase them for themselves.

We only need to adjust the profession triggers a bit, I suggest you read the first part if you want to learn about the trigger I'm using.

To start we will need to decide how people will be able to take a profession. Lets do it by buying an item!

I'll call this item: Learn Smithing
This is just a dummy item that does nothing but start a trigger we will make.
You will have to create one for each profession you'll have.

We also need some variables.
First make a boolean for each profession (and add an array ofcourse).
As an example we will use ProfessionSmithing, it's false by default.
We need this boolean to see if the player has learned the profession.

Now we make a integer variable as an array aswell.
I'm calling it: LearnedProfessions, we will use this to see how many profession the player has learned. Lets make it so that the player can only learn 2 professions for now.
Remember to set it at 0. (Default.)


Trigger: Learning a Profession


Now we have done the basics we will need to create a trigger that will activate when u learn a profession!
This will need a small but very important trigger. Lets take a look at it.
  • Buying Smithing
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Learn Smithing
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LearnedProfessions[(Player number of (Owner of (Triggering unit)))] Less than 2
          • ProfessionSmithing[(Player number of (Owner of (Triggering unit)))] Equal to False
        • Then - Actions
          • Item - Remove (Item being manipulated)
          • Set LearnedProfessions[(Player number of (Owner of (Triggering unit)))] = (LearnedProfessions[(Player number of (Owner of (Triggering unit)))] + 1)
          • Set ProfessionSmithing[(Player number of (Owner of (Triggering unit)))] = True
          • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
          • Floating Text - Create floating text that reads You have learned th... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
          • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
        • Else - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • LearnedProfessions[(Player number of (Owner of (Triggering unit)))] Less than 2
              • ProfessionSmithing[(Player number of (Owner of (Triggering unit)))] Equal to True
            • Then - Actions
              • Item - Remove (Item being manipulated)
              • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
              • Floating Text - Create floating text that reads You have already le... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
              • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
            • Else - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • LearnedProfessions[(Player number of (Owner of (Triggering unit)))] Equal to 2
                • Then - Actions
                  • Item - Remove (Item being manipulated)
                  • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
                  • Floating Text - Create floating text that reads You have reached th... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                  • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
                  • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
                  • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
                • Else - Actions
Looks complicated huh? Well it's not that hard.
Lets start by cutting this trigger in small bits.
I can already tell you this: "Take a good look at the conditions!"

  • Buying Profession
    • Events
      • Unit - A unit Acquires an item
    • Conditions
      • (Item-type of (Item being manipulated)) Equal to Learn Smithing
Basicly when a unit gains the item that will learn the profession the trigger will be started.

  • Buying Profession
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LearnedProfessions[(Player number of (Owner of (Triggering unit)))] Less than 2
          • ProfessionSmithing[(Player number of (Owner of (Triggering unit)))] Equal to False
        • Then - Actions
          • Item - Remove (Item being manipulated)
          • Set LearnedProfessions[(Player number of (Owner of (Triggering unit)))] = (LearnedProfessions[(Player number of (Owner of (Triggering unit)))] + 1)
          • Set ProfessionSmithing[(Player number of (Owner of (Triggering unit)))] = True
          • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
          • Floating Text - Create floating text that reads You have learned th... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
          • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
Now if the player has not learned 2 professions and has not learned the profession Smithing he will gain that profession by setting the boolean ProfessionSmithing to true for the owner of the buying unit.
It will also add 1 point to the amount of professions that the player has learned. When this reaches 2 he will not be able to learn more professions.
It will also create a nice floating tekst telling that he has learned a profession.

But what if this is not true? Lets look at the 3th part.

  • Buying Profession
  • Else - Actions
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • LearnedProfessions[(Player number of (Owner of (Triggering unit)))] Less than 2
        • ProfessionSmithing[(Player number of (Owner of (Triggering unit)))] Equal to True
      • Then - Actions
        • Item - Remove (Item being manipulated)
        • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
        • Floating Text - Create floating text that reads You have already le... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
        • Floating Text - Change (Last created floating text): Disable permanence
        • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
        • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
        • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
        • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
Oke, this is pretty easy, isn't it?
This will happen when he has already learned the profession Smithing.
It will only remove the dummy item, and will tell the player that he has already learned this profession.

But what if the player already has 2 professions?

  • Buying Profession
    • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • LearnedProfessions[(Player number of (Owner of (Triggering unit)))] Equal to 2
        • Then - Actions
          • Item - Remove (Item being manipulated)
          • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
          • Floating Text - Create floating text that reads You have reached th... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
          • Floating Text - Change (Last created floating text): Disable permanence
          • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
          • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
          • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
          • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
        • Else - Actions
That's no to hard, he will just get a different message that he can't learn more professions.


Trigger: Editing the Profession Trigger


Now that we have done this we need to add an if/then/else at the start of the profession trigger we made earlier in this tutorial.
That condition for the if/then/else is:
  • ProfessionSmithing[(Player number of (Owner of (Triggering unit)))] Equal to True
In the end the trigger will look like this.

  • Torn Shield w Limits
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • (Ability being cast) Equal to Action
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • ProfessionSmithing[(Player number of (Owner of (Triggering unit)))] Equal to True
        • Then - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 1)) Equal to Tools: Hammer
              • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 2)) Equal to Iron Ore
              • (Item-type of (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 3)) Equal to Wood
            • Then - Actions
              • Set ProfessionRoll[(Player number of (Owner of (Casting unit)))] = (Random real number between 0.00 and 100.00)
              • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
              • Floating Text - Create floating text that reads You try to create a... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 100.00%, 100.00%), and 0.00% transparency
              • Floating Text - Change (Last created floating text): Disable permanence
              • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
              • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
              • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
              • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
              • Wait 5.00 seconds
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • ProfessionRoll[(Player number of (Owner of (Casting unit)))] Less than or equal to (60.00 + (Real(Smithing[(Player number of (Owner of (Casting unit)))])))
                  • Smithing[(Player number of (Owner of (Casting unit)))] Greater than or equal to 1
                • Then - Actions
                  • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 2)
                  • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 3)
                  • Hero - Create Torn Shield and give it to PlayerHero[(Player number of (Owner of (Casting unit)))]
                  • Set Smithing[(Player number of (Owner of (Casting unit)))] = (Smithing[(Player number of (Owner of (Casting unit)))] + 1)
                  • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
                  • Floating Text - Create floating text that reads Succes! at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (0.00%, 100.00%, 0.00%), and 0.00% transparency
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                  • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
                  • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
                  • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
                • Else - Actions
                  • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 2)
                  • Item - Remove (Item carried by PlayerHero[(Player number of (Owner of (Casting unit)))] in slot 3)
                  • Set PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] = (Position of (Triggering unit))
                  • Floating Text - Create floating text that reads Failed... at PlayerHeroPoint[(Player number of (Owner of (Triggering unit)))] with Z offset 0.00, using font size 10.00, color (100.00%, 0.00%, 0.00%), and 0.00% transparency
                  • Floating Text - Change (Last created floating text): Disable permanence
                  • Floating Text - Change the lifespan of (Last created floating text) to 5.00 seconds
                  • Floating Text - Change the fading age of (Last created floating text) to 0.00 seconds
                  • Floating Text - Set the velocity of (Last created floating text) to 15.00 towards 90.00 degrees
                  • Custom script: call RemoveLocation(udg_PlayerHeroPoint[GetConvertedPlayerId(GetOwningPlayer(GetTriggerUnit()))])
            • Else - Actions
        • Else - Actions
As you can see, players can only use the profession if they have learned it.
With these limits people will have to choose before picking what they want.
If they don;t have the profession, nothing will happen. Just like in the real world.

TIP: Do not add a text at the last else saying that nothing happens, there might be an other profession it has learned.
In that case it will show a floating text that nothing happens and that he is doing something, kinda stupid huh?

Be creative with these triggers! I'm sure they can be useful to you.



_______________________________________

Extra Notes


I hope you learned something useful from this tutorial.
If you have something to ask about this feel free to send me a PM or mail me at [email protected].

There is also a map attachment with these triggers to check it out!
Good luck with your maps!
 

Attachments

  • Professions with Limits [By Airandius].w3x
    34.4 KB · Views: 757
  • Professions [By Airandius].w3x
    32.3 KB · Views: 736
Last edited:
Level 17
Joined
Jun 12, 2007
Messages
1,261
Somebody actualy gave a reaction! xD
I will re-do this tutorial to make it more effecient tomorrow.
(I'm going to make the trigger to use Arrays)


And I'll also throw in a sample map! =)

Edit: Remade trigger, now having a floating text system, also it uses arrays now! + A Sample Map
 
Last edited:
Level 40
Joined
Dec 14, 2005
Messages
10,532
If you could split that monster trigger into digestible pieces with explanations in between, it would be nice.

In general, it could use some formatting tweaks as well as a spelling and grammar check. The triggers seem decent, but could use more elaboration, and have it so in between where they are written (for example, explain where to put your text when the item creation is successful).

Additionally, you don't need a variable for the roll; just randomize it after the wait.

Finally, you don't need to destroy floating texts that have fade time + lifespan + permanence disabled.
 
Level 21
Joined
Dec 9, 2007
Messages
3,096
I can call people stupid because pure iron ore is weaker than glass, even a slap can brake it in very small pieces.
Iron must be mixed with carbon to create metals that resist.
If in the mix is less than 2% carbon and more than 0.2%, then it is a steel.
If in the mix is more than 2% carbon, then it's a fonte(i can't translate the name in english...).
For making a tutorial and/or a map, you need a basic knowdlege... If you make a hammer with iron ore and wood, you will brake only the hammer...
And same for cooper...
Cooper isn't found pure in nature, it is extracted from another metal...
As bronze... Bronze is cooper+ another metal...
For example... Blizzard are IDIOTS for this! In WoW you can get bronze from ores...
But i know everybody here is smarter than blizzard, so try to fix this issue, ok?
Not all maps are Science Fiction...
Try to make a shop sell carbon... In boxes...
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Lol, it's just an example. You can use any name or item or w/e u want. (And I know that u know that.)
The main purpose is to teach people how to make a profession like systems that's easy to make.
And as far as I know it serves that purpose just fine. :p
I only need somebody to mod it.

Purplepoot was busy with that until he resigned as mod.. =(
So who's going to mod this now?
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Lol, like I said, it's an example.
It uses a spell that basically does nothing, it will only activate a trigger that checks for item combinations, and then looks for skill of corresponding profession and draws a chance.
Nothing really hard, of course you could also do fishing by making the spell target fish.

You can even make some sort of treasure hunting profession where the spell will start to dig to look for items and depending on area, skill and chance you might find something.
I made both things like this in one of my RPG's that never made it into alpha, just with this trigger and some terrain it was rotting on my disk.

I thought, perhaps I can help people by showing them an example.
Other tutorials don't show people the wild extend of possibilities either, like I said it's an example for people to work from.
So ther eis no real need for fishing and alchemy and digging examples.

Still a good suggestion, so thanks for that. But I'm happy as it is, since when u give people more examples they wont think for themselves.
I'm going to implant this trigger in a update of Ziggurat Takeover.

As we speak I'm updating it, actually killing it and rebuilding it from it's rubble.

(Off topic) It will have new classes all with custom spells, it will have a stack system for potions, more items, it will have more game-play options and it will have professions. xD
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
I would aprrove this tutorial...
I think it is kinda...too...weird to be in lack of GUI tutorials moderators...
I will make a tutorial about basic knowdledge required for modding warcraft...

Thanks, for approving (it's the thought that counts =:D) and u can do w/e u want with the stuff I told in the tut, cause that is the reason I made it.
Cause maps really lack professions that are cool. :p

EDIT:

lol, if ralle needs a GUI tut moderator, I'm just the man! I know all about gui and fixing leaks. :p
Still there is a problem.. can't approve my own tutorial.. xD
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Yay! Maybe you can for fill my dream of having a good map with god quality professions! ;D

I might add simple stuff like:
- Digging (for resources xD)
- Smithing (uses resources to create weaponry)
- Alchemy (uses herbs and resources for potions)
- Constructon (uses resources to build buildings)
 
Level 17
Joined
Jun 12, 2007
Messages
1,261
Yet another bumb to see if it gets approved by the non existing gui-tut moderators.

On a other note, I update the tutorial.
- It now uses headers.
- I have fixed the point leaks in the show floating message part of the actions.
- Have provided a new sample map for the limit (optional) section of my profession tutorial.
- Fixed the few mistakes I made in vocabulary that I could find.

Please give me some feedback. ^^
 
Level 4
Joined
Sep 24, 2007
Messages
67
Thanks for this guide, it helped me with some stuff I was doing, also I finally learned how to make floating text that moves and disappears.
 
Level 8
Joined
Nov 29, 2008
Messages
462
at the moment i don´t have time for adding professions in my orpg but later :) i think this will helps a lot!
 
Level 3
Joined
Jun 22, 2009
Messages
18
Unit - A unit Begins casting an ability

It's better to use Unit - A unit starts the effect of an ability (I think that's what it's called; of not, it's something like that) because otherwise users can abuse it and move away and it won't start the cooldown and everything will get messed up.
 
Level 1
Joined
Jul 22, 2009
Messages
4
i found this trigger very confusing and ended up not working,, probably my mistake..

also i didnt understand all that custom script work so i juts ctrl c ctrl v d it
 
Top