Ace 스크립트

  1. #Sleek Item Popup v1.10
  2. #----------#
  3. #Features: A nice and sleek little pop up you can use to tell the player
  4. #           they received (or lost) an item! Now with automatic popups whenever
  5. #           you use the gain item commands in events!
  6. #
  7. #Usage:   Event Script Call:
  8. #           popup(type,item,amount,[duration],[xoff],[yoff])
  9. #
  10. #          Where: type is category of item (0 = item, 1 = weapon,
  11. #                                            2 = armor, 3 = gold)
  12. #                 item is the id number of the item
  13. #                 amount is the amount lost or gained
  14. #                 duration is the time the window is up and is optional
  15. #          
  16. #          Examples:
  17. #            popup(0,1,5)
  18. #            popup(2,12,1,120)
  19. #            $PU_AUTOMATIC_POPUP = false
  20. #            $PU_AUTOMATIC_POPUP = true
  21. #        
  22. #Customization: Everything down there under customization
  23. #
  24. #----------#
  25. #-- Script by: V.M of D.T
  26. #
  27. #- Questions or comments can be:
  28. #    posted on the thread for the script
  29. #    given by email: sumptuaryspade@live.ca
  30. #    provided on facebook: http://www.facebook.com/DaimoniousTailsGames
  31. #    posed on site: daimonioustails.wordpress.com
  32. #
  33. #--- Free to use in any project, commercial or non-commercial, with credit given
  34. # - - Though a donation's always a nice way to say thank you~ (I also accept actual thank you's)
  35.  
  36. #Sound effect played on popup: # "Filename", Volume(0-100), Pitch(50-150)
  37. PU_SOUND_EFFECT = ["Item3",100,50]
  38.  
  39. #Animation to be played on the player during popup
  40. PU_USE_ANIMATION = false
  41. PU_POPUP_ANIMATION = 2
  42.  
  43. #Duration in frames of Item Popup fadein and fadeout
  44. PU_FADEIN_TIME = 30
  45. PU_FADEOUT_TIME = 30
  46.  
  47. #Default duration of the popup
  48. PU_DEFAULT_DURATION = 90
  49.  
  50. #Use automatic popup? Can be enabled/disabled in game, see examples
  51. $PU_AUTOMATIC_POPUP = true
  52.  
  53. #Whether to use a custom or default font
  54. PU_USE_CUSTOM_FONT = false
  55.  
  56. #Settings for custom item popup font
  57. PU_DEFAULT_FONT_NAME = ["Verdana"]
  58. PU_DEFAULT_FONT_SIZE = 16
  59. PU_DEFAULT_FONT_COLOR = Color.new(255,255,255,255)
  60. PU_DEFAULT_FONT_BOLD = false
  61. PU_DEFAULT_FONT_ITALIC = false
  62. PU_DEFAULT_FONT_SHADOW = false
  63. PU_DEFAULT_FONT_OUTLINE = true
  64.  
  65. #Compact mode will hide the amount unless it's greater then 1
  66. PU_COMPACT_MODE = true
  67.  
  68. #Background Icon to be displayed under item icon
  69. PU_USE_BACKGROUND_ICON = true
  70. PU_BACKGROUND_ICON = 102
  71.  
  72. #Gold details:
  73. PU_GOLD_NAME = "Gold"
  74. PU_GOLD_ICON = 262
  75.  
  76. #True for single line, false for multi line
  77. PU_SINGLE_LINE = true
  78.  
  79. class Item_Popup < Window_Base
  80.   def initialize(item, amount, duration, nosound,xoff,yoff)
  81.     super(0,0,100,96)
  82.     Audio.se_play('Audio/SE/' + PU_SOUND_EFFECT[0],PU_SOUND_EFFECT[1],PU_SOUND_EFFECT[2]) unless PU_SOUND_EFFECT.nil? or nosound
  83.     self.opacity = 0
  84.     self.x = $game_player.screen_x - 16
  85.     self.y = $game_player.screen_y - 80
  86.     @xoff = 0
  87.     @yoff = 0
  88.     @duration = 90
  89.     @item = item
  90.     @amount = amount
  91.     @name = item.name.clone
  92.     @text = ""
  93.     @timer = 0
  94.     @split = (PU_FADEIN_TIME) / @name.size
  95.     @split = 2 if @split < 2
  96.     amount > 0 ? @red = false : @red = true
  97.     if PU_USE_CUSTOM_FONT
  98.       contents.font.size = PU_DEFAULT_FONT_SIZE
  99.     else
  100.       contents.font.size = 16
  101.     end
  102.     @textsize = text_size(@name)
  103.     textsize2 = text_size("+" + amount.to_s)
  104.     self.width = @textsize.width + 54
  105.     self.width += textsize2.width + 48 if PU_SINGLE_LINE
  106.     self.height = @textsize.height + 54
  107.     self.height -= 24 if PU_SINGLE_LINE
  108.     self.x -= self.width / 4
  109.     create_contents
  110.     if PU_USE_CUSTOM_FONT
  111.       contents.font.name = PU_DEFAULT_FONT_NAME
  112.       contents.font.size = PU_DEFAULT_FONT_SIZE
  113.       contents.font.color = PU_DEFAULT_FONT_COLOR
  114.       contents.font.bold = PU_DEFAULT_FONT_BOLD
  115.       contents.font.italic = PU_DEFAULT_FONT_ITALIC
  116.       contents.font.shadow = PU_DEFAULT_FONT_SHADOW
  117.       contents.font.outline = PU_DEFAULT_FONT_OUTLINE
  118.     end
  119.     self.contents_opacity = 0
  120.     $game_player.animation_id = PU_POPUP_ANIMATION if PU_USE_ANIMATION
  121.     update
  122.   end
  123.   def update
  124.     #super
  125.     return if self.disposed?
  126.     self.visible = true if !self.visible
  127.     self.x = $game_player.screen_x - 16 + @xoff
  128.     self.y = $game_player.screen_y - 80 + @yoff
  129.     self.x -= self.width / 4
  130.     open if @timer < (PU_FADEIN_TIME)
  131.     close if @timer > (PU_FADEOUT_TIME + @duration)
  132.     @timer += 1
  133.     @text += @name.slice!(0,1) if @timer % @split == 0
  134.     contents.clear
  135.     @red ? color = Color.new(255,0,0) : color = Color.new(0,255,0)
  136.     contents.font.color = color
  137.     stringamount = @amount
  138.     stringamount = "+" + @amount.to_s if @amount > 0
  139.     if PU_SINGLE_LINE
  140.       width = text_size(@item.name).width#@textsize.width
  141.       draw_text(27 + width,0,36,24,stringamount) unless PU_COMPACT_MODE and @amount == 1
  142.       contents.font.color = Font.default_color
  143.       draw_text(24,0,contents.width,contents.height,@text)
  144.       draw_icon(PU_BACKGROUND_ICON,0,0) if PU_USE_BACKGROUND_ICON
  145.       draw_icon(@item.icon_index,0,0)
  146.     else
  147.       draw_text(contents.width / 4 + 16,24,36,24,stringamount) unless PU_COMPACT_MODE and @amount == 1
  148.       contents.font.color = Font.default_color
  149.       draw_icon(PU_BACKGROUND_ICON,contents.width / 4 - 12,24) if PU_USE_BACKGROUND_ICON
  150.       draw_icon(@item.icon_index,contents.width / 4 - 12,24)
  151.       draw_text(0,0,contents.width,contents.height,@text)
  152.     end
  153.   end
  154.   def close
  155.     self.contents_opacity -= (255 / (PU_FADEOUT_TIME))
  156.   end
  157.   def open
  158.     self.contents_opacity += (255 / (PU_FADEIN_TIME))
  159.   end
  160. end
  161.  
  162. class Game_Interpreter
  163.   alias pu_command_126 command_126
  164.   alias pu_command_127 command_127
  165.   alias pu_command_128 command_128
  166.   alias pu_command_125 command_125
  167.   def popup(type,item,amount,duration = PU_DEFAULT_DURATION,nosound = false, xo = 0, yo = 0)
  168.     data = $data_items[item] if type == 0
  169.     data = $data_weapons[item] if type == 1
  170.     data = $data_armors[item] if type == 2
  171.     if type == 3
  172.       data = RPG::Item.new
  173.       data.name = PU_GOLD_NAME
  174.       data.icon_index = PU_GOLD_ICON
  175.     end
  176.     Popup_Manager.add(data,amount,duration,nosound,xo,yo)
  177.   end
  178.   def command_126
  179.     pu_command_126
  180.     value = operate_value(@params[1], @params[2], @params[3])
  181.     popup(0,@params[0],value) if $PU_AUTOMATIC_POPUP
  182.   end
  183.   def command_127
  184.     pu_command_127
  185.     value = operate_value(@params[1], @params[2], @params[3])
  186.     popup(1,@params[0],value) if $PU_AUTOMATIC_POPUP
  187.   end
  188.   def command_128
  189.     pu_command_128
  190.     value = operate_value(@params[1], @params[2], @params[3])
  191.     popup(2,@params[0],value) if $PU_AUTOMATIC_POPUP
  192.   end
  193.   def command_125
  194.     pu_command_125
  195.     value = operate_value(@params[0], @params[1], @params[2])
  196.     popup(3,@params[0],value) if $PU_AUTOMATIC_POPUP
  197.   end
  198. end
  199.  
  200. module Popup_Manager
  201.   def self.init
  202.     @queue = []
  203.   end
  204.   def self.add(item,value,dura,ns,xo,yo)
  205.     @queue.insert(0,[item,value,dura,ns,xo,yo])
  206.   end
  207.   def self.queue
  208.     @queue
  209.   end
  210. end  
  211.  
  212. Popup_Manager.init
  213.  
  214. class Scene_Map
  215.   alias popup_update update
  216.   alias popup_preterminate pre_terminate
  217.   def update
  218.     popup_update
  219.     update_popup_window unless $popupwindow.nil?
  220.     return if Popup_Manager.queue.empty?
  221.     if $popupwindow.nil? or $popupwindow.contents_opacity == 0
  222.       var = Popup_Manager.queue.pop
  223.       $popupwindow = Item_Popup.new(var[0],var[1],var[2],var[3],var[4],var[5])
  224.     end
  225.   end
  226.   def update_popup_window
  227.     $popupwindow.update
  228.     if !$popupwindow.disposed? and $popupwindow.contents_opacity == 0
  229.       $popupwindow.dispose
  230.       $popupwindow = nil
  231.     end
  232.   end
  233.   def pre_terminate
  234.     popup_preterminate
  235.     $popupwindow.visible = false unless $popupwindow.nil?
  236.   end
  237. end

 

