Notices
For all updates, view the main page.

Pokémon Essentials All questions and discussion about Pokémon Essentials, the Pokémon game kit for RPG Maker XP, go in here. Also contains links to the latest downloads and the Essentials Wiki.

Reply
 
Thread Tools
  #1    
Old August 20th, 2016 (7:01 PM). Edited August 20th, 2016 by mej71.
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 71
hi i need help with the script Mystery Gift :s
i use this one
Spoiler:
Quote:
################################################################################
# Mystery Gift system
# By Maruno
################################################################################
# This url is the location of an example Mystery Gift file.
# You should change it to your file's url once you upload it.
################################################################################
MYSTERYGIFTURL = "http://pastebin.com/raw/Q86kGF0H"



class PokeBattle_Trainer
attr_accessor(:mysterygiftaccess) # Whether MG can be used from load screen
attr_accessor(:mysterygift) # Variable that stores downloaded MG data

def mysterygiftaccess
@mysterygiftaccess=true if [email protected]
return @mysterygiftaccess
end

def mysterygift
@mysterygift=[] if [email protected]
return @mysterygift
end
end



################################################################################
# Creating a new Mystery Gift for the Master file, and editing an existing one.
################################################################################
# type: 0=Pokémon; 1 or higher=item (is the item's quantity).
# item: The thing being turned into a Mystery Gift (Pokémon object or item ID).
def pbEditMysteryGift(type,item,id=0,giftname="")
begin
if type==0 # Pokémon
commands=[_INTL("Mystery Gift"),
_INTL("Faraway place")]
commands.push(item.obtainText) if item.obtainText && item.obtainText!=""
commands.push(_INTL("[Custom]"))
loop do
command=Kernel.pbMessage(
_INTL("Choose a phrase to be where the gift Pokémon was obtained from."),commands)
if command>=0 && command<commands.length-1
item.obtainText=commands[command]
break
elsif command==commands.length-1
obtainname=Kernel.pbMessageFreeText(_INTL("Enter a phrase."),"",false,32)
if obtainname!=""
item.obtainText=obtainname
break
end
return nil if Kernel.pbConfirmMessage(_INTL("Stop editing this gift?"))
elsif command==-1
return nil if Kernel.pbConfirmMessage(_INTL("Stop editing this gift?"))
end
end
elsif type>0 # Item
params=ChooseNumberParams.new
params.setRange(1,99999)
params.setDefaultValue(type)
params.setCancelValue(0)
loop do
newtype=Kernel.pbMessageChooseNumber(_INTL("Choose a quantity."),params)
if newtype==0
return nil if Kernel.pbConfirmMessage(_INTL("Stop editing this gift?"))
else
type=newtype
break
end
end
end
if id==0
master=[]; idlist=[]
if safeExists?("MysteryGiftMaster.txt")
master=IO.read("MysteryGiftMaster.txt")
master=pbMysteryGiftDecrypt(master)
end
for i in master; idlist.push(i[0]); end
params=ChooseNumberParams.new
params.setRange(0,99999)
params.setDefaultValue(id)
params.setCancelValue(0)
loop do
newid=Kernel.pbMessageChooseNumber(_INTL("Choose a unique ID for this gift."),params)
if newid==0
return nil if Kernel.pbConfirmMessage(_INTL("Stop editing this gift?"))
else
if idlist.include?(newid)
Kernel.pbMessage(_INTL("That ID is already used by a Mystery Gift."))
else
id=newid
break
end
end
end
end
loop do
newgiftname=Kernel.pbMessageFreeText(_INTL("Enter a name for the gift."),giftname,false,32)
if newgiftname!=""
giftname=newgiftname
break
end
return nil if Kernel.pbConfirmMessage(_INTL("Stop editing this gift?"))
end
return [id,type,item,giftname]
rescue
Kernel.pbMessage(_INTL("Couldn't edit the gift."))
return nil
end
end

