Save-Point

Full Version: Save-Point
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Board Message
Sorry, you do not have permission to access this resource.
Save-Point - Editing Steal Script by makeamidget & Khatharr to allow stealing weapons & armor

Save-Point

Full Version: Editing Steal Script by makeamidget & Khatharr to allow stealing weapons & armor
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
Ooooh! Got it. Blushing + Cheery Thank you so much for all the effort, DerVVulfman. I really appreciate it. Cheery
It has been on my mind, but the use of the already-existing damage pops to show off the "Peeper!" notifications and the items stolen pops is no good.

That is to say, the default damage pop system should remain intact and a separate damage pop for the steal/peep reactions should be crafted. The steal/peep pop would be made much like what already exists in the default pop code, and would act independent.

That way, you could show an actual "Damage" pop applied to an enemy -and- a "Peeper!" or a stolen item pop along side.

Under the current state, that's a big nope for visible damage.
That's a good idea! Up until you began analyzing the script, I didn't even know that the script used the damage display. It does seem like it limits the script's usability.
I take my time....  Blushing + Cheery  Granted, I have other responsibilities.  BUT...
 
[Image: attachment.php?aid=2831]

It'll get there.  Currently, I have the steal pops (which covers both steal and peep) appear 20px below the default pops. So indeed.... you have damage and peeps or damage and steals.   The only caveat is you cannot have steal and peep combined.   But who does steal peep combined????

And unlike the original script, the "Peeper!" damage pop appears before the generation of the peep window instead of after.  I used the same timing mechanics for both the steal pops and peep pops.

I need to re-examine the alignment of the custom damage pops.   Whilst based on the code from the steal script, it appears off-center when compared to the native damage pops.   Other than that, they function as they have in the past, with the steal pops including the icon and colorful text and border depending on actor and enemy battler.

This did entail a bit of serious rewrite.  And I may need add more configuration content.  BUT AT LEAST it will have instructions.  Laughing + Tongue sticking out
OH HOORAY!!!!! Shocked Shocked Shocked Shocked Shocked  That is AWESOME! Looking forward to the final script.


Speaking of, I just noticed that the original script was part of the CA Archived Script Listing!

https://www.save-point.org/showthread.php?tid=6642

(RIP Creation Asylum)
Indeed.  You may really like perusing the old Archives boards.  Find stuff once thought lost.

Oh, and I have been adding to the configuration section a bunch of "WORDS" as it is. That is to say, words that are not in the Database Tab that appear within the pop-up screenies:
#==============================================================================
# ** Window_Peep
#------------------------------------------------------------------------------
#  This window class contains cursor movement and scroll functions.
#==============================================================================

