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. Don’t forget to sign up for the Hive Cup. There’s a 555 EUR prize pool. Sign up now!
    Dismiss Notice
  4. The Hive Workshop Cup contest results have been announced! See the maps that'll be featured in the Hive Workshop Cup tournament!
    Dismiss Notice
  5. Units have been turned into heroes in our latest Icon Contest! Vote for the best icon set at the Icon Contest #18 Poll!
    Dismiss Notice
  6. The poll for Hive's 12th Concept Art Contest is up! Go cast your vote for your favourite genie!
    Dismiss Notice
  7. The raddest synthwave tracks were chosen - Check out our Music Contest #12 - Results and congratulate the winners!
    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.

[Trigger] Door Key System

Discussion in 'Triggers & Scripts' started by Kunfury, Aug 14, 2012.

  1. Kunfury

    Kunfury

    Joined:
    May 26, 2010
    Messages:
    211
    Resources:
    0
    Resources:
    0
    Ok then how will it tell which key is which if it is just checking for the type of item?
     
  2. Spartipilo

    Spartipilo

    Joined:
    Jul 14, 2011
    Messages:
    3,190
    Resources:
    0
    Resources:
    0
    Let me quote myself
    I mean, Have several different Key items. Not several of the same item, but several item-type of keys.
     
  3. Kunfury

    Kunfury

    Joined:
    May 26, 2010
    Messages:
    211
    Resources:
    0
    Resources:
    0
  4. gorillabull

    gorillabull

    Joined:
    Jul 17, 2011
    Messages:
    1,368
    Resources:
    2
    Spells:
    2
    Resources:
    2
    dude, kunfury i think you should check out a few gui tutorials, spartipilo gave you everything you need and explained how to use it, and its only 10 lines of code ..
     
  5. Spartipilo

    Spartipilo

    Joined:
    Jul 14, 2011
    Messages:
    3,190
    Resources:
    0
    Resources:
    0
    The difference between Item-Type and Item is the same difference than Unit-Types have with Units.

    Footman is a Unit-Type, while (Triggering Unit) is a unit.

    Item-Type means Helm of Dominator, Claws of Attack+12, Claws of Attack+6, etc. All these are "Item-Types"

    What You need to do is create Different Item-Types, each one as a "Key". Then on map initialization, using an Item-Type variable, you set Key[1] = Key1, and so on.
     
  6. Kunfury

    Kunfury

    Joined:
    May 26, 2010
    Messages:
    211
    Resources:
    0
    Resources:
    0
    I know the difference between those, But wouldn't that need multiple different items? That just seems like a bit much to me.
     
  7. Spartipilo

    Spartipilo

    Joined:
    Jul 14, 2011
    Messages:
    3,190
    Resources:
    0
    Resources:
    0
    If you have 400 houses, yes, it may be a bit too much... But I doubt you do.. right? :p
     
  8. Kunfury

    Kunfury

    Joined:
    May 26, 2010
    Messages:
    211
    Resources:
    0
    Resources:
    0
    Fair Point, so this truly is the best way to do it?
     
  9. Spartipilo

    Spartipilo

    Joined:
    Jul 14, 2011
    Messages:
    3,190
    Resources:
    0
    Resources:
    0
    Sort of... You can also use Hashtables.

    You have to create 1Key and 1OpenDoor ability for each door.
    Then you add Each Key, it's corresponding "Open Door" ability
    On map initialization you save the HandleID of each door on it's corresponding Ability (call SaveInteger(udg_Hashtable, AbilityID, 0, DestructibleID).

    When you use the Item Ability On the Destructible, you Load 0 of AbilityID and compare it with the target destructible of ability being cast, if it match, open the door.

    The Item is just to hold the correct ability.

    There are many many ways of doing this... Using the Hashtable or using the Arrays are the best I can think of.