def pbCreateMysteryGift(type,item)
gift=pbEditMysteryGift(type,item)
if !gift
Kernel.pbMessage(_INTL("Didn't create a gift."))
else
begin
if safeExists?("MysteryGiftMaster.txt")
master=IO.read("MysteryGiftMaster.txt")
master=pbMysteryGiftDecrypt(master)
master.push(gift)
else
master=[gift]
end
string=pbMysteryGiftEncrypt(master)
File.open("MysteryGiftMaster.txt","wb"){|f|
f.write(string)
}
Kernel.pbMessage(_INTL("The gift was saved to MysteryGiftMaster.txt."))
rescue
Kernel.pbMessage(_INTL("Couldn't save the gift to MysteryGiftMaster.txt."))
end
end
end



################################################################################
# Debug option for managing gifts in the Master file and exporting them to a
# file to be uploaded.
################################################################################
def pbManageMysteryGifts
if !safeExists?("MysteryGiftMaster.txt")
Kernel.pbMessage(_INTL("There are no Mystery Gifts defined."))
return
end
# Load all gifts from the Master file.
master=IO.read("MysteryGiftMaster.txt")
master=pbMysteryGiftDecrypt(master)
if !master || !master.is_a?(Array) || master.length==0
Kernel.pbMessage(_INTL("There are no Mystery Gifts defined."))
return
end
# Download all gifts from online
msgwindow=Kernel.pbCreateMessageWindow
Kernel.pbMessageDisplay(msgwindow,_INTL("Searching for online gifts...\\wtnp[0]"))
online=pbDownloadToString(MYSTERYGIFTURL)
Kernel.pbDisposeMessageWindow(msgwindow)
if online==""
Kernel.pbMessage(_INTL("No online Mystery Gifts found.\\wtnp[20]"))
online=[]
else
Kernel.pbMessage(_INTL("Online Mystery Gifts found.\\wtnp[20]"))
online=pbMysteryGiftDecrypt(online)
t=[]
for gift in online; t.push(gift[0]); end
online=t
end
# Show list of all gifts.
command=0
loop do
commands=pbRefreshMGCommands(master,online)
command=Kernel.pbMessage(_INTL("\\ts[]Manage Mystery Gifts (X=online)."),commands,-1,nil,command)
# Gift chosen
if command==-1 || command==commands.length-1
break
elsif command==commands.length-2
begin
newfile=[]
for gift in master
newfile.push(gift) if online.include?(gift[0])
end
string=pbMysteryGiftEncrypt(newfile)
File.open("MysteryGift.txt","wb"){|f|
f.write(string)
}
Kernel.pbMessage(_INTL("The gifts were saved to MysteryGift.txt."))
Kernel.pbMessage(_INTL("Upload MysteryGift.txt to the Internet."))
rescue
Kernel.pbMessage(_INTL("Couldn't save the gifts to MysteryGift.txt."))
end
elsif command>=0 && command<commands.length-2
cmd=0
loop do
commands=pbRefreshMGCommands(master,online)
gift=master[command]
cmds=[_INTL("Toggle on/offline"),
_INTL("Edit"),
_INTL("Receive"),
_INTL("Delete"),
_INTL("Cancel")]
cmd=Kernel.pbMessage("\\ts[]"+commands[command],cmds,-1,nil,cmd)
if cmd==-1 || cmd==cmds.length-1
break
elsif cmd==0 # Toggle on/offline
if online.include?(gift[0])
for i in 0...online.length
online[i]=nil if online[i]==gift[0]
end
online.compact!
else
online.push(gift[0])
end
elsif cmd==1 # Edit
newgift=pbEditMysteryGift(gift[1],gift[2],gift[0],gift[3])
master[command]=newgift if newgift
elsif cmd==2 # Receive
replaced=false
for i in 0...$Trainer.mysterygift.length
if $Trainer.mysterygift[i][0]==gift[0]
$Trainer.mysterygift[i]=gift; replaced=true
end
end
$Trainer.mysterygift.push(gift) if !replaced
pbReceiveMysteryGift(gift[0])
elsif cmd==3 # Delete
if Kernel.pbConfirmMessage(_INTL("Are you sure you want to delete this gift?"))
master[command]=nil
master.compact!
end
break
end
end
end
end
end

