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.
how do I make a temporary effect?

0 Members and 1 Guest are viewing this topic.

***
Rep:
Level 82
We learn by living...
Say I want to add +20 to some variable, but I only want the effects to last for a few seconds or a couple of minutes, how can I set the effect to ware off in the script editor?

like this pseudo code:

def temp_fx
for 20 seconds do [my_variable_bonus = 20]
after that [my_variable_bonus = 0]
end

***
Rep:
Level 82
We learn by living...
it appears things move in 30 frames per second but I'm not yet sure how to access those variables without directly accessing the game total play time. I'll try some different versions of if _ x -=1 and +=1 but I'm kind of lost as to the time mechanics of RPGmaker.

***
Rep:
Level 82
We learn by living...
So I came up with this:

Code: [Select]
class Counting_Clock < Window_Base
  def initialize
    $counting_clock=0
    while $counting_clock < 30
      $counting_clock += 1
    end
    super(240, 160, 120, 120)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "Times New Roman" 
    self.contents.font.size = 24
    refresh
  end
 
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(30, 25, 100, 32, $counting_clock.to_s)
  end
 
end

And it pops up a window with the number 30, and does so instantaneously. I've done a print variant where you have to hit 'ok' for it to transition from 0 ..1.. 2, etc. But while normally does everything instantly. I'm trying to display a smooth number climb, but i'm not sure how time is portrayed in this code.

***
Rep:
Level 82
We learn by living...


Code: [Select]
class Counting_Clock < Window_Base
  def initialize
    t = Time.now
    q = t.sec
    m = q + 5
    $counting_clock=0
    case q
when m
 $counting_clock=30
  super(240, 160, 120, 120)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "Arial" 
    self.contents.font.size = 24
    refresh
  else
 $counting_clock=0
  super(240, 160, 120, 120)
    self.contents = Bitmap.new(width-32, height-32)
    self.contents.font.name = "Arial" 
    self.contents.font.size = 24
    refresh
  end
   
  end # end initialize
   
  def refresh
    self.contents.clear
    self.contents.font.color = normal_color
    self.contents.draw_text(30, 25, 100, 32, $counting_clock.to_s)
  end 
end # end class

unfortunately this displays only the else result, in this case, "0". It doesn't auto update and the window closes automatically after a few seconds.