Pastebin
API
tools
faq
paste
Login
Sign up
Please fix the following errors:
New Paste
Syntax Highlighting
#=============================================================================== # DPPt Honey Trees - By Vendily [v17/v18] #=============================================================================== # This script adds in Honey Trees from DPPt, and all the bells and whistles # as described on Bulbapedia. That means Tree Shakes, The Group A/B/C, Munchlax # trees, all that jazz. #=============================================================================== # To use it, you must create an event named "HoneyTree(X)", where X is the # tree's id (zero indexed). More than one event can have the same id, they # will act like the same tree in that case. The script will find these events # when you interact with them, much like how boulders ask to use strength. # Place these events at the base of your honey tree. They can only be interacted # from the the bottom (facing up). Remove the "next if $game_player.direction!=8" # to disable that behavior. # You can technically put event commands in the Honey Tree event, but they # activate after the honey tree asks to slather honey. # The species is fixed as soon as the honey is applied, much like DPPt. # Soft resets will only change the generated properties like level and nature. # There are 4 Munchlax trees, calculated using the HONEYTREE_MAX_TREES and the # Trainer ID. If HONEYTREE_MAX_TREES is less than 4, the Munchlax trees will # stack up. I don't recommend fewer than 5 trees, but it won't break. #=============================================================================== # * The Total number of trees in the game. Try not to change it after release, # doing so will cause Munchlax trees to be recalculated and probably change. # Ideally should be more than 4. # * Time before the tree will show that there is an encounter in the tree. # (Default 6 hours) # * Time before the honey fades away and the encounter is lost. (Default 24 hours) # * The animation ids used to show a pokemon in the tree. # * The ratios used to calculate the number of shakes for a given group. # * The encounter table. Groups A and B must have the same number of entries as # HONEYTREE_ENCOUNTER_RATIOS, but Group C is a 1:1 ratio and can have any # length # * The ratios used to generate a species in Groups A and B. # Think Encounter Densities, that's this. #=============================================================================== begin PluginManager.register({ :name => "DPPt Honey Trees", :version => "1.0", :link => "https://reliccastle.com/resources/422/", :credits => "Vendily" }) rescue # not v18 end HONEYTREE_MAX_TREES = 5 HONEYTREE_TIME_ENCOUNTER = 6*60*60 # 6 hours HONEYTREE_TIME_FADE = 24*60*60 # 24 hours HONEYTREE_TREESHAKE_ANIMS=[ RUSTLE_NORMAL_ANIMATION_ID, # 0 shakes, but there is a mon RUSTLE_VIGOROUS_ANIMATION_ID, # 1 shake RUSTLE_SHINY_ANIMATION_ID, # 2 shakes PLANT_SPARKLE_ANIMATION_ID # 3 shakes ] HONEYTREE_TREESHAKE_RATIOS=[ [20,59,20,1], [1,20,75,4], [1,1,5,93] ] HONEYTREE_ENCOUNTER_GROUPS=[ [:COMBEE,:WURMPLE,:BURMY,:CHERUBI,:AIPOM,:AIPOM], # Group A [:BURMY,:CHERUBI,:COMBEE,:AIPOM,:AIPOM,:HERACROSS], # Group B [:MUNCHLAX] # Group C ] HONEYTREE_ENCOUNTER_RATIOS=[40,20,20,10,5,5] class PokemonGlobalMetadata attr_accessor :honeytrees attr_accessor :lasthoneytree def honeytrees @honeytrees=[] if !@honeytrees return @honeytrees end end Events.onAction+=proc{|sender,e| next if $game_player.direction!=8 facingEvent = $game_player.pbFacingEvent if facingEvent && facingEvent.name[/HoneyTree\((\d+)\)/] pbHoneyTree($~[1].to_i) end } def pbHoneyTree(tree) raise "Invalid tree ID #{tree}" if tree>=HONEYTREE_MAX_TREES treedata=$PokemonGlobal.honeytrees[tree] now=pbGetTimeNow if !treedata || now-treedata[2]>HONEYTREE_TIME_FADE Kernel.pbMessage(_INTL("There is a sweet scent in the air...\\1")) elsif now-treedata[2]<HONEYTREE_TIME_ENCOUNTER Kernel.pbMessage(_INTL("The bark is slathered with Honey...\\1")) elsif treedata[0]>0 # in window, active tree Kernel.pbMessage(_INTL("Oh! A Pokémon is in the tree!")) pbWildBattle(treedata[0],rand(11)+5) $PokemonGlobal.honeytrees[tree]=nil return else Kernel.pbMessage(_INTL("The bark is slathered with Honey...\\1")) end if $PokemonBag.pbHasItem?(:HONEY)&& Kernel.pbConfirmMessage(_INTL("Slather the bark with Honey?")) $PokemonBag.pbDeleteItem(:HONEY,1) lasttree=$PokemonGlobal.lasthoneytree group=nil if lasttree && lasttree[0]==tree && rand(10)>0 # 90% chance to repick group=lasttree[1] group=0 if group==3 end if !group if honey_tree_munchlax.include?(tree) ratio=[20,70,1,9] else ratio=[70,20,0,10] end total=ratio[0]+ratio[1]+ratio[2]+ratio[3] num=rand(total) cumtotal=0 for i in 0...4 cumtotal+=ratio[i] if num<cumtotal group=i break end end end now=pbGetTimeNow if group<3 # if pokemon, generate species table=HONEYTREE_ENCOUNTER_GROUPS[group] if group==2 # munchlax species=getID(table[rand(table.length)]) else ratio=HONEYTREE_ENCOUNTER_RATIOS total=0 ratio.each{|r| total+=r} num=rand(total) cumtotal=0 for i in 0...4 cumtotal+=ratio[i] if num<cumtotal species=table[i] break end end end ratio=HONEYTREE_TREESHAKE_RATIOS[group] total=0 ratio.each{|r| total+=r} num=rand(total) cumtotal=0 for i in 0...4 cumtotal+=ratio[i] if num<cumtotal shakes=i break end end mon=[getID(PBSpecies,species),group,now,shakes] else mon=[0,3,now] end $PokemonGlobal.lasthoneytree=[tree,group] $PokemonGlobal.honeytrees[tree]=mon Kernel.pbMessage(_INTL("The bark was slathered with Honey.")) end end def honey_tree_munchlax id=$Trainer.id sid1,sid2,tid1,tid2=id&(0xFF<<24),id&(0xFF<<16),id&(0xFF<<8),id&(0xFF) a=sid1 % HONEYTREE_MAX_TREES b=sid2 % HONEYTREE_MAX_TREES c=tid1 % HONEYTREE_MAX_TREES d=tid2 % HONEYTREE_MAX_TREES if a==b b+=1 b%=HONEYTREE_MAX_TREES end if a==c c+=1 c%=HONEYTREE_MAX_TREES elsif b==c c+=1 c%=HONEYTREE_MAX_TREES end if a==d d+=1 d%=HONEYTREE_MAX_TREES elsif b==d d+=1 d%=HONEYTREE_MAX_TREES elsif c==d d+=1 d%=HONEYTREE_MAX_TREES end return [a,b,c,d] end class HoneyTreeSprite def initialize(event,map,viewport) @event=event @map=map @disposed=false @frames=0 @frameskip=25+rand(10)+rand(10) event.name[/HoneyTree\((\d+)\)/] @treeid=$~[1].to_i end def dispose @event=nil @map=nil @disposed=true end def disposed? @disposed end def update @frames+=1 if @frames>=@frameskip @frames=0 treedata=$PokemonGlobal.honeytrees[@treeid] now=pbGetTimeNow return if !treedata return if now-treedata[2]<HONEYTREE_TIME_ENCOUNTER return if now-treedata[2]>HONEYTREE_TIME_FADE return if treedata[0] && treedata[0]<=0 return if !$scene.spriteset $scene.spriteset.addUserAnimation(HONEYTREE_TREESHAKE_ANIMS[treedata[3]],@event.x, @event.y-1,true) end end end Events.onSpritesetCreate+=proc{|sender,e| spriteset=e[0] viewport=e[1] map=spriteset.map for i in map.events.keys if map.events[i].name[/HoneyTree\((\d+)\)/] spriteset.addUserSprite(HoneyTreeSprite.new(map.events[i],map,viewport)) end end }
Optional Paste Settings
Category:
None
Cryptocurrency
Cybersecurity
Fixit
Food
Gaming
Haiku
Help
History
Housing
Jokes
Legal
Money
Movies
Music
Pets
Photo
Science
Software
Source Code
Spirit
Sports
Travel
TV
Writing
Tags:
Syntax Highlighting:
None
Bash
C
C#
C++
CSS
HTML
JSON
Java
JavaScript
Lua
Markdown (PRO members only)
Objective C
PHP
Perl
Python
Ruby
Swift
4CS
6502 ACME Cross Assembler
6502 Kick Assembler
6502 TASM/64TASS
ABAP
AIMMS
ALGOL 68
APT Sources
ARM
ASM (NASM)
ASP
ActionScript
ActionScript 3
Ada
Apache Log
AppleScript
Arduino
Asymptote
AutoIt
Autohotkey
Avisynth
Awk
BASCOM AVR
BNF
BOO
Bash
Basic4GL
Batch
BibTeX
Blitz Basic
Blitz3D
BlitzMax
BrainFuck
C
C (WinAPI)
C Intermediate Language
C for Macs
C#
C++
C++ (WinAPI)
C++ (with Qt extensions)
C: Loadrunner
CAD DCL
CAD Lisp
CFDG
CMake
COBOL
CSS
Ceylon
ChaiScript
Chapel
Clojure
Clone C
Clone C++
CoffeeScript
ColdFusion
Cuesheet
D
DCL
DCPU-16
DCS
DIV
DOT
Dart
Delphi
Delphi Prism (Oxygene)
Diff
E
ECMAScript
EPC
Easytrieve
Eiffel
Email
Erlang
Euphoria
F#
FO Language
Falcon
Filemaker
Formula One
Fortran
FreeBasic
FreeSWITCH
GAMBAS
GDB
GDScript
Game Maker
Genero
Genie
GetText
Go
Godot GLSL
Groovy
GwBasic
HQ9 Plus
HTML
HTML 5
Haskell
Haxe
HicEst
IDL
INI file
INTERCAL
IO
ISPF Panel Definition
Icon
Inno Script
J
JCL
JSON
Java
Java 5
JavaScript
Julia
KSP (Kontakt Script)
KiXtart
Kotlin
LDIF
LLVM
LOL Code
LScript
Latex
Liberty BASIC
Linden Scripting
Lisp
Loco Basic
Logtalk
Lotus Formulas
Lotus Script
Lua
M68000 Assembler
MIX Assembler
MK-61/52
MPASM
MXML
MagikSF
Make
MapBasic
Markdown (PRO members only)
MatLab
Mercury
MetaPost
Modula 2
Modula 3
Motorola 68000 HiSoft Dev
MySQL
Nagios
NetRexx
Nginx
Nim
NullSoft Installer
OCaml
OCaml Brief
Oberon 2
Objeck Programming Langua
Objective C
Octave
Open Object Rexx
OpenBSD PACKET FILTER
OpenGL Shading
Openoffice BASIC
Oracle 11
Oracle 8
Oz
PARI/GP
PCRE
PHP
PHP Brief
PL/I
PL/SQL
POV-Ray
ParaSail
Pascal
Pawn
Per
Perl
Perl 6
Phix
Pic 16
Pike
Pixel Bender
PostScript
PostgreSQL
PowerBuilder
PowerShell
ProFTPd
Progress
Prolog
Properties
ProvideX
Puppet
PureBasic
PyCon
Python
Python for S60
QBasic
QML
R
RBScript
REBOL
REG
RPM Spec
Racket
Rails
Rexx
Robots
Roff Manpage
Ruby
Ruby Gnuplot
Rust
SAS
SCL
SPARK
SPARQL
SQF
SQL
SSH Config
Scala
Scheme
Scilab
SdlBasic
Smalltalk
Smarty
StandardML
StoneScript
SuperCollider
Swift
SystemVerilog
T-SQL
TCL
TeXgraph
Tera Term
TypeScript
TypoScript
UPC
Unicon
UnrealScript
Urbi
VB.NET
VBScript
VHDL
VIM
Vala
Vedit
VeriLog
Visual Pro Log
VisualBasic
VisualFoxPro
WHOIS
WhiteSpace
Winbatch
XBasic
XML
XPP
Xojo
Xorg Config
YAML
YARA
Z80 Assembler
ZXBasic
autoconf
jQuery
mIRC
newLISP
q/kdb+
thinBasic
Paste Expiration:
Never
Burn after read
10 Minutes
1 Hour
1 Day
1 Week
2 Weeks
1 Month
6 Months
1 Year
Paste Exposure:
Public
Unlisted
Private
Folder:
(members only)
Password
NEW
Enabled
Disabled
Burn after read
NEW
Paste Name / Title:
Create New Paste
Hello
Guest
Sign Up
or
Login
Sign in with Facebook
Sign in with Twitter
Sign in with Google
You are currently not logged in, this means you can not edit or delete anything you paste.
Sign Up
or
Login
Public Pastes
Easiest method for beginners
CSS | 4 min ago | 0.99 KB
Money comes easy nowadays
CSS | 4 min ago | 0.99 KB
BTC SWAP GLITCH
CSS | 4 min ago | 0.99 KB
Changelly Hacked
CSS | 4 min ago | 0.99 KB
Exploit Documentation
CSS | 4 min ago | 0.99 KB
Exploit found by AI
CSS | 4 min ago | 0.99 KB
Untitled
33 min ago | 0.42 KB
.zshrc
Bash | 54 min ago | 1.23 KB
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the
Cookies Policy
.
OK, I Understand
Not a member of Pastebin yet?
Sign Up
, it unlocks many cool features!