Stealing/Mugging/Scanning 6.3

Stealing, Mugging, and Scanning


Version: 6.3



Introduction

This script lets heroes and enemies to steal exp,gold,items, and skills (for a certain amount of turns, the rest of the battle, or permanently). Also from this update lets the battlers steal + attack (mug) and also adds a scan skill that scans a enemy (stats, exp and gold carrying, weaknesses, strengths, and the items able to be stolen from them). This is the First Revision of this script It does not add any features, but It does fix some coding, looks neater and a few bugs may have been fixed.

Features
  • The ability to steal gold from monsters and have gold stolen from you
  • The stealback ability allows you to stealback the gold/item the monster stole from you (can be turned off)
  • The ability to steal items from monsters and have items stolen from you
  • Monsters may hold three items (the regular item, secondary item, and rare item
  • The ability to steal skills from monsters and have skills stolen
  • The ability to steal the commonly used skill from a monster
  • The ability to steal a skill for a certain amount of turns and have skills stolen from you for a certain amount of turns
  • The ability to steal a skill forever and have monsters steal skills from you forever *coughcruelcough*
  • The ability to steal exp from a monster and have exp stolen from you
  • Display what was stolen from you
  • Help window edit to allow for color changes/bold and italic toggling
  • You may have items/skills that are unstealable
  • Enemies may use stolen skills against you
  • Damage Display using the help window
  • Copy Skills from the enemy instead of stealing them
  • Steal/Copy the last skill the enemy used
  • Can be used with encrypted projects
  • Mugging skills (stealing and attacking)
  • A scan skill that displays enemy stats, stealable items, and strengths and weaknesses
  • Stuff I'm probably forgetting to mention ;)
Screenshots


NEW UPDATED
http://img175.imageshack.us/img175/1593/scanningrb3.th.png[/IMG]http://img86.imageshack.us/img86/2818/scanning2bv5.th.png[/IMG]http://img223.imageshack.us/img223/6941/stealingyw8.th.png[/IMG]


Demo
http://www.rmxp.org/forums/downloads.php?do=file&id=37

Instructions

Also Copy the File Steal.rxdata from the data folder to the data folder of your demo.

Create five new elements named Steal, Copy, Last Skill, Mug, and Scan
Edit in the script these lines each with their corresponding element id
#--------------------------------------------------------------------------
  # * Steal Element
  #--------------------------------------------------------------------------
  Steal_Element = 20
  #--------------------------------------------------------------------------
  # * Copy Skill Element - Copies Skills instead of stealing them
  #--------------------------------------------------------------------------
  Copy_Element = 21
  #--------------------------------------------------------------------------
  # * Steal Last Skill - Steals Last Skill Target Used
  #--------------------------------------------------------------------------
  Steal_Last_Skill = 22
  #--------------------------------------------------------------------------
  # * Mugging Element - Steals + Attacks Target
  #--------------------------------------------------------------------------
  Mug_Element = 23
  #--------------------------------------------------------------------------
  # * Scanning Element - Note: Do not use in conjunction with above
  #--------------------------------------------------------------------------
  Scan_Element = 24
Expand to see the code.


You may either edit the skills directly in the database or you can do this in the file Steal.rxdata located in the data folder of the demo (see below). If you don't plan on using the Text file then set the option Using_Steal_Rxdata to false.

Here is how you set up a skill steal

Quote:
Here is how you set up a skill steal

* means the argument is required
*1)id
The id of the skill to overwrite
*2)steal
The steal type (Item, Gold, Exp, Skill, HRSkill)
note: HRSKill = Highest Rated Skill
3)Mugging
set this to true if you want the skill user to also attack the enemy

4)base
For Gold and Exp Stealing the base amount stolen
note: (leave blank for base = enemy gold)
For Skill Stealing The amount of turns the skill is stolen
note: Set this to true = stolen forever and set to false to steal just for the battle
5)item_get
For Item Stealing The id of the item given to the player
note: (leave blank for item = enemy item)
6)type
For Item Stealing The type of the item given 1 item 2 weapon 3 armor
For Skill Stealing 1 = steal last skill 2 = copy skill 3 = copy last skill
7)number
The maximum number that could be stolen
8)agility
Agility influence
9)dexerity
Dexerity influence
10)Theft Defense
For Exp and Gold Stealing the Defensiveness Influence
11)variance
For Gold and Exp Stealing the variance
12)accuracy
Accuracy