def pbRefreshMGCommands(master,online)
commands=[]
for gift in master
itemname="BLANK"
if gift[1]==0
itemname=PBSpecies.getName(gift[2].species)
elsif gift[1]>0
itemname=PBItems.getName(gift[2])+sprintf(" x%d",gift[1])
end
ontext=["[ ]","[X]"][(online.include?(gift[0])) ? 1 : 0]
commands.push(_ISPRINTF("{1:s} {2:d}: {3:s} ({4:s})",ontext,gift[0],gift[3],itemname))
end
commands.push(_INTL("Export selected to file"))
commands.push(_INTL("Cancel"))
return commands
end



################################################################################
# Downloads all available Mystery Gifts that haven't been downloaded yet.
################################################################################
# Called from the Continue/New Game screen.
def pbDownloadMysteryGift(trainer)
sprites={}
viewport=Viewport.new(0,0,Graphics.width,Graphics.height)
viewport.z=99999
addBackgroundPlane(sprites,"background","mysteryGiftbg",viewport)
pbFadeInAndShow(sprites)
sprites["msgwindow"]=Kernel.pbCreateMessageWindow
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("Searching for a gift.\nPlease wait...\\wtnp[0]"))
string=pbDownloadToString(MYSTERYGIFTURL)
if string==""
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
else
online=pbMysteryGiftDecrypt(string)
pending=[]
for gift in online
notgot=true
for j in trainer.mysterygift
notgot=false if j[0]==gift[0]
end
pending.push(gift) if notgot
end
if pending.length==0
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
else
loop do
commands=[]
for gift in pending; commands.push(gift[3]); end
commands.push(_INTL("Cancel"))
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("Choose the gift you want to receive.\\wtnp[0]"))
command=Kernel.pbShowCommands(sprites["msgwindow"],commands,-1)
if command==-1 || command==commands.length-1
break
else
gift=pending[command]
sprites["msgwindow"].visible=false
isitem=false
if gift[1]==0
sprite=PokemonSprite.new(viewport)
sprite.setPokemonBitmap(gift[2])
sprite.ox=sprite.bitmap.width/2
sprite.oy=sprite.bitmap.height/2
sprite.x=Graphics.width/2
sprite.y=-sprite.bitmap.height/2
else
sprite=ItemIconSprite.new(0,0,gift[2],viewport)
sprite.x=Graphics.width/2
sprite.y=-sprite.height/2
isitem=true
end
begin
Graphics.update
Input.update
sprite.update
sprite.y+=4
end while sprite.y<Graphics.height/2
pbMEPlay("Jingle - HMTM")
3*Graphics.frame_rate.times do
Graphics.update
Input.update
sprite.update
pbUpdateSceneMap
end
sprites["msgwindow"].visible=true
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("The gift has been received!")) { sprite.update }
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("Please pick up your gift from the deliveryman in any Poké Mart.")) { sprite.update }
trainer.mysterygift.push(gift)
pending[command]=nil; pending.compact!
begin
Graphics.update
Input.update
sprite.update
sprite.opacity-=8
end while sprite.opacity>0
sprite.dispose
end
if pending.length==0
Kernel.pbMessageDisplay(sprites["msgwindow"],_INTL("No new gifts are available."))
break
end
end
end
end
pbFadeOutAndHide(sprites)
Kernel.pbDisposeMessageWindow(sprites["msgwindow"])
pbDisposeSpriteHash(sprites)
viewport.dispose
return trainer
end



