Main Menu
  • Welcome to The RPG Maker Resource Kit.

Jet's Code Snippets (44 Total)

Started by jet10985, April 15, 2010, 11:46:13 PM

0 Members and 1 Guest are viewing this topic.

jet10985

Jet10985's code snippets

Introduction

[spoiler]This is my collection of code snippets i make for fun. I just release to the public in case they want them or see them as handy. This is not a shop, don't ask me to write you a snippet. I write these in my spare time and therefore, requests ruin my fun.[/spoiler]

Snippets

[spoiler]Due to the post character limit, I cannot post my snippets all seperate and such...

So, i'll post a link to my updated script collection which contains all my snippet/scripts in their newest forms. Please note the collection does not demonstrate them, it just holds all of them into convenient categories. =)

Here is the collection for you to enjoy.

Link is broken, so I attached it to the bottom of this post[/spoiler]


If you use any of these snippets, please credit me and anyone I credit in the snippet



modern algebra

Wow, that's a ton of scripts. I'll have to check them out :)

jet10985

Well, most are pretty small, but thanks for checking them out ;)



Mr_Wiggles

#3
Some times the small ones make the biggest im packs.

[edit] your menu is odd, when you click load it moves the selector up to save.  NVM, i just realized that its not a demo only a holder for the scripts, my bad.  Nice collection.
[spoiler]
METALFRESH is a paint contractor that specializes in refinishing metal and vinyl siding. We paint metal buildings as well as siding on homes.

We also

    Refinish decks
    Do custom interior painting
    Strip wallpaper
    Refinish cedar siding
    Metal front doors and sidelights
    Metal garage and service doors
    Grained fiberglass doors

    If your structure is *RUSTED *FADED *CHALKING *IN NEED OF COLOR CHANGE, we can fix it with a guarentee!

northern Illinois and southern Wisconsin.

http://metalfreshcoatings.com

[/spoiler]

Zeriab

I had a quick look and have some comments for your JetEngine
I would suggest that you don't expose the inner data structures through global variables, but rather provide module methods for what you currently are using them for.
You already have come a good way with current module method.

Instead of
unless $engine_scripts.nil?
  JetEngine.active("Run/Guard Hotkey", 1)
end


you can use
if Module.constants.include?("JetEngine")
  JetEngine.active("Run/Guard Hotkey", 1)
end


*hugs*

modern algebra

#5
Well, it looks pretty good jet :) I'm adding them to the index now.

A couple things have popped out at me so far. First of all, this:

   if $engine_scripts.include?(name)
     return true
   else
     return false
   end


It's not a big deal, but it could be replaced with: return $engine_scripts.include?(name)

It's just a little nicer. If you take Zeriab's advice, then you'd be getting rid of that global variable, but all I'm talking about is the if else branch aspect of it.

Also, your Change Actor Options script doesn't really work - it modifies the $data_ array but it doesn't actually modify the data file (which you wouldn't want either), so the next time you load the game it will revert to the default.

Also, when you use the change_two_swords_style method you should be careful and unequip whatever the actor might have in his second hand before doing it. Otherwise, it will convert whatever armor/weapon he has in it to the weapon/armor of the same ID.

jet10985

@zeriab: Thanks for the advice, i really appreciate new ways to do things. I think i'll keep it the way it is for now though, so i don't have to go through changing stuf ;)

@MA: Yeah, the method isn't my best.
As for the change Actor Options, i had no idea about the reverting thing. Any way you can help me with that?



modern algebra

Sorry, I never got back to you with that I just realized :( Whoops. Anyway, it's not too difficult - all you'd need to do is save the change in a variable, probably in Game_Actor. Then you could just make it so that those methods in Game_Actor, instead of returning the data, return the one you saved.

jet10985

Well uh, been a while since i was on here, just letting ya know i updated the demo to hold all my current snippets (44 now, not 34) and scripts. Also MA, i fixed that Actor Options snippet ;)



cozziekuns

Nice job Jet! These snippets seem to be nice ways of adding in small features that make the game look more professional, or ways of making things easier for regular people. I took a look at your demo and I walked around a bit and I got an error.

Script: 'Hunger/Thirst' line 546 NoMethodError
undefined method 'hunger' for Nil:NilClass

I kept everything as it was in the demo.

Also, I looked around at some other scripts. They should work fine, but there are some parts that could look a bit nicer. Unless I'm mistaken,


def screen
    if $game_temp.in_battle
      return $game_troop.screen
    else
      return $game_map.screen
  end
end


Could just as easily be:


  def screen
    return $game_troop.screen if $game_temp.in_battle
    return $game_map.screen
  end


Which doesn't really matter, but it looks nicer IMO and takes up less lines in the Script Editor.

ddewerg

Help it dosent work! :'( when i run demo it says
Script hunger/thirst no method error undefined method hunger for nil:nilclass
Nobody is perfect, therefore i am Nobody


[spoiler]Cna yuo raed tihs? Olny 55% of plepoe can.
I cdnuolt blveiee taht I cluod aulaclty uesdnatnrd waht I was rdanieg. The phaonmneal pweor of the hmuan mnid, aoccdrnig to a rscheearch at Cmabrigde Uinervtisy, it dseno't mtaetr in waht oerdr the ltteres in a wrod are, the olny iproamtnt tihng is taht the frsit and lsat ltteer be in the rghit pclae. The rset can be a taotl mses and you can sitll raed it whotuit a pboerlm. Tihs is bcuseae the huamn mnid deos not raed ervey lteter by istlef, but the wrod as a wlohe. Azanmig huh? yaeh and I awlyas tghuhot slpeling was ipmorantt!
fi yuo cna raed tihs, palce it in yuor siantugre.[/spoiler]


