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.

Mixing type spell?

Discussion in 'Triggers & Scripts' started by orcfan32, Mar 12, 2005.

  1. orcfan32

    orcfan32

    Joined:
    Jul 3, 2004
    Messages:
    337
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    I am making a spell that when cast, there is a trigger that takes the items in the unit's inventory and based on what items it has, it makes different items. I.E. Steel + Steel = Steel Sword. It's almost like a weaponsmith. I can't figure out how do detect the correct items though. I have the event and conditions. In the actions, I am planning to use if then else code. The if will see if the hero has the items or not. After that, I can do the rest. A little help here? :roll:

    EDIT: I don't want the items to have to be in specific slots of the hero!!
     
  2. Daelin

    Daelin

    Joined:
    Jul 20, 2004
    Messages:
    3,111
    Resources:
    41
    Models:
    22
    Icons:
    3
    Tutorials:
    16
    Resources:
    41
    You will have to check the items slot by slot. You can however store all the six items into an array variable and then based on the variable try to get the right combo. Got it?

    ~Daelin
     
  3. orcfan32

    orcfan32

    Joined:
    Jul 3, 2004
    Messages:
    337
    Resources:
    1
    Tutorials:
    1
    Resources:
    1
    I think that another way I could do it would be a loop.

    I have never used an array variable. The only thing I know about it is that it stores multiple data. Can you please give me a quick rundown of how they work? :?
     
  4. Daelin

    Daelin

    Joined:
    Jul 20, 2004
    Messages:
    3,111
    Resources:
    41
    Models:
    22
    Icons:
    3
    Tutorials:
    16
    Resources:
    41
    It's simple... You can store more than one thing under a variable. In your case, you can store more than 1 item into a variable.

    The trick about arrays is that they have a parameter. Each array variable looks like this: Variable_name[parameter]. To store stuff into variables and to get them:

    unit[1]=footman
    unit[2]=archer
    unit[3]=ghoul

    That's just an example. Now, if you want to remove the footman after a couple of seconds you will have something like:

    Wait 1.00 seconds
    Remove Unit unit[1].

    ~Daelin