################################################################################
# Converts an array of gifts into a string and back.
################################################################################
def pbMysteryGiftEncrypt(gift)
ret=[Zlib::Deflate.deflate(Marshal.dump(gift))].pack("m")
return ret
end

def pbMysteryGiftDecrypt(gift)
return [] if gift==""
ret=Marshal.restore(Zlib::Inflate.inflate(gift.unpack("m")[0]))
return ret
end



################################################################################
# Collecting a Mystery Gift from the deliveryman.
################################################################################
def pbNextMysteryGiftID
for i in $Trainer.mysterygift
return i[0] if i.length>1
end
return 0
end

def pbReceiveMysteryGift(id)
index=-1
for i in 0...$Trainer.mysterygift.length
if $Trainer.mysterygift[i][0]==id && $Trainer.mysterygift[i].length>1
index=i
break
end
end
if index==-1
Kernel.pbMessage(_INTL("Couldn't find an unclaimed Mystery Gift with ID {1}.",id))
return false
end
gift=$Trainer.mysterygift[index]
if gift[1]==0
pID=rand(256)
pID|=rand(256)<<8
pID|=rand(256)<<16
pID|=rand(256)<<24
gift[2].personalID=pID
gift[2].calcStats
time=pbGetTimeNow
gift[2].timeReceived=time.getgm.to_i
gift[2].obtainMode=4 # Fateful encounter
gift[2].pbRecordFirstMoves
if $game_map
gift[2].obtainMap=$game_map.map_id
gift[2].obtainLevel=gift[2].level
else
gift[2].obtainMap=0
gift[2].obtainLevel=gift[2].level
end
if pbAddPokemonSilent(gift[2])
Kernel.pbMessage(_INTL("{1} received {2}!\\se[ItemGet]\1",$Trainer.name,gift[2].name))
$Trainer.mysterygift[index]=[id]
return true
end
elsif gift[1]>0
if $PokemonBag.pbCanStore?(gift[2],gift[1])
$PokemonBag.pbStoreItem(gift[2],gift[1])
item=gift[2]; qty=gift[1]
itemname=(qty>1) ? PBItems.getNamePlural(item) : PBItems.getName(item)
if $ItemData[item][ITEMUSE]==3 || $ItemData[item][ITEMUSE]==4
Kernel.pbMessage(_INTL("\\se[ItemGet]{1} received \\c[1]{2}\\c[0]!\\nIt contained \\c[1]{3}\\c[0].\\wtnp[30]",
$Trainer.name,itemname,PBMoves.getName($ItemData[item][ITEMMACHINE])))
elsif isConst?(item,PBItems,:LEFTOVERS)
Kernel.pbMessage(_INTL("\\se[ItemGet]{1} received some \\c[1]{2}\\c[0]!\\wtnp[30]",$Trainer.name,itemname))
elsif qty>1
Kernel.pbMessage(_INTL("\\se[ItemGet]{1} received {2} \\c[1]{3}\\c[0]!\\wtnp[30]",$Trainer.name,qty,itemname))
else
Kernel.pbMessage(_INTL("\\se[ItemGet]{1} received one \\c[1]{2}\\c[0]!\\wtnp[30]",$Trainer.name,itemname))
end
$Trainer.mysterygift[index]=[id]
return true
end
end
return false
end


i upload the MisteryGif.txt to pastebin and change the url from the script
created misterygif from debug, select mode online
but dont work looks
Spoiler:
Reply With Quote

Relevant Advertising!

  #2    
Old August 20th, 2016 (7:37 PM).
Zeak6464's Avatar
Zeak6464 Zeak6464 is offline
The Cold Guy
 
Join Date: Mar 2013
Location: USA
Gender: Male
Nature: Calm
Posts: 571
Send a message via Skype™ to Zeak6464
what is your paste bin url ?
__________________


Reply With Quote
  #3    
