Help - Search - Members - Calendar
Full Version: decrease varibale to 0 in perks of 1 per sec
RPG RPG Revolution Forums > Scripting > Script Development and Support
johnny55
Heys, my idea is this

when player touch on a event, it adds +10 to variable 5 and it automaticly start counting down til reach 0 (where then a action starts

i tried it with events, but problem was, each time i step on the event it would add +10 and +10 and +10 etc, i tried using self-switches to try cancel it but no luck

atm i tried this

Method 1: (it keep adding +10 for as many times i step on it)
Page 1] Player Touch > set route
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
script: $game_map.refresh
wait 20
script: SELF_A = [1, 1, A']
script: $game_self_switches[SELF_A] == true

Page 2] self switch A is ON
nothing, so it be disabledd


Method 2 (it reduces from 10 to 0 in 1 second ....)
Page 1] Player touch > self_switch A (so only be triggered once)
Page 2] self switch A is ON, Paralel (so it starts automaticly without lag) set route
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
wait 20
script: $game_variables[5] -= 1
script: $game_map.refresh
wait 20
script: SELF_B = [1, 1, B']
script: $game_self_switches[SELF_B] == true
Page 3] self switch B is on
nothing

i think you able to see my idea, and i came to conclusion, this wont be able do though event (unless if i be wrong), so i'd like a lil help to convert this inito script

because if i do it in a 'normal' form would be somethiing like
if $game_variables[5] >= 1
$game_variables[5] -= 1
end

it would automaticly decrease the variable by 1 til reach 0 (wich isnt higher or equal to 1), but i need it to only drop 1 point PER second, and if im not mistaken the 'Wait' code on script, makes the entire game to 'wait' not just the variable

thanks
Night_Runner
I'm confused. Why are you using set route?


How I'd do it


johnny55
reason i was using set route was to prevent the game to hang when using the 'wait', but your method works smile.gif

wont need to convert it to script then, thanks smile.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2013 Invision Power Services, Inc.