erasing a picture at the end of a battle

Discussion in 'RGSS Script Requests' started by prince of mars, Nov 24, 2014.

  1. prince of mars

    prince of mars Veteran Veteran

    Messages:
    111
    Likes Received:
    16
    First Language:
    English
    hello everyone I have been using a parallel common event where depending on what weapon the players had equipped a different picture shows on screen and I have been using that as a way to show which weapon the player has equipped in battle as well which works fine since I am using the FPLE script use map as battleback which takes a screenshot of the screen to use as battleback and that includes the weapon picture . But I have a problem since I want the player to be able to change weapons in combat I made skills which when used would use a common event to change the players weapon and show the new weapon on screen by overlaying a new picture over the old one but when you use a show picture command in battle the images reappears in all future battles when the battle is over it does not erase that image instead it reappears when ever you go back into combat so what I need should theoretically be quite simple can someone show me how to add a simple line of programing to the battle end script which would delete the weapon picture

    out of combat
    [​IMG]
    in combat
    [​IMG]
    the weapon change images
    [​IMG]
     
    #1
  2. prince of mars

    prince of mars Veteran Veteran

    Messages:
    111
    Likes Received:
    16
    First Language:
    English
    a picture of my weapon change common event if anyone wants to see it

    [​IMG]
     
    #2
  3. Shaz

    Shaz Veteran Veteran

    Messages:
    37,819
    Likes Received:
    11,524
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    prince of mars, please avoid double posting, as it is against the forum rules. You can review our forum rules here. Thank you.


    Just add another common event. Make it a parallel process event, conditioned by a switch. Add commands to erase the picture then turn its conditioning switch off.


    Then at the start of the battle turn the switch on.


    Common events only run in battle when you use a Call Common Event command. Not when they are parallel or autorun and conditioned by a switch. So turning on the switch at the start of battle will set it up to run as soon as the battle is over.
     
    #3
  4. prince of mars

    prince of mars Veteran Veteran

    Messages:
    111
    Likes Received:
    16
    First Language:
    English
    right sorry about the double post won't happen again.

    now on to the problem at hand I am afraid you idea did not work I did as you said but it still shows the last image in battle

    [​IMG]

    like you said I put a command to turn on the switch just before battle but it seems trying to delete the image outside of battle won't do it we will probably have to fiddle with the battle scripts
     
    #4
  5. Shaz

    Shaz Veteran Veteran

    Messages:
    37,819
    Likes Received:
    11,524
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    Oh ... set an event at the start of battle to erase the picture.


    I thought you wanted to erase it when you were back on the map.


    Make sure you're always using the same picture number for this purpose - don't use a different number for each weapon.
     
    #5
  6. prince of mars

    prince of mars Veteran Veteran

    Messages:
    111
    Likes Received:
    16
    First Language:
    English
    that was the first thing I tried it appears if I try to erase the picture outside of battle it does nothing the only way to get rid of the image in-battle is by calling a common event I asked on another forum the same problem. (I find posting on multiple forums is the quickest way to find an answer) and they suggested placing this line of code

    $game_screen.pictures[5].erase

    into the Scene_Battle1 script under battle end results and it does not seem to have any affect

    and yes my image was 5 :)
     
    #6
  7. Shaz

    Shaz Veteran Veteran

    Messages:
    37,819
    Likes Received:
    11,524
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    No, there's no such thing as $game_screen. The map has a screen variable, and each troop has a screen variable. In fact, I'm surprised it "didn't have much of an effect" - I would expect it would cause your game to crash.


    The interpreter uses the appropriate one when you use the Show Picture and Erase Picture command.


    If you use Show Picture when in battle, you should also use Erase Picture when in battle.


    I still think Erase Picture on each troop tab, set to run at start of battle, should do the job. If it's not, please show us a screenshot of your troop page with that tab visible so we can see how you're trying to do it. Actually, one where you show the picture AND one where you erase it, so we can be sure they're being used in the correct places.
     
    Last edited by a moderator: Nov 26, 2014
    #7
  8. MobiusXVI

    MobiusXVI Game Maker Veteran

    Messages:
    362
    Likes Received:
    84
    First Language:
    English
    There's definitely a $game_screen, and that is a valid script call. I think you might be confusing XP and ACE.

    However, when you're in-battle, the game indexes your pictures starting at 51. Basically it uses 1-50 for the map and 51-100 for battle. So try that same call but change the number to 55.
     
    Last edited by a moderator: Nov 26, 2014
    #8
  9. Shaz

    Shaz Veteran Veteran

    Messages:
    37,819
    Likes Received:
    11,524
    Location:
    Australia
    First Language:
    English
    Primarily Uses:
    RMMV
    I'm sorry - you're right. I was looking at Ace.
     
    #9
  10. prince of mars

    prince of mars Veteran Veteran

    Messages:
    111
    Likes Received:
    16
    First Language:
    English
    apologies for the delayed response been super busy with work anyway tried the 55 that did nothing I also tried this

    #-------------------------------------------------------------------------- # * Battle Ends # result : results (0:win 1:lose 2:escape) #-------------------------------------------------------------------------- def battle_end(result) # Clear in battle flag $game_temp.in_battle = false # Clear entire party actions flag $game_party.clear_actions # Remove battle states for actor in $game_party.actors actor.remove_states_battle end # Clear enemies $game_troop.enemies.clear # my picture erase edit for i in 1..100 $game_screen.pictures.erase end # Call battle callback if $game_temp.battle_proc != nil $game_temp.battle_proc.call(result) $game_temp.battle_proc = nil end # Switch to map screen $scene = Scene_Map.new endwhich was meant to delete all images but no it did nothing.

    I just want to say thank you again for takeing the time to try and help me I hope we can still solve this I don't want to lose my lovely hud
     
    #10
  11. MobiusXVI

    MobiusXVI Game Maker Veteran

    Messages:
    362
    Likes Received:
    84
    First Language:
    English
    Ok, so everything you've tried so far really should have worked. Especially erasing all the pictures. My best guess is that something in the custom scripts you're using is causing the erase picture function to not work as intended. If you can, post a link to the scripts you're using particularly the "map as battleback". In the meantime, try the following to help diagnosis the problem. 

    1. In a battle, use events to show a picture on the screen, and then erase it. Exit the battle, and re-enter. Does the picture show up?

    2. In a battle, use events to show a picture but don't erase it. Exit the battle, and re-enter. Does the picture show up?

    3. In a battle, use events to show a picture but don't erase it. Replace the picture with a different one and erase it. Exit the battle, and re-enter. Does the picture show up?

    4. In a battle, use events to show a picture but don't erase it. Replace the picture with a different one but don't erase it. Exit the battle, and re-enter. Does the picture show up?

    Just so you know, based on what's happened so far, I'm expecting the answers to all be yes. But when I do these on a fresh project, I get "No", "Yes", "No", and "Yes" respectively which is partly why I suspect it might be some custom scripts.
     
    #11
  12. prince of mars

    prince of mars Veteran Veteran

    Messages:
    111
    Likes Received:
    16
    First Language:
    English
    sorry for delayed response I work in a supermarket and well the month of December is crazy anyway I tried all those things you asked 

    1 no the picture when erase via a event is gone and will not reappear

    2 yes the picture will always reappear in the next battle unless erased in the first battle

    3 no if the picture is erased in the last battle it will not appear in the next one even if I replace it multiple time as long as it is erased before the battle is over it won't appear again

    4 yes the replaced picture shows up

    here is the use map as battleback script I use with FPLE

    #====================================================================# FPLE map as battleback# Author : Atoa# Paste this script below the FPLE scripts and above main to activate# FPLE map as battleback.# While it is below main, it doesn't have any effect.#====================================================================#==============================================================================# ** Scene_Battle#==============================================================================class Scene_Battle #-------------------------------------------------------------------------- if !@already_aliased alias main_fple_scene_map main @already_aliased = true end #-------------------------------------------------------------------------- def main if $game_system.fple @spriteset_map = FPLE_Spriteset_Map.new else @spriteset_map = Spriteset_Map.new end main_fple_scene_map @spriteset_map.dispose endend#==============================================================================# ** Scene_Map#==============================================================================class Scene_Map #-------------------------------------------------------------------------- if !@already_aliased alias call_battle_fple_scene_map call_battle @already_aliased = true end #-------------------------------------------------------------------------- def call_battle if $game_system.fple @spriteset.update Graphics.update end call_battle_fple_scene_map endendand most importantly this might be of a great help to you it is the latest version of my game It has a save game with all the weapons and 2 extra skills one called show image and one called erase

    http://s000.tinyupload.com/index.php?file_id=67088519966102225551
     
    #12
  13. MobiusXVI

    MobiusXVI Game Maker Veteran

    Messages:
    362
    Likes Received:
    84
    First Language:
    English
    Huzzah! I've found the problem. But first a quick lesson about scripting. 

    When you write scripts, occasionally you have to overwrite methods. This leads to the order of scripts in the script editor being important and it's why custom scripts will tell you to place them below all of the defaults but above "Main". Essentially, when you start the game it goes through the scripts in order from top to bottom. As it goes through them, it will define all of the classes, methods, and other scripting things. If it ever encounters something with the same name as something previous, it will overwrite it. So as a very basic example, if you did the following.

    A = 2

    B = 3

    C = A + B

    A = 4

    D = A + B

    C would equal 5 while D would equal 7. So what's the point of all this? Well all of your changes that you made to "Battle_End" get overwritten in another custom script that you are using. So it's like you're telling the game that A equals 2 but further down your script list you tell it that A equals 4 instead. That's why it didn't work. So what you need to do is put "$game_screen.picutres[55].erase" in the "battle_end" method that's in the custom script marked "one player battle". 
     
    #13
    prince of mars likes this.
  14. prince of mars

    prince of mars Veteran Veteran

    Messages:
    111
    Likes Received:
    16
    First Language:
    English
    YES YES OF COURSE I totally forgot about the single player battle script no wonder it did not work before thank you thank you so much
     
    #14

Share This Page