NEW Setting up unstealables

Look in script Steal Setup and see these constants
#--------------------------------------------------------------------------
  # * Actor Unstealable Items
  #--------------------------------------------------------------------------
  Actor_Items = []
  #--------------------------------------------------------------------------
  # * Actor Unstealable Weapons
  #--------------------------------------------------------------------------
  Actor_Weapons = []
  #--------------------------------------------------------------------------
  # * Actor Unstealable Armors
  #--------------------------------------------------------------------------
  Actor_Armors = []
  #--------------------------------------------------------------------------
  # * Actor Unstealable Skills
  #--------------------------------------------------------------------------
  Actor_Skills = []
  #--------------------------------------------------------------------------
  # * Enemy Unstealable Items
  #--------------------------------------------------------------------------
  Enemy_Items = []
  #--------------------------------------------------------------------------
  # * Enemy Unstealable Weapons
  #--------------------------------------------------------------------------
  Enemy_Weapons = []
  #--------------------------------------------------------------------------
  # * Enemy Unstealable Armors
  #--------------------------------------------------------------------------
  Enemy_Armors = []
  #--------------------------------------------------------------------------
  # * Enemy Unstealable Skills
  #--------------------------------------------------------------------------
  Enemy_Skills = []
Expand to see the code.


and add the corresponding id of the unstealable item in the array

NEW Setting up secondary/rare items
This was changed as well in the Script Steal Setup find these constants
  #--------------------------------------------------------------------------
  # * Enemy Secondary Stealable Items
  #   syntax enemy_id => [id, type, chance]
  #   where id is the id of the id
  #         type is 1: item, 2: weapon, 3:armor
  #         chance is the chance of stealing
  #--------------------------------------------------------------------------
  Secondary_Items = {
  1 => [5, 1, 40]
  }
  #--------------------------------------------------------------------------
  # * Enemy Rare Stealable Items (see Secondary Items)
  #--------------------------------------------------------------------------
  Rare_Items = {
  1 => [3, 1, 20]
  }
Expand to see the code.


Now in the Secondary Items you can define the enemies second stealable item. and in the Rare Items hash you can define the enemies rare stealable items (when scanning they show in a golden color)

So From My Example Above
1 => [5, 1, 40] interprets as Ghost Also Holds High Perfume as a secondary item and you have a 40% chance of taking it
1 => [3, 1, 20] interprets as Ghost Also Holds Full Potion as a Rare Item and you have a 20% chance of taking it

Compatibility

Should not pose much of a compatibility problem

Yes Still Incompatible with RTAB. No we are not going in that direction again, if you really want to use this script then make a request in the Script Requests Forum asking for a merge. Lets Keep it out of this thread this time, thanks.

Credits

[SIZE=2]Sol_Fury for suggesting a Scan ability be added.

[/SIZE]
Notes

1) So what was sacrificed for SDK Dependancy? If you are using the Save Data option you must Go all the way to the first map (that is to a scene other than Scene_Title) as I have moved the main_database alias to the end of main (and this will be easier for me also).

2) Feel free to edit the scan window. If you have a redesign then post here or PM me with the redesign and I'll do it for you (Since I am soo nice)

3) This is the first revision of this script, I will fix bugs in the script if I find/ or someone tells me

4) What Did I do? I can't remember everything I did since this wasn't a one-day job. This script now uses MACL. This script is not dependent on SDK. I ran through the formulas/methods over 5 times catching errors and commenting code. The Setup has been cleaned and added more stuff to it. Redesigned the Scan Window a Bit and added the option to use a cropped picture or a zoom to fit picture.

5) This scirpt is also 2000 (1863) lines of code and has to be the most advanced stealing system out there as it allows you to steal skills, and exp.

6) This is also my very first script Enjoy 😆

If you need any extra help/examples feel free to post here and I'll answer your question/problem and if you find any bugs tell me (please be detailed)
Wow..
The script is really awesome, come on!! Look at the features! :O Awesome.
You never cease to amaze me.
This deserves a bump! =)

