1. Updated Resource Submission Rules: All model & skin resource submissions must now include an in-game screenshot. This is to help speed up the moderation process and to show how the model and/or texture looks like from the in-game camera.
    Dismiss Notice
  2. DID YOU KNOW - That you can unlock new rank icons by posting on the forums or winning contests? Click here to customize your rank or read our User Rank Policy to see a list of ranks that you can unlock. Have you won a contest and still havn't received your rank award? Then please contact the administration.
    Dismiss Notice
  3. We have recently started the 16th edition of the Mini Mapping Contest. The theme is mini RPG. Do check it out and have fun.
    Dismiss Notice
  4. Choose your ride to damnation in the 5th Special Effect Contest Poll.
    Dismiss Notice
  5. The winners of the 13th Techtree Contest have been announced!
    Dismiss Notice
  6. The 13th Music Contest Poll is up! Vote for the best tracks in this symphony of frost and flame.
    Dismiss Notice
  7. Race against the odds and Reforge, Don't Refund. The 14th Techtree Contest has begun!
    Dismiss Notice
  8. Check out the Staff job openings thread.
    Dismiss Notice
Dismiss Notice
60,000 passwords have been reset on July 8, 2019. If you cannot login, read this.

How to make Professions

Discussion in 'Trigger (GUI) Editor Tutorials' started by Airandius, Sep 14, 2008.

  1. Airandius

    Airandius

    Joined:
    Jun 12, 2007
    Messages:
    1,238
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Tutorials:
    1
    Resources:
    3

    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



    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?



    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



    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!)

    Trigger: PlayerHero
    • 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.

    Trigger: 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



    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!

    Event and Condition
    • 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!

    If/Then/Else Action I; Condition
    • 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!)

    If/Then/Else Action I; Then 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.

    If/Then/Else Action II; Condition
    • 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.

    Sample
    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:

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

    Trigger: Torn Shield
    • 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.

    If/Then/Else Action I; Condition
    • 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.

    If/Then Else Action II; Else Action
    • 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



    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



    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



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

    Trigger Part 1
    • 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.

    Trigger Part 2
    • 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.

    Trigger Part 3
    • 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?

    Trigger Part 4
    • 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



    Editing
    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 Trigger /w Limit
    • 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 airandius_garcia@hotmail.com.

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

    Attached Files:

    Last edited: Jan 8, 2009
  2. Dieseldodge

    Dieseldodge

    Joined:
    Aug 23, 2008
    Messages:
    193
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Don't you have a sample map? :sad:
     
  3. Airandius

    Airandius

    Joined:
    Jun 12, 2007
    Messages:
    1,238
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Tutorials:
    1
    Resources:
    3
    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: Sep 22, 2008
  4. Dieseldodge

    Dieseldodge

    Joined:
    Aug 23, 2008
    Messages:
    193
    Resources:
    1
    Maps:
    1
    Resources:
    1
    Thanks then!
     
  5. PurplePoot

    PurplePoot

    Joined:
    Dec 14, 2005
    Messages:
    11,161
    Resources:
    3
    Maps:
    1
    Spells:
    1
    Tutorials:
    1
    Resources:
    3
    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.
     
  6. Airandius

    Airandius

    Joined:
    Jun 12, 2007
    Messages:
    1,238
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Tutorials:
    1
    Resources:
    3
    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! ^^
     
  7. TheBlooddancer

    TheBlooddancer

    Joined:
    Jun 24, 2008
    Messages:
    2,908
    Resources:
    0
    Resources:
    0
    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:
    Ohh, and heres your Cookie-
    *Gives Cookie*
     
  8. Oziris

    Oziris

    Joined:
    Oct 14, 2006
    Messages:
    4,109
    Resources:
    3
    Icons:
    1
    StarCraft II Resources:
    1
    Tutorials:
    1
    Resources:
    3
    Really like this tutorial!
     
  9. Airandius

    Airandius

    Joined:
    Jun 12, 2007
    Messages:
    1,238
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Tutorials:
    1
    Resources:
    3
    Thanks, however I'm going to reduce the difficulty by explaining the trigger better as many people suggested.
    (Taming the beast.. xD)
     
  10. TheBlooddancer

    TheBlooddancer

    Joined:
    Jun 24, 2008
    Messages:
    2,908
    Resources:
    0
    Resources:
    0
    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?
     
  11. Airandius

    Airandius

    Joined:
    Jun 12, 2007
    Messages:
    1,238
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Tutorials:
    1
    Resources:
    3
    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.
     
  12. Airandius

    Airandius

    Joined:
    Jun 12, 2007
    Messages:
    1,238
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Tutorials:
    1
    Resources:
    3
    ~BUMP~

    Isn't it about time somebody moderated this?
     
  13. Vercas

    Vercas

    Joined:
    Dec 9, 2007
    Messages:
    2,604
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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...
     
  14. TheBlooddancer

    TheBlooddancer

    Joined:
    Jun 24, 2008
    Messages:
    2,908
    Resources:
    0
    Resources:
    0
    Vercas, you cant get bronze from ores in WoW? Can you? If, then its really stupid.
     
  15. Vercas

    Vercas

    Joined:
    Dec 9, 2007
    Messages:
    2,604
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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...
     
  16. Airandius

    Airandius

    Joined:
    Jun 12, 2007
    Messages:
    1,238
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Tutorials:
    1
    Resources:
    3
    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?
     
  17. TheBlooddancer

    TheBlooddancer

    Joined:
    Jun 24, 2008
    Messages:
    2,908
    Resources:
    0
    Resources:
    0
    I am >:)
    No not really, ill ask around in chat.
     
  18. Vercas

    Vercas

    Joined:
    Dec 9, 2007
    Messages:
    2,604
    Resources:
    1
    Spells:
    1
    Resources:
    1
    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
     
  19. Airandius

    Airandius

    Joined:
    Jun 12, 2007
    Messages:
    1,238
    Resources:
    3
    Icons:
    1
    Maps:
    1
    Tutorials:
    1
    Resources:
    3
    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
     
  20. Vercas

    Vercas

    Joined:
    Dec 9, 2007
    Messages:
    2,604
    Resources:
    1
    Spells:
    1
    Resources:
    1
    Fast answer...eh?
    And ok, i will have fun alone with the system =3