Click here to feed me a !
Get your own at Pokeplushies!


Click here to feed me a !
Get your own at Pokeplushies!


Click here to feed me a !
Get your own at Pokeplushies!

Linkx7

On mediafire can't download so it's delete

rofl1337

link is broken. please give us a new one.

modern algebra


merryjest

#14
Please forgive me if this is an egregious necropost, but I searched on the forum for any other posts dealing with issues concerning the snippet collection and found only one- unresolved. So, I thought it would be best to post on the original thread in the slim chance someone was watching. Here it is:


Jet, I get two errors using your script:



The first, A, is from my own game, when I try to increase actor approval by a called script.
The second, B, is from your own demo with no add-ons, again trying to do the same thing (I decided to test it on the demo itself to see what was going on)---  the instructions say to use the format of change_approval(1,2)  in called script (actor 1 gets +2 approval), but this is the error that pops up when you try them. Any ideas of what could be wrong?

pacdiggity

For the second error, put a line in after line 196 that simply says:include ActorApprovalRatingFor the first error, can you tell us what you used as the script call?
it's like a metaphor or something i don't know

merryjest

Thanks for replying, Pacman!

Well, in the instructions it says:

To increse/decrease approval, use this in the event "Script..." command:
change_approval(actor, amount)
actor = actor id you want to change approval of.
amount = how much you want to change it by. Use a negative number to subtract.


So that's basically what I did, I had it call a script after a conversation branch choice with: change_approval(1,2)

pacdiggity

Interesting. Try changing all mentions of approval_rating from lines 200-208 to approval_rating?
That error occurred because there's no method for "approval_rating" in Game_Actor, but there is one for "approval_rating?". That's all I can do for now.
it's like a metaphor or something i don't know

merryjest

Unfortunately that causes a syntax error :/

digdarkevil

Your Scripts Are Awesome  ;D
but
im having some problems with the cheats scripts   ;9
and i dont know how to pm you cuz im new to this website
ok so here my problem.. when i put the script below materials OR above main,i run the game and everything is going fine until i open the menu window ,, its said scipt ''window_selectable'' line 100
no methoderror Occur undefined method for (nil,nil,nil,nil,nil,nil,nil,nil,nil)array  ;9
can You Please Help Me out? :(

Jensen

#20
Yo!

Nicely done!

I´m using the Set Actor's Max Level-snippet, and I wonder if there
is some way (maybe via a script call) to change the max level for
the actors in-game?

EDIT:

Jet updated his script to support this feature:

#===============================================================================
# Set Actor's Max Level Snippet
# By Jet10985 (Jet)
#===============================================================================
# This snippet will allow you to set each actor to have an individual maximum
# level that they can reach in-game.
# This script has: 1 customization options.
#===============================================================================
# Overwritten Methods:
# None
#-------------------------------------------------------------------------------
# Aliased methods:
# Game_Actor: make_exp_list
#===============================================================================
=begin
How to Use:

Below these instructions is the area to choose actor maximum levels. The format
is stated next to the example. If you want more actors on these, add a comma
then follow the format of

actor id => max level
--------------------------------------------------------------------------------
To change an actor's max level, use this in an Event "Script..." command:

change_max_level(actor_id, new_max_level)

actor_id = the database id of the actor
new_max_level = the new max level of course
=end

module ActorMaxLevel

  MAX_LEVELS = {
 
  1 => 99, # actor id => max level
  2 => 20, # actor id => max level
  3 => 30,
  4 => 2   # actor id => max level
 
  }
 
  MAX_LEVELS.default = 99 # The max level for any undefined actor.
 
end

#===============================================================================
# DON'T EDIT FURTHER UNLESS YOU KNOW WHAT TO DO.
#===============================================================================
class Game_Actor
 
  include ActorMaxLevel
 
  alias jet8888_make_exp_list make_exp_list unless $@
  def make_exp_list(*args, &block)
    jet8888_make_exp_list(*args, &block)
    if @exp_list[MAX_LEVELS[@actor_id] + 1] != 0
      @exp_list[MAX_LEVELS[@actor_id] + 1] = 0 if MAX_LEVELS[@actor_id] != nil
    end
  end
 
  def exp_list
    return @exp_list
  end
end

class Game_Interpreter
 
  def change_max_level(actor_id, new_max_level)
    f = $game_actors[actor_id]
    f.change_exp(f.exp_list[ActorMaxLevel::MAX_LEVELS[actor_id]], false)
    ActorMaxLevel::MAX_LEVELS[actor_id] = new_max_level
    f.make_exp_list
  end
end

oriceles

#21
I'm new at the forum and I'm sorry for the necroposting, but i'm using the "learn skill item" snippet. There's no way to exclude the actors that can consume an specific Item? I'm not a programmer but i'm sure it would be something like this:


21 => 3, 1 # Item id => Skill id, Classes that can use this item
  22 => 5, 1 # Item id => Skill id, Classes that can use this item
  23 => 7, 8  # Item id => Skill id, Classes that can use this item


EDIT: Bump, and have another request. Theres no way to call the  the cheat system from a NPC instead of the menú?  :'( I'm really looking for that feature

nemrog

I don't know if it's cause I'm using a Laptop or what but I can't get the Record Window to Pop up. Is there a quick fix to that problem?