Awsome work Trickster, I had trouble with the original script but this one works perfectly. ^_^
[QUOTE=Kuri$u;109294]Wow..
The script is really awesome, come on!! Look at the features! :O Awesome.
You never cease to amaze me.[/QUOTE]

Thanks Kuri$u

[QUOTE=Zodiac;112216]This deserves a bump! =)

Awsome work Trickster, I had trouble with the original script but this one works perfectly. ^_^[/QUOTE]

Heh, well thank a couple of months of honing my scripting skills and patience (this took like 2 and a half days to revise). There were plently of bugs in the older version and I didn't like how I scripted it, so it was revised and is now better than ever. ;)
Hiya tricky~
Well...I want to ask you, what have you edited at the attributes, cuz it gives me cannot convert to fixnum error with this def:
Content Hidden Spoiler
    def ap_cost
      if @power >= 0
        pow = @power
      else
        pow = 0-@power
      end
      stat_total = @sp_cost + pow + @atk_f + @eva_f + @str_f + @dex_f +
                   @agi_f + @int_f + @hit + @pdef_f + @mdef_f + @variance
      #This part here...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      element_total = @plus_state_set.size + @minus_state_set.size
      if element_total > 3
        element_total /= 2
      else
        element_total *= 2
      end
      case @id
      when 1
        return 10
      when 81
        return 2
      when 82
        return 2
      when 83
        return 2
      end
      ap_cost = stat_total / 170 + element_total
      return ap_cost
    end
  end
Expand to see the code.


thank you for any help,
cya.
Kaito;113256 wrote:
Hiya tricky~
Well...I want to ask you, what have you edited at the attributes, cuz it gives me cannot convert to fixnum error with this def:
Content Hidden Spoiler
    def ap_cost
      if @power >= 0
        pow = @power
      else
        pow = 0-@power
      end
      stat_total = @sp_cost + pow + @atk_f + @eva_f + @str_f + @dex_f +
                   @agi_f + @int_f + @hit + @pdef_f + @mdef_f + @variance
      #This part here...^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
      element_total = @plus_state_set.size + @minus_state_set.size
      if element_total > 3
        element_total /= 2
      else
        element_total *= 2
      end
      case @id
      when 1
        return 10
      when 81
        return 2
      when 82
        return 2
      when 83
        return 2
      end
      ap_cost = stat_total / 170 + element_total
      return ap_cost
    end
  end
Expand to see the code.


thank you for any help,
cya.


Please stat the full error what is trying to be convert to Fixnum

I'm sure I didn't edit any of those attributes outside of the class they are supposed to be

Hmm are you sure my script is the cause of your problem, try a p self before the line with an error take a screenshot of the popup that causes the error (I'm sure you can figure this out which the one that would cause an error)

Well you could also check if you are using Steal.rxdata to define the skills. if so are you using any invalid values
It's actuall nil can't coerced into fixnum.
An no...I never touch anything...Just copy pasted. Everyhthing was ok before though. o.O
btw, the def is in Module RPG, the skill class, could that be the problem?
I really think that this bug is on your end. Did you use the file steal.rxdata and have the using Steal.rxdata option set to true.

Next try finding this line in the script (Ctrl+Shift+F is your friend)
      # Override the skill data Run Through with index
      data.each_with_index do |item, j|
Expand to see the code.


And add this line after it
        # Skip if Setting Parameter and is nil
        next if j >= 6 and item == nil
Expand to see the code.
Tricky, is there an advantage/disadvantage to not use the steal.rxdata?
Neways...That worked~ But...when I go to battle, I get this error:
comparison of float with float failed,
in Interpeter 7, this line:
result = eval(script)
o.O

thanks,
cya~
[QUOTE=Kaito;115969]
Tricky, is there an advantage/disadvantage to not use the steal.rxdata?
[/QUOTE]

Nope its just there for an easier setup since a few months ago I was getting compliants about how hard it is to setup the skill -shrugs-

[QUOTE=Kaito;115969]
Neways...That worked~ But...when I go to battle, I get this error:
comparison of float with float failed,
in Interpeter 7, this line:
result = eval(script)
o.O

thanks,
cya~
[/QUOTE]

Hmm, are you using the call script event command in a battle event somewhere, doesn't look like its related to this script at all
I may be doing things totally wrong here, but I got everything set up in my game the same way it's set up in the demo. When I add items to the enemies (thru the change item event in the troops thing in the database) and I start the battle, the items show up in the inventory before they're even stolen. For instance, if I added three potions (like you have in the demo), I checked my inventory before the battle and there was nothing in it. When I started the battle, I checked the item command and there were three potions in it. This also happened with weapons and armor as I checked my inventory and nothing was in it, but when I started the battle (after having added several weapons and armor to the troop) and then escaped immediately after that, the weapons and armor showed up in the inventory without me ever stealing them.

After I noticed this, I went to the demo and tried the same thing, and it happened there too.

Could it be possible that I just got a bad download, or am I doing something wrong in adding items to their inventory?

--Mal
Awesome work :)

