RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
Jet's Code Snippets (44 Total)

0 Members and 1 Guest are viewing this topic.

**
Rep:
Level 82
Jet10985's code snippets

Introduction

Spoiler for:
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.

Snippets

Spoiler for:
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


If you use any of these snippets, please credit me and anyone I credit in the snippet
« Last Edit: April 27, 2011, 05:40:45 PM by modern algebra »



*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
Wow, that's a ton of scripts. I'll have to check them out :)

**
Rep:
Level 82
Well, most are pretty small, but thanks for checking them out ;)



****
Rep:
Level 83
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.
« Last Edit: April 16, 2010, 01:17:51 AM by Mr_Wiggles »
Spoiler for:
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


*
? ? ? ? ? ? ? ? ? The nice kind of alien~
Rep:
Level 92
Martian - Occasionally kind
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
Code: [Select]
unless $engine_scripts.nil?
  JetEngine.active("Run/Guard Hotkey", 1)
end

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

*hugs*

*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
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:
Code: [Select]
   if $engine_scripts.include?(name)
      return true
    else
      return false
    end

It's not a big deal, but it could be replaced with:
Code: [Select]
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.
« Last Edit: April 16, 2010, 02:48:53 PM by modern algebra »

**
Rep:
Level 82
@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?



*
Rep:
Level 97
2014 Most Unsung Member2014 Best RPG Maker User - Engine2013 Best RPG Maker User (Scripting)2012 Best Member2012 Best RPG Maker User (Scripting)2012 Favorite Staff Member2012 Most Mature MemberSecret Santa 2012 ParticipantProject of the Month winner for July 20092011 Best Veteran2011 Favourite Staff Member2011 Most Mature Member2011 Best RPG Maker User (Scripting)2011 Best Use of Avatar and Signature Space2010 Most Mature Member2010 Favourite Staff Member
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.

**
Rep:
Level 82
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 ;)



*****
Rep:
Level 84
This text is way too personal.
Bronze - GIAW 11 (Hard)Silver - GIAW Halloween
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,

Code: [Select]
def screen
    if $game_temp.in_battle
      return $game_troop.screen
    else
      return $game_map.screen
  end
end

Could just as easily be:

Code: [Select]
  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.

**
Rep: +0/-0Level 80
RMRK Junior
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 for:
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.


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!

**
Rep: +0/-0Level 75
RMRK Junior
On mediafire can't download so it's delete

***
Rep:
Level 81
link is broken. please give us a new one.


**
Rep:
Level 70
Furry Et Al
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?
« Last Edit: June 10, 2011, 10:07:41 PM by merryjest »

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
For the second error, put a line in after line 196 that simply says:
Code: [Select]
include ActorApprovalRating
For 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

**
Rep:
Level 70
Furry Et Al
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)

*****
my name is Timothy what's yours
Rep:
Level 79
Hello
2014 Most Missed Member2014 Zero to Hero2014 Best IRC Quote2012 Zero To HeroSecret Santa 2012 ParticipantContestant - GIAW 9For frequently finding and reporting spam and spam bots2011 Zero to Hero
Interesting. Try changing all mentions of approval_rating from lines 200-208 to
Code: [Select]
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

**
Rep:
Level 70
Furry Et Al
Unfortunately that causes a syntax error :/

**
Rep: +0/-0Level 67
RPGVX Advanced (I Do Not Script Tough)
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? :(

**
Rep: +0/-0Level 84
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:

Code: [Select]
#===============================================================================
# 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
« Last Edit: August 06, 2011, 08:58:20 AM by Jensen »

**
Rep:
Level 65
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:

Code: [Select]
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
« Last Edit: November 06, 2011, 04:59:55 PM by oriceles »

**
Rep:
Level 63
RMRK Junior
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?