Old August 20th, 2016 (8:07 PM).
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 71
Quote:
Originally Posted by Zeak6464 View Post
what is your paste bin url ?

this is the pastebin url http://pastebin.com/raw/BM84rUDV
Reply With Quote
  #4    
Old August 20th, 2016 (8:46 PM).
Zeak6464's Avatar
Zeak6464 Zeak6464 is offline
The Cold Guy
 
Join Date: Mar 2013
Location: USA
Gender: Male
Nature: Calm
Posts: 571
Send a message via Skype™ to Zeak6464
Quote:
Originally Posted by akane159 View Post
this is the pastebin url http://pastebin.com/raw/BM84rUDV
i get
"Please refresh the page to continue..."
from the url
__________________


Reply With Quote
  #5    
Old August 20th, 2016 (9:55 PM).
Rot8er_ConeX's Avatar
Rot8er_ConeX Rot8er_ConeX is offline
 
Join Date: May 2015
Location: The Dissa Region
Gender: Male
Posts: 698
Yeah, it's looking like an error with the Pastebin URL.

Mine works fine:
http://pastebin.com/raw/jAKhYDBV
__________________
Features of Pokemon Entropy

The black circular "doodles" in the lower right corner of my avatar are actually my username written in Gallifreyan. Yes I'm a Whovian.
Reply With Quote
  #6    
Old August 21st, 2016 (6:40 AM).
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 71
the pastebin work for me , there is other web where i can upload the misterygift.txt ?
Reply With Quote
  #7    
Old August 21st, 2016 (4:13 PM).
The Master's Avatar
The Master The Master is offline
 
Join Date: Dec 2014
Location: Italy
Age: 23
Gender: Male
Nature: Adamant
Posts: 288
Can you explain us, in detail, all phases of the proceedings you followed?
Reply With Quote
  #8    
Old August 21st, 2016 (8:34 PM). Edited August 22nd, 2016 by mej71.
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 71
Quote:
Originally Posted by The Master View Post
Can you explain us, in detail, all phases of the proceedings you followed?

i use this method
min 24:40 (this video is not in english, but i make the same steps)
i tried the same pag that in the video and pastebin, but dont work :s
Reply With Quote
  #9    
Old August 22nd, 2016 (2:33 AM).
The Master's Avatar
The Master The Master is offline
 
Join Date: Dec 2014
Location: Italy
Age: 23
Gender: Male
Nature: Adamant
Posts: 288
The video doesn't work.
Reply With Quote
  #10    
Old August 22nd, 2016 (6:09 PM). Edited August 22nd, 2016 by Vendily.
Vendily's Avatar
Vendily Vendily is offline
Making BW-style OWs for RMXP
 
Join Date: Aug 2015
Gender: Female
Nature: Calm
Posts: 585
The video does work, it was just embedded wrong.


HTML Code:
[YOUTUBE]dOEEVWvUMUI[/YOUTUBE]
That's how you put it in a post.
__________________
Resources for ROM hackers has moved.

Reply With Quote
  #11    
Old August 23rd, 2016 (6:44 AM).
The Master's Avatar
The Master The Master is offline
 
Join Date: Dec 2014
Location: Italy
Age: 23
Gender: Male
Nature: Adamant
Posts: 288
Probably you did a incorrect encryption. Delete Misterygift.txt and do the proceeding again.
Reply With Quote
  #12    
Old August 23rd, 2016 (3:54 PM).
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 71
Quote:
Originally Posted by The Master View Post
Probably you did a incorrect encryption. Delete Misterygift.txt and do the proceeding again.
try and it does not work
Reply With Quote
  #13    
Old August 23rd, 2016 (5:57 PM).
The Master's Avatar
The Master The Master is offline
 
Join Date: Dec 2014
Location: Italy
Age: 23
Gender: Male
Nature: Adamant
Posts: 288
Can you send me a demo copy of your project via PM?
Reply With Quote
  #14    