Also, this seems to work 100% with KGC's Active Count Battle system, though you'll have to change some of the "wait" values with regards to help window stuff (making it pass on C button also inputs a menu command, another button would be confusing, and the default wait time is like a flash in the KGC system). Super! :)

I spoke too soon... I keep getting the failed message regardless of whether or not the skill is working. Would there be a reason for this other than my use of a different battle system? It doesn't seem to make sense.
[QUOTE=maliwik;118532]I may be doing things totally wrong here, but I got everything set up in my game the same way it's set up in the demo. When I add items to the enemies (thru the change item event in the troops thing in the database) and I start the battle, the items show up in the inventory before they're even stolen. For instance, if I added three potions (like you have in the demo), I checked my inventory before the battle and there was nothing in it. When I started the battle, I checked the item command and there were three potions in it. This also happened with weapons and armor as I checked my inventory and nothing was in it, but when I started the battle (after having added several weapons and armor to the troop) and then escaped immediately after that, the weapons and armor showed up in the inventory without me ever stealing them.

After I noticed this, I went to the demo and tried the same thing, and it happened there too.

Could it be possible that I just got a bad download, or am I doing something wrong in adding items to their inventory?

--Mal[/QUOTE]

Umm totally wrong, what you are actuallly doing is giving items to the party. I suggest rereading the first post and try again.

[QUOTE=TofuMatt;118700]Awesome work :)

Also, this seems to work 100% with KGC's Active Count Battle system, though you'll have to change some of the "wait" values with regards to help window stuff (making it pass on C button also inputs a menu command, another button would be confusing, and the default wait time is like a flash in the KGC system). Super! :)

I spoke too soon... I keep getting the failed message regardless of whether or not the skill is working. Would there be a reason for this other than my use of a different battle system? It doesn't seem to make sense.[/QUOTE]

