Cupboard open / closed

  • #20, by JorkzFriday, 24. April 2020, 15:19 4 years ago
    Another sorry but... another question : how to access the script to see how the thing is built?

    Maybe this will help me a little more

    Newbie

    90 Posts


  • #21, by NigecFriday, 24. April 2020, 20:51 4 years ago
    why not share a scene that's in context, with your inventory and comand/cursors and how you are setting thing up.. we are just going around in circles.. my example should of covered most things apart from a character/waypoints

    Key Killer

    629 Posts

  • #22, by MachtnixFriday, 24. April 2020, 21:20 4 years ago
    A variable ist global. If you set x==2, x will be 2 in the whole game - as long you don't change it. The problem isn't where you do this but when you do this. It's important to think about which action can change the values and what happens before and after? Because you can use every object, every location, every scene  to set a value or a condition it could be difficult to keep the overview. You need a lot of discipline. 

    I remember: you have a cupboard with an item in it. You need three pictures (objects) on your scene: cupboard closed, cupboard open with item to see and cupboard open without item. Don't think the item you see must be the same you take! It's only a picture to make the player think it is! So you need the single item too for putting into the inventory.

    The value „cupboard-open“ may be 0 at start. The object is „cupboard closed“. If the character clicks on the cupboard, the value „cupboard-open“ changes to 1 (open is true). At the same time the object switches from a close Cupboard to an opened cupboard with item in there. On this new object you can choose to click for an action. After clicking the value „cupboard-open“ changes to 2, the object will change to a picture of a cupboard without item, the object is now „finished“. You have all done what you want to do. The cupboard will be open for the rest of the game. You can deactive them now, but the better way is to make a text by clicking: „You have already put the item“. Of course you need the same item to put into your item-bag. So long your value „cupboard-open“ will be 2 nothing else happens with the open cupboard. You never change the value from 2 to 0 back.

    You can request „if cupboard-open == 1 then write some text else do this.“ It's almost better to control your situation. Not in every case but sometimes you get a condition it won't never be true and you have a „hang-on“.

    Yes, it sounds complicated.  But it's only getting used to.

    After all: it's only ONE way. You can of course put the item as an extra object into the cupboard. But in both cases you need the item on the scene and the same item for the bag. You need the item twice.

    Sorry, but it is VERY VERY exhausting to write this in English understandable...

    Thread Captain

    1097 Posts

  • #23, by JorkzSaturday, 25. April 2020, 20:06 4 years ago
    So if I understand correctly there's no way to keep closing and opening the cupboard (empty) if the box is no longer there?... Even if I create a value for my box and apply the same principle?

    Newbie

    90 Posts

  • #24, by MachtnixSaturday, 25. April 2020, 21:26 4 years ago
    Of course it's possible. It depends on your goal. You have two questions: cupboard open or close, and item in there or not? You can split them and both ways have their own "values" and their own requests. I don't know your goal - I thought you only want to take the item and that's it...
    If the character should open and close the cupboard without item you need four cases. 
    It's ONE way indeed. I think (my opinion), it's better to work with four values than to work with combined conditions... 

    You can ask "if 0pen==1 then show object open-cupboard" (value). But you can ask "if open==true then show object open-cupboard" (condition). In both cases you have two questions one after another: first asking if cupboard is open or not, second asking if item is there or not. My way is to make it linear - that's not such a welldone programming, but I'm not a programmer... wink After some months you will recognize how to simplify it automatically... For example: you don't need the fourth case, because you can't see the item when the cupboard ist closed... wink wink but it's important for the game to determine if the character has the item or not.

    Thread Captain

    1097 Posts

  • #25, by JorkzSunday, 26. April 2020, 12:16 4 years ago
    Ahah thanks a lot everybody!
    I finally got to do what I wanted with the damn cupboard!... And it's all thanks to your explanations

    Newbie

    90 Posts

  • #26, by MachtnixMonday, 27. April 2020, 05:53 4 years ago
    I started with


    but it's very, very old! Mostly it's still correct to learn the basics. 
    And there are a lot of newer (German too) YT-Videos.

    Thread Captain

    1097 Posts

  • #27, by NigecMonday, 27. April 2020, 09:06 4 years ago
    I used Glenfx's tutorials too, and its still works
    don't use the "RUNAWAY like MOUSE interaction" if you've already used commands as discribed in the earlier part of the tutorial, inventory will break

    Key Killer

    629 Posts