class Window_Peep < Window_Base
 
  #--------------------------------------------------------------------------
  # * Object Initialization
  #    enemy  : enemy battler
  #    immune : flag if enemy immune from being peeped/scanned
  #--------------------------------------------------------------------------
  def initialize(enemy, immune = false)
    #
    # Window dimensions
    super(120, 32, 400, 262)
    #
    # Set window dimensions
    self.contents         = Bitmap.new(width - 32, height - 32)
    self.z                = 9990
    self.opacity          =  250
    self.contents_opacity =  250
    #
    # Set enemy and refresh
    @enemy                = enemy
    refresh(immune)
    #
  end

  #--------------------------------------------------------------------------
  # * Dispose
  #--------------------------------------------------------------------------
  def dispose
    @sprite.dispose
    self.contents.dispose
    super
  end
 
  #--------------------------------------------------------------------------
  # * Refresh
  #    immune : flag if enemy immune from being peeped/scanned
  #--------------------------------------------------------------------------
  def refresh(immune = false)
    #
    # Clear values at start
    done    = false                               # Assume sprite not sized
    opacity =                                  # Reset opacity to 0
    #
    # Prepare text and sprite for display
    refresh_text(immune)                          # Get enemy stats to show
    refresh_sprite                                # Get enemy sprite to show
    refresh_enemy_coords                          # Get sprite coord settings
    #
    # Execute a loop
    loop do
      #
      Graphics.update                             # Frame update
      Input.update                                # Update input method
      if Input.trigger?(Input::C)                 # When C is pressed
        dispose                                   #  Dispose the window
        break                                     #  stop the loop
      end
      opacity = refresh_opacity_increase(opacity) # Increase the opacity
      done    = true      if refresh_sprite_zoom? # Adjust sprite size
      refresh_sprite_move if done                 # Move sprite if sprite sized
      #
    end
    #
  end

  #--------------------------------------------------------------------------
  # * Refresh text display
  #    immune : flag if enemy immune from being peeped/scanned
  #--------------------------------------------------------------------------
  def refresh_text(immune)
    #
    # Initial Editor Database words
    hp_words    = $data_system.words.hp   + ": "
    sp_words    = $data_system.words.sp   + ": "
    gold_words  = $data_system.words.gold + ": "
    #
    # Custom System words in the Config section
    name_words    = MM_Steal::PEEP_NAME   + ": "
    exp_words     = MM_Steal::PEEP_EXP    + ": "
    states_words  = MM_Steal::PEEP_STATES + ": "
    common_words  = MM_Steal::PEEP_COMMON + ": "
    rare_words    = MM_Steal::PEEP_RARE   + ": "
    #
    # Get contents to display in window
    name        = name_words    + @enemy.name
    hp_txt      = hp_words      + @enemy.hp.to_s + " / " + @enemy.maxhp.to_s
    sp_txt      = sp_words      + @enemy.sp.to_s + " / " + @enemy.maxsp.to_s
    exp_txt     = exp_words     + @enemy.exp.to_s
    gold_txt    = gold_words    + @enemy.gold.to_s
    states      = states_words  + refresh_states
    common      = common_words  + refresh_common
    rare        = rare_words    + refresh_rare
    immune_txt  = MM_Steal::PEEP_IMMUNE_TEXT
    #
    # Show name (always)
    self.contents.draw_text(10, -18, 400, 50, name)
    #
    # Display immunity text and exit if immune
    if immune
      # Text is centered vertically as well as horizontally
      self.contents.draw_text(0, self.height / 2, 400-64, 60, immune_txt, 1)
      return
    end
    #
    # Display all pertinant data if not immune
    self.contents.draw_text(1012, 400, 50, hp_txt)
    self.contents.draw_text(1042, 400, 50, sp_txt)
    self.contents.draw_text(1072, 400, 50, exp_txt)
    self.contents.draw_text(10, 102, 400, 50, gold_txt)
    self.contents.draw_text(10, 132, 400, 50, states)
    self.contents.draw_text(10, 162, 400, 50, common)
    self.contents.draw_text(10, 192, 400, 50, rare)
    #
  end
 
  #--------------------------------------------------------------------------
  # * Refresh common steal texts
  #--------------------------------------------------------------------------
  def refresh_common
    #
    text = MM_Steal::PEEP_NONE
    return text if @enemy.steal_item_id.nil?
    #
    temp_array  = @enemy.steal_item_id
    temp_array  = [0,0] if temp_array.nil?
    item_type   = temp_array[0]
    item_id     = temp_array[1]
    case item_type
    when ; text = $data_weapons[item_id].name.to_s
    when 2  ; text = $data_armors [item_id].name.to_s
    else    ; text = $data_items [item_id].name.to_s
    end     
    #
    return text
    #
  end
 
  #--------------------------------------------------------------------------
  # * Refresh rare steal texts
  #--------------------------------------------------------------------------
  def refresh_rare
    #
    text = MM_Steal::PEEP_NONE
    return text if @enemy.steal_rare_id.nil?
    #
    temp_array  = @enemy.steal_rare_id
    temp_array  = [0,0] if temp_array.nil?
    item_type   = temp_array[0]
    item_id     = temp_array[1]
    case item_type
    when ; text = $data_weapons[item_id].name.to_s
    when 2  ; text = $data_armors [item_id].name.to_s
    else    ; text = $data_items [item_id].name.to_s
    end     
    #
    return text
    #
  end

  #--------------------------------------------------------------------------
  # * Refresh status effect texts
  #--------------------------------------------------------------------------
  def refresh_states
    #
    # Define text to return
    text = ""
    #
    # Cycle through enemy status effects
    for i in @enemy.states
      next unless $data_states[i].rating >= 1 # Skip unless a valid state
      if text == ""                           # If status ailment list is empty
        text = $data_states[i].name           # List begins with first state
      else                                    # Otherwise
        text += "/" + $data_states[i].name    # Add separator and next state
      end
    end
    #
    text = MM_Steal::PEEP_NORM if text == ""  # Set normal state on empty list
    text = "[" + text + "]"                   # Adding brackets when done
    #
    # Return the states
    return text
    #
  end
 
  #--------------------------------------------------------------------------
  # * Refresh the sprite
  #--------------------------------------------------------------------------
  def refresh_sprite
    #
    # Obtain Battler filename and hue
    name  = @enemy.battler_name
    hue   = @enemy.battler_hue
    #
    # Create the enemy sprite based on enemy name and hue
    @sprite         = Sprite.new
    @sprite.bitmap  = RPG::Cache.battler(name, hue)
    #
    # Set the screen coordinates for the sprite including z-depth
    @sprite.x       = (@enemy.screen_x - (@sprite.bitmap.width / 2))
    @sprite.y       = (@enemy.screen_y - @sprite.bitmap.height)
    @sprite.z       = 9999
    #
  end 
 
  #--------------------------------------------------------------------------
  # * Refresh enemy coordinates
  #--------------------------------------------------------------------------
  def refresh_enemy_coords
    #
    # Obtain width/height from sprite
    wd = @sprite.bitmap.width
    ht = @sprite.bitmap.height
    #
    # Values allow for sprite zoom and repositioning
    @old_center_x   = wd / 2           # Center point of sprite width
    @old_center_y   = ht / 2           # Center point of sprite height
    @final_x        = (400 - (wd / 4)) # The final x-coordinate of the sprite
    @scale          = 1                # Zoom scale at start (allows adjusts)
    #
  end 
 
  #--------------------------------------------------------------------------
  # * Refresh increased window opacity
  #    opacity : content opacity
  #--------------------------------------------------------------------------
  def refresh_opacity_increase(opacity)
    #
    # Exit with current setting unless opacity is solid
    return opacity unless self.opacity < 255
    #
    #
    self.opacity = opacity              # Set the window opacity setting
    self.contents_opacity = opacity     # Set the contents opacity setting
    opacity += 20 unless opacity >= 255 # Increase opacity until reaches 255
    #
    # Return current setting
    return opacity
    #
  end 

  #--------------------------------------------------------------------------
  # * Refresh if sprite zoom processed?
  #--------------------------------------------------------------------------
  def refresh_sprite_zoom?
    #
    # Determine current sprite width and height
    width_shift   = @sprite.bitmap.width  * @scale >= 200
    height_shift  = @sprite.bitmap.height * @scale >= 150
    #
    # Perform gradual zoom and return false if sprite is not to scale
    if (width_shift or height_shift)
      #
      @sprite.zoom_x = @scale                 # Set sprite zoom by current scale
      @sprite.zoom_y = @scale                 # Set sprite zoom by current scale
      @scale -= 0.01                          # Decrease scale by gradual 0.01
      width         = @sprite.bitmap.width    # Get sprite width (convenience)
      height        = @sprite.bitmap.height   # Get sprite height (convenience)
      @new_center_x = (width  * @scale) / 2   # Get scaled sprite center X
      @new_center_y = (height * @scale) / 2   # Get scaled sprite center Y
      @x_move = @new_center_x - @old_center_x # Get x movement increment
      @y_move = @new_center_y - @old_center_y # Get x movement increment
      @old_center_x = @new_center_x           # Reset the original x coordinate
      @old_center_y = @new_center_y           # Reset the original y coordinate
      @sprite.x -= @x_move.to_i               # Move the sprite by x increment
      @sprite.y -= @y_move.to_i               # Move the sprite by y increment
      #
      # Exit zoom not completed
      return false
      #
    end
    #
    # Exit zoom completed
    return true
    #
  end
   
  #--------------------------------------------------------------------------
  # * Refresh sprite move position
  #--------------------------------------------------------------------------
  def refresh_sprite_move
    #
    @xlen = @sprite.x - @final_x        # Distance of sprite from final x coord
    @ylen = @sprite.y - 40              # Distance of sprite from final y coord
    @len  = Math.hypot(@xlen, @ylen)    # Calc the move length for the sprite
    @len /= 5                           # Decrease by 1/5th to speed it up
    @line = []                          # Create temp array
    @line.push([@sprite.x, @sprite.y])  # Push the starting coordinates
    #
    # Cycle through move increments
    for i in 1..@len
      newx = @sprite.x - ((@xlen / @len) * i) # Calculate new X coordinate
      newy = @sprite.y - ((@ylen / @len) * i) # Calculate new Y coordinate
      newx = newx.to_i                        # Make X coordinate an integer
      newy = newy.to_i                        # Make Y coordinate an integer
      @line.push([newx, newy])                # Push updated coordinates
    end
    #
    # Remove duplicates
    @line.uniq!
    #
    # Cycle through calculated coordinates
    for j in 0...@line.size
      Graphics.update                        # Frame Update
      givexy    = @line[j]                   # Get coordinate set
      @sprite.x = givexy[0                 # Set Sprite's new x coordinate
      @sprite.y = givexy[1                 # Set Sprite's new x coordinate
    end
    #
  end
 
end

Tell me I didn't study and decipher the inner workings of the Peep window.  Go ahead, and tell me  Laughing + Tongue sticking out

I haven't done that to the Steal window... but it will.  And if you look very closely, I took out all the hard-coded words that appear in the Peep window and placed them in the config window, so you can choose what it actually says (or if you speak a different  language).

I will be attacking the Steal window too.

I also need to figure out how to set up the "Peeper!" content to have a different pop if you are performing damage for something like Psychic damage.   Likewise, text in the Steal window should change if its normal stealing or a mugging.

Betcha didn't think about that, did ya?

Meanwhile, having a blargy time figuring out a GOOD way to properly center the Icon-using pop texts.



EDIT:   Now I know why the RPG::Sprite damage code in the script seemed wonky.

The default damage pop has a width of 160px max.    And his code suggested a wider 180px display.   That part is fine by me.  However, the positioning of the sprite (referred as center origin) was still suggested at the 80px position (or half of the 160px original.   IT, and a host of other values were just as wrong.

That's not to say it didn't need work.  It did.

The system calculating text width was off.  It forgot to set the appropriate width of the drawn text (which was still set to 160), but needed adjusting to handle text with an icon adjustment, and more.

[Image: attachment.php?aid=2833]
Compressed lengthy text now centered[/i]

Fortunately, I managed to get it to work.  Still some cleanup, and setting up config values for the Steal window, and the stuff I mentioned earlier in this particular post.
(02-12-2025, 08:58 PM)DerVVulfman Wrote: [ -> ]
Quote:Indeed.  You may really like perusing the old Archives boards.  Find stuff once thought lost.

I have! There are some really great scripts there! (That's where I found the weapon-skills script that you also helped me implement) Blushing + Cheery


Quote:Tell me I didn't study and decipher the inner workings of the Peep window.  Go ahead, and tell me  Laughing + Tongue sticking out

[Image: were-not-worthy-waynes-world.gif]

Quote:I haven't done that to the Steal window... but it will.  And if you look very closely, I took out all the hard-coded words that appear in the Peep window and placed them in the config window, so you can choose what it actually says (or if you speak a different  language).

I did! I love the inclusion of green text. They'll be incredibly helpful when customizing the script.

Quote:I will be attacking the Steal window too.

I also need to figure out how to set up the "Peeper!" content to have a different pop if you are performing damage for something like Psychic damage.   Likewise, text in the Steal window should change if its normal stealing or a mugging.

Betcha didn't think about that, did ya?

I really didn't! I was content with some basic number popping up, but what you are making is soooo much better. Blushing + Cheery Blushing + Cheery Blushing + Cheery




(02-13-2025, 03:35 AM)Ace_V Wrote: [ -> ]I did! I love the inclusion of green text. They'll be incredibly helpful when customizing the script.

If you mean the green outline for the  Steal Effect  damage pops, that was already part of the script.

I am gonna have a helluva time re-introducing some of the quips and qwirky  remarks Katharr and MakeaMidget placed in the script since its gone through a major refit.

Admiral, this is an almost totally new Enterprise. You don't know her a tenth as well as I do
(02-13-2025, 03:51 AM)DerVVulfman Wrote: [ -> ]
(02-13-2025, 03:35 AM)Ace_V Wrote: [ -> ]I did! I love the inclusion of green text. They'll be incredibly helpful when customizing the script.
Quote:If you mean the green outline for the  Steal Effect  damage pops, that was already part of the script.
Ah no, I meant your help text # like this. Very useful and not everybody applies it. Laughing


Quote:I am gonna have a helluva time re-introducing some of the quips and qwirky  remarks Katharr and MakeaMidget placed in the script since its gone through a major refit.

Admiral, this is an almost totally new Enterprise. You don't know her a tenth as well as I do

I am getting a strong case of deja vu with that scene, since I am positive someone else mentioned that very same scene with me in the last 48 hours. My sleep-deprived brain just can't seem to recall from where. Laughing
Pages: 1 2