Hmm how did you setup the stealing skill?
I was setting it up in the script, and had turned off the steal.rxdata option. Like, the stealing skills were fine, and even when they would work, they would show the failed message. Like, if say "Ghost" had a potion, and I used a steal command, I'd steal his potion, but it would say "failed". But if I checked my items, I had a potion. It would show the failed message when it really did fail too. Same thing for skill stealing, gold stealing, etc.; they all worked, they just didn't say so :(

Remember though, I am using a LOT of other scripts (like, KGC's Active count battle), but I don't know why I'd only be running into that problem.
Quote:
Umm totally wrong, what you are actuallly doing is giving items to the party. I suggest rereading the first post and try again.


I'm not very good with setting things like this up. I checked the steal.rpgxp file and it shows:

id 153
steal Gold
#mugging false
base 100
#item_get
#type
#number
agility 50
dexerity 25
theft_defense 40
variance 15
accuracy 80

as the only entry. Sorry if I seem a bit bad at things like this, but I reread the whole post, and I'm not quite sure how to set up individual monsters to have certain items. When I tried the demo, the items were added through the troop database event thing, so I did the same thing with my game. Do I have to add items to monsters through one of the files?

Again, sorry if I seem a bit newbish at this.

--Mal
Hi. This script is brilliant! Well could you do me a favor? I've been fiddling around with it and when I used Scan, the parametres work fine but the EVA and EXP are not all in capital. I know it's just a little thing, not even important enough to mention but I wonder if you could help me out with this. I really appriciate very much if you would spent some time doing this for me. Thank you!!! (^o^)b Your scripts rock!!
Saru
Monkeyintown, all you need to do is open the script and press CTRL + F and search for what you want changing and aslong as its in quotation marks, you can rename it to whatever you want.
EDIT Mac, you were very close :P

Script Customizations

find this line
      # Just Capitalize it
      name = array[type].capitalize
Expand to see the code.


and change it to this

      # All Capitalized letters
      name = array[type].upcase
Expand to see the code.


and Thanks
It works! You're my hero. Arigato m(_ _)m
saru
Funny how I've used Steal for a couple months and I never noticed this. Your newer one's skills2.rxdata completely overwrites the skills in the system, so whatever you have in skills.rxdata (which appears normally in the editor) won't make a bit of difference.

Didn't notice until some other systems that used 'Element Tagging' stopped working. Tsk Tsk... gotta let a guy know about that... :wink01:

* * * * *


Basically... I could use the steal.rxdata file as a 'template' file, filling out whatever 'STEAL' effect values I want. Then when I run my project, it overwrites the skill I indicate in steal.rxdata and the new values get saved in skills2.rxdata... ready for use.

Steal.rxdata Spoiler
#a comment not read by the script
#
#Here is how you set up a skill steal
#
# * means the argument is required
#*1)id
#   The id of the skill to overwrite
#*2)steal
#   The steal type (Item, Gold, Exp, Skill, HRSkill)
#      note: HRSKill = Highest Rated Skill
# 3)Mugging
#    set this to true if you want the skill user to also attack the enemy
#
#4)base
#   For Gold and Exp Stealing the base amount stolen
#      note: (leave blank for base = enemy gold)
#   For Skill Stealing The amount of turns the skill is stolen
#      note: Set this to true = stolen forever and set to false to steal just for the battle
#5)item_get
#   For Item Stealing The id of the item given to the player
#      note: (leave blank for item = enemy item)
#6)type
#   For Item Stealing The type of the item given 1 weapon 2 armor 3 item
#   For Skill Stealing  1 = steal last skill 2 = copy skill 3 = copy last skill
#7)number
#   The maximum number that could be stolen
#8)agility
#   Agility influence
#9)dexerity
#   Dexerity influence
#10)Theft Defense
#  For Exp and Gold Stealing the Defensiveness Influence
#11)variance
#   For Gold and Exp Stealing the variance
#12)accuracy
#   Accuracy

id      81
steal      Gold
#mugging   false
base      100
#item_get
#type
#number
agility      50
dexerity   25
theft_defense   40
variance   15
accuracy   80
Expand to see the code.

OR...

I can create or edit skills2.rxdata directly by editing it as skills.rxdata (as long as I know the proper values to fill in or system elements to tag).

The values I believe Spoiler
And in the Skill Database's layout:
SP    = regular    POWER = Item Get   ATK-F  = 0(n/a)      EVA-F = number
STR-F = 0(n/a)     DEX-F = Dexterity  AGI-F  = Agility     INT-F = 2 (1 - 9+)
HIT   = Accuracy   PDEF  = 0(n/a)     MDEF-F = Theft Def   VAR   = variance
                                                                   (or 1/2/3 if Item Steal)
Expand to see the code.
(Please... feel free to edit if I'm wrong)

And, I also have the luxury of not using steal.rxdata & skills2.rxdata (and just use skills.rxdata alone) by turning Using_Steal_Rxdata = false.

Correct?
I remember telling you about this before :P

Ok here's how the system works

See these Constants in the Setup Script
  #--------------------------------------------------------------------------
  # * Save Data - If encrypting your project set this to true
  #   (Run project at least once (goto your starting map) before encrypting)
  #   This will prevent errors saying that Steal.rxdata can't be found when
  #   project is encrypted
  #--------------------------------------------------------------------------
  Save_Data = true
  #--------------------------------------------------------------------------
  # * If you want the data to be read by file (enables Steal.rxdata)
  #--------------------------------------------------------------------------
  Using_Steal_Rxdata = true
Expand to see the code.


Now the file Steal.rxdata is only there since a few months ago I was getting complaints about the skills being too hard to setup so I created a text file and setting those options in the text file will automatically create the skill for you.

Now if Steal.rxdata doesn't exist then either the file wasn't copied or the project is encrypted since all folders located in the Data Folder will be encrypted you can't use File.open to get the contents, and if its placed outside the folder then what's to say that someone who plays the game go and edit it in notepad.

Now what the script does if the Save_Data Option is set to true is create a copy of the Skills the mysterious Skills2.rxdata that has everyone puzzled. Then if Steal.rxdata can't be opened (It doesn't exist or project encrypted) It will load Skills2.rxdata which has the steal skills already setup.

Now if you just copy Skills2.rxdata then whoops when you test play your game all of the default skills will be loaded (+ the ones I setup in the demo)

So if you plan on using the Text file then set this Constant
  Using_Steal_Rxdata = true
Expand to see the code.
to true and copy the file Steal.rxdata from the demo else set it to false and don't copy anything else

Also note this method is also used in any script that uses a text file for input Advanced Battle Commands => Commands.rxdata, Advanced Enemy Actions => Actions.rxdata (this will change since it is the same file as the text input)

But thinking back what's the harm if I didn't create the Skills2.rxdata file and just save it to the regular old Skills.rxdata file
And Revised Again, this time there is no Skills2.rxdata file being created (although if its in the data folder just ignore it.)
hey can you post this on my site rpgcraze.bravehost.com thanks
I've realized this is the final version, but I wanted to know if when a character steals exp, and levels up from stealing it, it could show that he/she leveled up during the battle?
Updated to Version 6.3

Nothing was changed, technically, but its now compliant with SDK 2.1
For some reason, the skill id 81 of my game is being treated as a gold stealing skill, actually I tried almost everything even id swap(was when I realized that the 81 was the problem), here go my reports:
Script version: 6.3
SDK Version: 2.1
Problematic skill ID: 81
Actual skill in that ID: Syphon
Skill Description: Drains MP from the target(also known as Osmose or Aspir from FF games)
Skill method used:
This code is above the element checking and below damage calculation.
      if skill.name == "Syphon"
        $game_temp.mp_damaging = true
        self.damage = [skill.power*1.125*(2+user.int*(user.level+user.int)/256),self.sp].min
        $game_temp.drain_value = self.damage
end
Expand to see the code.

And this one substitutes the regular HP subtraction
if self.damage.is_a?(Numeric)
  if $game_temp.mp_damaging == true
    last_sp = self.sp
    self.sp -= self.damage
    effective |= self.sp != last_sp
  else
    last_hp = self.hp
    self.hp -= self.damage
    effective |= self.hp != last_hp
  end
end
Expand to see the code.

Both codes are placed at Game_Battler3 in the skill_effect method, obviously the game_temp variables must be set as well as a level variable at Game Battler.
Just in case I'll put it here:
def initialize
@level_plus = 0
end

def level
  n = [[level, 1].max, 99].min
  n = [[Integer(n), 1].max, 99].min
  return n
end

def level=(level)
  @level_plus += level - self.level
  @level_plus = [[@level_plus, -99].max, 99].min
end
Expand to see the code.


Bad coded I know, it was made in a rush that day and I'm just too lazy to remake it ><
If is there any missing info above, tell me and I'll just add it.
Of Course Skill id 81 is the problem I more than likely suspect that you didn't set

  Using_Steal_Rxdata = true
Expand to see the code.


To false but you copied Steal.rxdata and if I remember correctly I defined skill id 81 so it gets redefined

just remove the file and set that constant to false

so many problems dealing with that maybe I should just get rid of it for the next rewrite :-/
LoL, that was a perfect shot!
It's working fine again thanks.
nvm this post, already found the answer on my problem, great script tough ;)
for some reason, it won't let me use scan. it says something about a shadow on line 26 in customizations. the usual nil stuff.

i can't use SDK due to the fact that most of my scripts don't rely on SDK. If it was easy for a Ruby noob like me to change that, i would.

Original thread: https://www.hbgames.org/forums/viewtopic.php?t=5151