[Ace]Help with Advanced select item

Discussion in 'RGSSx Script Support' started by BlackRoseMii, Jun 19, 2019.

    Tags:
  1. BlackRoseMii

    BlackRoseMii Veteran Veteran

    Messages:
    655
    Likes Received:
    597
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMVXA
    (I'm not sure if this is the right place, since a problem like that could also happen without any extra script, but I'm using one that could possibly influence the problem.)
    So, I've been trying to make an NPC that has three options to interact with. "Shop", "Talk" and "Give present". The first ones aren't the problem, but the last one.

    I'm using Vlue's Advanced select item:
    My problem is, that I have no idea how to set up different reactions to different items. The player is able to give the NPC any item, but that NPC should react differently to it. It's not like it can only react to one item alone. I've tried several things, googled solutions, but the closest I came to fixing it was that all reactions were the same. This is what the event looks like:
    [​IMG]
    I know that I would probably need to change the conditional branches depending on the item, but I tried that and nothing happend at all.
    I also know that Galv has an "item on event" script, which I'm using for other events, but this one works differently, since it triggers like a normal event without any item.

    It's a really annoying problem I can't avoid, since my game relies heavily on character interaction like this. I'd be really happy if someone could help me ^^°
     
    #1
  2. Trihan

    Trihan Speedy Scripter Veteran

    Messages:
    1,483
    Likes Received:
    978
    Location:
    Buckie, Scotland
    First Language:
    English
    I think you might be misunderstanding how the variable selection in the key item command works: when you select the item, it stores the ID of the item selected in the variable you chose. So at any given time, variable 0001 will have the ID of whatever item was given to Phara. You can then use that in a conditional branch to figure out which item was given.

    Right now you're comparing the variable's value to itself, so your first branch will always return true because the variable will never not contain the value it contains.
     
    #2
  3. LvdvE

    LvdvE Villager Member

    Messages:
    19
    Likes Received:
    0
    First Language:
    French
    Primarily Uses:
    RMVXA
    I think you don't need a script to do what you want: a system where you can offer an object and wait for a personalized reaction.

    As mentioned above, it seems there are a confusion, your "give keyitem" variable should be renamed "keyitem_id" because once the player has selected an object, the id of the object in question is saved in the variable.
    Then, it is only a question of verification, if the id n ° 1 corresponds to "whatever" then you can put the expected reaction under the condition keyitem_id == 1, etc.

    The only thing annoying is that it works only for objects defined as key objects ...
     
    #3
  4. BlackRoseMii

    BlackRoseMii Veteran Veteran

    Messages:
    655
    Likes Received:
    597
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMVXA
    Okay, I think I'm an idiot XD
    I tried it again just the way you guys told me. It was part of the problem, but it still didn't work. Then I checked all the variables again, including any that were in the script and then realized I made a mistake there.
    In the script, where you could choose what variable to use, I changed it to 1, since the items you could give were all armors. I thought that I would need to use the same variable, but that wasn't true. When I changed the variable in the script to something else, it finally worked XD

    Still, thanks for all your help^^
     
    #4
  5. Trihan

    Trihan Speedy Scripter Veteran

    Messages:
    1,483
    Likes Received:
    978
    Location:
    Buckie, Scotland
    First Language:
    English
    I'm guessing you were using variable 1 somewhere else in the game and the value was being overwritten.

    Think of a variable as a box you can stuff a value into. It can hold any value, but if you go back to it later it'll still have whatever value you last stuffed in until you replace it with something else. If you need to keep that value and want to store another value, you need another box.
     
    #5
  6. BlackRoseMii

    BlackRoseMii Veteran Veteran

    Messages:
    655
    Likes Received:
    597
    Location:
    Germany
    First Language:
    German
    Primarily Uses:
    RMVXA
    Yeah, I guess variables are easy as long as it's about actual numbers (of items, of triggered events, etc) But as soon as it's not about that, it gets a little tricky for me ^^°

    Anyway, I think with this, my problem should be solved. I hope nothing else comes up later^^°
    If noone has any other advice the thread can be closed.
     
    #6

Share This Page