Old August 23rd, 2016 (7:05 PM).
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 71
Quote:
Originally Posted by The Master View Post
Can you send me a demo copy of your project via PM?
i just start , i´m using a clean version , pokemon essential v16.2
with ultimate battle script gen 5
Reply With Quote
  #15    
Old August 24th, 2016 (3:43 AM).
The Master's Avatar
The Master The Master is offline
 
Join Date: Dec 2014
Location: Italy
Age: 23
Gender: Male
Nature: Adamant
Posts: 288
Quote:
Originally Posted by The Master View Post
Can you send me a demo copy of your project via PM?
Quote:
Originally Posted by akane159 View Post
i just start , i´m using a clean version , pokemon essential v16.2
with ultimate battle script gen 5
I just wanted give it a look to see if everything is in place.
Otherwise I would not know how to help you, because I had the same problem, time ago.
Reply With Quote
  #16    
Old August 24th, 2016 (9:58 AM).
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 71
Quote:
Originally Posted by The Master View Post
I just wanted give it a look to see if everything is in place.
Otherwise I would not know how to help you, because I had the same problem, time ago.
ok, i send you a PM
Reply With Quote
  #17    
Old August 24th, 2016 (3:07 PM).
The Master's Avatar
The Master The Master is offline
 
Join Date: Dec 2014
Location: Italy
Age: 23
Gender: Male
Nature: Adamant
Posts: 288
I don't see any problem. I received your Gift at the first try (a Pikachu, in a gift named "sss").
Make sure there is already a EXISTING GAME saved, and check out your Firewall or Router in case they are blocking connections.
Reply With Quote
  #18    
Old August 24th, 2016 (4:47 PM).
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 71
Quote:
Originally Posted by The Master View Post
I don't see any problem. I received your Gift at the first try (a Pikachu, in a gift named "sss").
Make sure there is already a EXISTING GAME saved, and check out your Firewall or Router in case they are blocking connections.
you just create a new and work?? i did and is not working , firewall and antivirus are diable and nothing , use windows 7- 32 bit , windows 8,1-32 bit , and nothing :s

Spoiler:
Reply With Quote
  #19    
Old 4 Weeks Ago (5:50 AM).
The Master's Avatar
The Master The Master is offline
 
Join Date: Dec 2014
Location: Italy
Age: 23
Gender: Male
Nature: Adamant
Posts: 288
Don't forget to start a new game, save data and restart "Game.exe".
Reply With Quote
  #20    
Old 4 Weeks Ago (11:04 PM).
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 71
Quote:
Originally Posted by The Master View Post
Don't forget to start a new game, save data and restart "Game.exe".
dont work :s , i tried with the essential BW 3, and the mistery gift work, but i tried with me game and dont work
Reply With Quote
  #21    
Old 4 Weeks Ago (2:19 AM).
The Master's Avatar
The Master The Master is offline
 
Join Date: Dec 2014
Location: Italy
Age: 23
Gender: Male
Nature: Adamant
Posts: 288
Try to make a unlisted video on Youtube (complete of all steps) so that we can make a step-by-step check.
Reply With Quote
  #22    
Old 4 Weeks Ago (5:42 AM).
akane159 akane159 is offline
 
Join Date: Oct 2012
Gender: Female
Posts: 71
Quote:
Originally Posted by The Master View Post
Try to make a unlisted video on Youtube (complete of all steps) so that we can make a step-by-step check.
here the video
Reply With Quote
  #23    
Old 4 Weeks Ago (9:52 AM).
The Master's Avatar
The Master The Master is offline
 
Join Date: Dec 2014
Location: Italy
Age: 23
Gender: Male
Nature: Adamant
Posts: 288
I tried with my game and your gift was opened without any problem (acel => Accelgor Shiny). Try to start Game.exe as administrator or check out your Router or firewall.
Reply With Quote
Reply
Quick Reply

Sponsored Links
Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 8:37 PM.