그러합니다.

제작중인 게임에도 적용해볼까 생각중. . . .

Who's 스리아씨

?
뺘라뺘뺘
  • profile
    Kazu 2013.10.26 16:31
    잘 쓰겠습니다~
  • ?
    Kazu님 축하합니다.^^ 2013.10.26 16:31
    포인트 팡팡!에 당첨되셨습니다.
    Kazu님은 50포인트를 보너스로 받으셨습니다.
  • ?
    Mr.Pig 2013.11.09 06:33
    써보니까 좋네요
    잘 쓰겠습니다
  • ?
    Otte 2013.11.12 17:18
    와우..
  • ?
    Soo'sE_Box 2014.01.06 13:08
    좋당 ㅎㅎ
  • ?
    Soo'sE_Box 2014.01.08 15:29

    궁금한게 있는데요, 몇 번 째줄까지가 아이템을 획득했을때 팝업이고, 아이템이 없어질때 팝업뜨는 스크랩이죠?? ㅠㅠ아이템을 획득했을때만 뜨게 하고 싶어서 ㅎㅎㅎ 부탁드립니다! 수동으로 팝업 하려니까 너무 복잡할꺼 같아서요 ㅠ

  • profile
    시캐 2014.02.03 00:27

    앞에 번호까지 복사되는 건 나만 그런건가...??

    122번 줄에서 unexpected keyword_end, expecting $end end라는 오류가 나는데 저만 그런가요?

  • ?
    스리아씨 2014.02.03 16:49
    어..
    저거 기존에 쓰던 세이브파일 쓰면 안되는거로 압니다.
    새로 시작해야해요.
  • profile
    시캐 2014.02.03 23:48
    타이틀화면이 나오기도 전에 오류가 납니다;; 그러니까 새로하기, 이어하기 이런 거 선택하기도 전에
    오류가 나와요
    그래서 새 프로젝트 만들고 해도 똑같이 오류납니다.ㅠ_ㅠ
  • ?
    AltusZeon 2014.02.12 17:54
    에러 문구를 보니 문법 오류입니다.
    세이브 파일과는 관계 없습니다.
  • profile
    슈팅스타* 2014.02.12 17:48
    저 번호 어떻게 없애는 방법 없나여.
    스크립트 에디터에 번호째로 들어가서 에러날거같음
  • ?
    AltusZeon 2014.02.12 17:56
    http://pastebin.com/Vfk6eG7F
  • profile
    슈팅스타* 2014.02.12 17:57
    올ㅋ
  • ?
    jindou 2014.06.27 17:47
    감사
  • ?
    skeskin 2014.10.21 19:54
    오오ㅗ

