• Our software update is now concluded. You will need to reset your password to log in. In order to do this, you will have to click "Log in" in the top right corner and then "Forgot your password?".
  • Welcome to PokéCommunity! Register now and join one of the best fan communities on the 'net to talk Pokémon and more! We are not affiliated with The Pokémon Company or Nintendo.

[Scripting Question] Help with outfits.

8
Posts
4
Years
  • Hello everyone!

    I am hoping that someone knows a way to have multiple outfits in the game. I know how to just switch outfits but I want more than that. I want players to have to buy outfits, and be able to "unlock" outfits for completing tasks. So I would need some kind of system to store and check which outfits a player has. I suppose a storage like the players PC could be useful, just renamed to wardrobe or the like.

    I also will need some kind of system to check which outfit a player is wearing because I plan on having a snowy area which can only be assessed after the player has a winter jacket. I currently have that mostly working, save for the previous outfit worn part. I adapted a tutorial on sinking mud and used it for snow. It seems to interfere with my game though as it makes my outfit whatever is set in the script, regardless if another event changes the outfit. I would guess that the "else $trainer.outfit = 0" needs to be something more like "else $trainer.outfit = saved outfit choice".

    I had links but it seems I need to post at least five times to use links, so I guess I will spam my comments and have the links in one of those.

    Any help, thoughts, and/or criticism you can provide is greatly appreciated!
     
    8
    Posts
    4
    Years
  • Alright so here it is again but hopefully with links.

    I adapted a tutorial on sinking mud and used it for snow. It seems to interfere with my game though as this specifically makes my outfit whatever is set in the script, regardless if another event changes the outfit. I would guess that the "else $trainer.outfit = 0" needs to be something more like "else $trainer.outfit = saved outfit choice".
     
    15
    Posts
    5
    Years
    • Seen Sep 24, 2020
    You can simply design the Outfits as key items that you can buy or unlock. Make the player able to buy the key item, or add it as part of a script. the script for implementing outfits as key items is the following (im taking this from one of my older posts) - You can then also decide to make a key item that acts as a wardrobe by implementing multiple outfits into one item and including a show choices branch.


    Spoiler:


    - Script is from Pokeminer20

    Short Installation Guide:
    1. Create 2 Key Items in items.txt (tutorials for that are on youtube) - 1 can be your normal clothes, 2 can be a new outfit (your choice)
    2. Paste the script from Pokeminer20 into the scripts editor under PItem_ItemEffects below UseFromBag Handlers
    3. Replace Clothenames inside the script with the internal name of your clothes (for example you defined the casual clothes as "CASUAL" so you replace it with "CASUAL"
    4. Add a way to give the player the key item, save, and done!
     
    8
    Posts
    4
    Years
  • You can simply design the Outfits as key items that you can buy or unlock. Make the player able to buy the key item, or add it as part of a script. the script for implementing outfits as key items is the following (im taking this from one of my older posts) - You can then also decide to make a key item that acts as a wardrobe by implementing multiple outfits into one item and including a show choices branch.

    I see what you mean and never thought to reverse engineer an item. That just might work. I am still having an issue with storing the last outfit used by a player. When the player walks the current script changes their outfit to the winter jacket. That's great... while the player is in the snow area. But the script currently sets the player to wearing the jacket regardless of where they are. Set the outfit to something else and it's fine, until you take a step, then back to the jacket. I believe I just need some kind of temp outfit choice storage that reads what outfit a player is wearing, saves that number, switches to the jacket while in the snow area, then remembers the players outfit choice and sets it back when you leave the snow area. Don't suppose you got anything like that?
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    I'm not sure exactly what you're trying to do, but you might have some luck using $game_map.id which I think contains the ID of the map the player is currently on.
     
    8
    Posts
    4
    Years
  • I'm not sure exactly what you're trying to do, but you might have some luck using $game_map.id which I think contains the ID of the map the player is currently on.

    What I am trying to do is have multiple outfits. I also want snow banks where the player sinks down.

    Making a player look like they are sinking down requires a new outfit. I have set that outfit to #5. The script says that if a player steps on this snow tile, display outfit 5. If they are not standing on the snow tile, display outfit #4 (which is the normal winter jacket outfit). Great except a lot of the game is not snow tiles, so now I wear the jacket all the time.

    I managed to circumvent this issue by using
    Spoiler:


    Now the issue is when I step into the snow tile, outfit #5 becomes the old outfit. I can put events all around these snow banks that reset the $Trainer.outfit=4 to maintain the jacket if I want, but that is messy and could be avoided if I was a bit better as script. I am also now realizing I have an issue where I would have to reset the players outfit to whatever they had been wearing before putting on the winter jacket.

    So what I need is to check the player outfit. Then save that choice. Then be able to call it back. Or at least that's what I think I need.
     
    220
    Posts
    14
    Years
    • Seen Nov 29, 2021
    So you need to save the old outfit when entering snow.
    Then you want to have outfit 4 if it's not a snow bank, or outfit 5 if it is.
    Then, when it's neither, if the value of the old outfit is set, revert to that outfit, then clear the value?
     
    8
    Posts
    4
    Years
  • So you need to save the old outfit when entering snow.
    Then you want to have outfit 4 if it's not a snow bank, or outfit 5 if it is.
    Then, when it's neither, if the value of the old outfit is set, revert to that outfit, then clear the value?

    That sounds correct to me. The way you say it makes it sound simple.
     
    220
    Posts
    14
    Years
    • Seen Nov 29, 2021
    I was tired when I wrote that and didn't really think about it, that's why :P
    The easiest way I can think of is:
    Code:
    [B]if ($Trainer.outfit != 4 && $Trainer.outfit !=5)[/B]
    oldoutfit = $Trainer.outfit
    [B]end[/B]
    This way you don't ever store outfits 4 or 5 as the old outfit.
     
    8
    Posts
    4
    Years
  • I was tired when I wrote that and didn't really think about it, that's why :P
    The easiest way I can think of is:
    Code:
    [B]if ($Trainer.outfit != 4 && $Trainer.outfit !=5)[/B]
    oldoutfit = $Trainer.outfit
    [B]end[/B]
    This way you don't ever store outfits 4 or 5 as the old outfit.

    Absolutely wonderful! This fixed the issue with walking through snow banks. Thank you so very much for fixing this dilemma for me!

    Don't suppose anyone has any advise on how to check for and save the outfit being worn, then check to see if the player has the required outfit (jacket), switch to the jacket if they have it, then when leaving the area put on the first outfit the player had been wearing?

    I have been trying to reverse engineer "turning HM's into items" and I will say that it does check to see if I have the Jacket, but that is all it does. Here is my mess at it currently stands:

    Code:
    [B]def pbgetTrainerOutfit[/B]
      if ($Trainer.outfit != 4 && $Trainer.outfit !=5)
      oldoutfit = $Trainer.outfit
      end
    end
    
    def pbsetTrainerOutfit
      $Trainer.outfit==oldoutfit
    end
    
    def Kernel.pbJacket
      if $DEBUG || $PokemonBag.pbQuantity(PBItems::JACKET)>0
        if $Trainer.outfit != 4
          if Kernel.pbConfirmMessage(_INTL("It looks like the path ahead is very cold. Would you like to wear your Jacket?"))
            Kernel.pbMessage(_INTL("{1} put on their Jacket!",$Trainer.name))
             if canUseJacket?
               useJacket
             end  
            return true
          end
        else  
        return false
        end
      else
        Kernel.pbMessage(_INTL("The path ahead looks too cold to traverse."))
      end
      return false
    end
        
    def canUseJacket?
      if $Trainer.outfit = 4
        return false
      else  
      Kernel.pbMessage(_INTL("{1} put on their Jacket!",$Trainer.name))
      end
      return true
    end
    
    def useJacket
       $trainer.outfit = 4
         Kernel.pbMessage(_INTL("{1} put on their Jacket!",$Trainer.name))
    end
    
    def Kernel.pbRemoveJacket
      if $Trainer.outfit==4
        if Kernel.pbMessage(_INTL("{1} removed their Jacket!",$Trainer.name))
            $Trainer.outfit==oldoutfit
          return true
        end
      else
      end  
      return false
    [B]end[/B]
     
    Last edited:
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Haven't checked the overall logic but you've confused = and == a few times:
    - pbsetTrainerOutfit needs to say "$Trainer.outfit=oldoutfit", at the moment, with "==", it does nothing.
    - canUseJacket? needs to say "$Trainer.outfit == 4", with "=" it always sets the outfit to 4, then returns false.
     
    8
    Posts
    4
    Years
  • Haven't checked the overall logic but you've confused = and == a few times:
    - pbsetTrainerOutfit needs to say "$Trainer.outfit=oldoutfit", at the moment, with "==", it does nothing.
    - canUseJacket? needs to say "$Trainer.outfit == 4", with "=" it always sets the outfit to 4, then returns false.

    Thank you for clearing that up a bit. Like I said, I am not great with scripting, and I am trying to make a different script work for this. I know that "=" means "is", and that "==" means "equals" but it often doesn't make sense to me when to use which one. I had made the corrections you listed but it still does not work correctly. Most likely because of all the other nonsense I have thrown into this mix. I will keep plucking away at it though.
     
    1,403
    Posts
    10
    Years
    • Seen Apr 29, 2024
    Just noticed another one in pbRemoveJacket, "$Trainer.outfit==oldoutfit" should have a "=". A simple way to think about it, is that you use == for if/elsif and = for "standalone" lines (i.e. x = y). (It can be more complex than that in reality, but it's a good rule of thumb to start off with)
     
    220
    Posts
    14
    Years
    • Seen Nov 29, 2021
    I know that "=" means "is", and that "==" means "equals" but it often doesn't make sense to me when to use which one. I had made the corrections you listed but it still does not work correctly.

    "X = Y" is "X is Y"
    "X == Y" is "Is X the same as Y?"

    The easiest way I remember is that two symbols is always a comparison. (Notice how "and" is "&&", and "or" is "||" too.)
    "!=" is also "not equal", but note how there's still two symbols.
     
    Back
    Top