SP drain/increase over time
#1
SP drain/increase over time
But this time with feeling
by Cavi
May 20 2011

This is a locked, single-post thread from Creation Asylum. Archived here to prevent its loss.
No support is given. If you are the owner of the thread, please contact administration.


Earlier today I was in need of a script to increment Sp (DT in my game) down slowly, and activate a common event when it did. So after a while of poking around, and a lot of help from the wonderful dudes and dudettes here at Creation Asylum, I'd like to let everyone see it :D

[Spoiler=The Code
Code:
#______________________________________________________#
#------------------------------------------------------#
#            Sp/Dt/Mp Drain Over Time Script           #
#------------------------------------------------------#
#    Idea -- Cavi (The Bat Guy / TACO_ALERT elsewhere) #
#  Code Base         --           GubiD                #
# Shenanigans         --       Cavi (again)            #
#   Debug       --         OverlordPrinnyLaharl        #
#------------------------------------------------------#
#  Terms of Use  --  None, but just remember where     #
#                    you got it, Gubid, Cavi, and      #
#                    OverlordPrinnyLaharl! Most of     #
#                    all, Creation Asylum itself!  :D  #
#------------------------------------------------------#
#______________________________________________________#
class Interpreter

alias upd_int_dream_dt_drain update unless $@ #renamed it so I remember what it does in a few months
  def update
    upd_int_dream_dt_drain
    if $game_switches[15] == true and !running? #<--- missing question mark
#
#      if Graphics.frame_count%20 == 0
#This prevents it from triggering every frame and rather every 20 frames.
#Which is about every 3rd of a second.
#
       if Graphics.frame_count%60 == 0
#
#Edited to go slower (Cavi)
#
        $game_party.actors[0].sp -= 1
          if $game_party.actors[0].sp == 0
            $game_temp.common_event_id = 11
        end
      end
    end
  end
end
#  yay! c:  #
[/Spoiler]


To use it, simply place it under Interpreter 1-7, and above main. The example above makes it to where if switch 15 is on, it will slowly whittle down until 0, whereupon Common Event 11 will happen. Ideally, you could replace sp with hp as well. The speed of the drain is on the line Graphics.frame_count%[ ] == 0, and the higher the number the slower. Okay well, most off how to use it is easily learned by looking at the code itself, and can be changed to fit whatever need :3

No credit needed, but I'd like for you to keep the comments in, for both easier use and (possible) future development.
PEOPLE WHO DID THINGS
GubiD -- Codebase
Cavi -- Things
OPL -- Debug



Now I'm off to work, so have fun guys

EDIT:

I've realized that you could slowly increase Hp, Mp, or Sp in this way over time too :D!
Seems kind of a 'durr' realization, but I wasn't thinking too hard earlier xD
}


Possibly Related Threads…
Thread Author Replies Views Last Post
  Dynamic Weather and Time System ThallionDarkshine 0 2,849 05-25-2012, 01:00 PM
Last Post: ThallionDarkshine
  Kylock's Time Script leisuree 0 2,059 10-22-2006, 01:00 PM
Last Post: leisuree
  Time / Day/Night System mikah 0 2,376 09-26-2006, 01:00 PM
Last Post: mikah
  Real-Time Day Night Silentdragon 0 2,030 03-09-2005, 01:00 PM
Last Post: Silentdragon



Users browsing this thread: 1 Guest(s)