List of Articles
번호 분류 제목 글쓴이 날짜 조회 수
공지 스크립트 자료 게시물 작성시 주의사항 습작 2012.12.24 5109
공지 RPG VX ACE 유용한 링크 모음 16 아방스 2012.01.03 28921
12 아이템 물품 이름 컬러 변경 14 까까까 2012.01.04 5629
11 아이템 양손무기 작착 스크립트 [Dual Wield -> Free Hands Version 1.0] 7 file 아방스 2012.01.31 4633
10 아이템 VXAce 아이템 채집 스크립트 23 file 아이미르 2012.11.23 4050
9 아이템 VXAce 아이템 합성 스크립트 Ver 0.8 17 아이미르 2012.08.23 3999
8 아이템 VXAce 아이템 도감 스크립트 7 file 아이미르 2012.12.31 3800
7 아이템 VXAce 보관함 스크립트 12 file 아이미르 2013.02.07 3701
6 아이템 VXAce 셋트장비 스크립트 9 file 아이미르 2013.03.08 3642
5 아이템 VXAce No Recipe 아이템합성 스크립트(버그 수정) 11 file 아이미르 2013.01.07 3306
» 아이템 아이템 팝업 스크립트 15 스리아씨 2013.10.17 3243
3 아이템 Tactics Ogre PSP Crafting System by Mr.Bubble 6 Alkaid 2012.09.17 3058
2 아이템 랜덤 아이템샵. 1 탐험가 2012.10.28 2297
1 아이템 Etude87_Item_Search ver.1.00 2 습작 2013.01.24 1646
Board Pagination Prev 1 Next
/ 1