Level 17

# 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!
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.
• 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!"

• 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.

• 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.

• 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?

• 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.

There is also a map attachment with these triggers to check it out!

#### Attachments

• Professions with Limits [By Airandius].w3x
34.4 KB · Views: 757
• Professions [By Airandius].w3x
32.3 KB · Views: 736
Last edited:

#### Airandius

Level 17
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:

#### PurplePoot

Level 40
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.

#### Airandius

Level 17
Oke I'll work on that.

- Remove the destroy floating tekst.
- Add some comment inside the massif trigger to explain it better.
- I'll look for the mistakes I made inside the grammer.
- I'll split the trigger in parts, so people can take a better look at it.

Thanks for taking a look! ^^

#### TheBlooddancer

Level 22
Medium-Known
If you had released this when ive started, it would all be alot easier.

You should try to explain a bit of the Variables your Using.

Edit:

#### Airandius

Level 17
Thanks, however I'm going to reduce the difficulty by explaining the trigger better as many people suggested.
(Taming the beast.. xD)

#### TheBlooddancer

Level 22
Something is all-wrong with that map (Or my world editor)

I tried the map, as you released it, and it worked as it should.
Now when i tried it again, i get stuck everytime i use "action".

Its kinda wierd?
Have you changed the map, or refined it in any way?

#### Airandius

Level 17
Yes, I did change the map, but perhaps I made a error somewhere. I'll check it out.

EDIT: It seems I accidentely uploaded the old map of my tutorial, it's fixed now.

#### Airandius

Level 17
~BUMP~

Isn't it about time somebody moderated this?

#### Vercas

Level 21
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...

#### TheBlooddancer

Level 22
Vercas, you cant get bronze from ores in WoW? Can you? If, then its really stupid.

#### Vercas

Level 21
Well i found bronze ore in WoW...
and a LOT of cooper ore!
Cooper, as it writes in books and as i know, is extracted from another metal...

#### Airandius

Level 17
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.
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?

#### TheBlooddancer

Level 22
I am >
No not really, ill ask around in chat.

#### Vercas

Level 21
me =D
I can improve the testing map a lot, and include more systems as alchemy and fishing =D
And you can analyze my way, and add it to the tutorial =D

#### Airandius

Level 17
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

#### Vercas

Level 21
And ok, i will have fun alone with the system =3

#### TheBlooddancer

Level 22
I am still trying to search in chat, but they cant approve Gui Tutorials.
Actually, Gui-Tut-mods is not existing right now. Ralle is searching.

#### Vercas

Level 21
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...

#### Airandius

Level 17
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 =) 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.

EDIT:

lol, if ralle needs a GUI tut moderator, I'm just the man! I know all about gui and fixing leaks.
Still there is a problem.. can't approve my own tutorial.. xD

#### Vercas

Level 21
Well my map really lacks professions now, but soon i will have every proffesion i can imaginate...
Right now i can work only in weekend!

#### Airandius

Level 17
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 22

#### TheBlooddancer

Level 22
Nao = Pronounced Now!

#### Airandius

Level 17
Lol, i meant, add them to my map. xD
Not the tutorial, but sure, I might CnP them to a map called examples for people to take a look. But I'll do then when this little bugga gets approved. xD

#### TheBlooddancer

Level 22
Yah. Understood ^^

Edit: Cause everybody now is Minimods (Or atleast have their powers) I APPROVE!

Last edited:

#### Airandius

Level 17
I arez posting a bumb so that the moderators that don't exist yet will approve this lol.

#### TheBlooddancer

Level 22
Well, okay

Hive really needs mod for this-

#### Airandius

Level 17
Yet another bumb to see if it gets approved by the non existing gui-tut moderators.

On a other note, I update the tutorial.
- 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. ^^

#### HumanSlayerV

Level 4
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.

#### Slaydon

Level 20
Why do you need a Ore in only the second slot and wood in the third slot to make? you cant have Hammer, wood, ore, but Hammer, ore, wood, but Nice

#### Airandius

Level 17
It's just an example, don't take it serious.
And I use this way because you can make more combinations with less items.

A + B + C = D
but
A + C + D = E

You can always edit it.

#### Nurga

Level 8
at the moment i don´t have time for adding professions in my orpg but later i think this will helps a lot!

#### Rainbow Evil

Level 9
I will!
Just kidding,nice tut

+ rep

#### dOT145

Level 3
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
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

#### indestructible

Level 4
• portal
• event unit 001 enters region 00433
• condition
• action

#### indestructible

Level 4
sorry just delete the one over

#### Dark hamster

Level 3
Very usefull, somehow doesnt work very well for me but ill keep trying.

Replies
1
Views
702
Replies
4
Views
620
[Trigger] Weapon Limit
Replies
8
Views
1K
Replies
0
Views
472
Replies
1
Views
866