Help - Search - Members - Calendar
Full Version: [Help] When run, drain SP, when not running, regen SP, when drained, disable run
RPG RPG Revolution Forums > Scripting > Event Emporium
Taiine
So. I have a small issue with a Common Event that helps control running.

In my game, SP is energy, used for normal special attacks as well as running. However my running event has a little quirk.
So, you can run, and it drains the players SP, you stop or walk, and it slowly regens. If it becomes fully drained, the players run key is disabled, so you are forced to walk it until you regen enough to run again. However, once drained, the SP appears unable to regen at all.

I'm unsure what is causing it to stop regening when your SP becomes fully drained. I have the players SP set to a variable, and set so if the var is <= 3 disable running, else, enable it. I have another event in game that simply tells me what the variable is currently at (roughly telling me how much SP I have to debunk this) and yes, it does indeed go up and down as I run and stop... However, once drained, the variable becomes stuck at 3. Use a potion to restore SP? The variable is still stuck at 3.

my common event


The part highlighted in yellow is the prob. If I remove that, the players SP can be fully drained, but still regen when you stop... however with nothing to disable the running, well the system becomes rather pointless.
There is nothing in the branch telling SP to not regen once it hits 3 or below. Just to disable running key so you can't run (and that is in no way alone tied to the SP)

I tried this making the event a parallel as well as what you see, the SP just wont regen once drained, and I am boggled as to why.
RzrBladeMontage
Could you post a demo of this? It's easier for me to figure out a problem if I can tinker with it myself.
LS-Sir
Heres a system for you. It drains the SP as your running (Hold down Z (A in the game)) and regenerates as run is not being used. It takes about a second for run to kick in and about the same for it to dissapear. Hope i helped. Change it as you see fit.


SP drain [Quick Edit] Try this one. It shows a basic use of pictures - http://www.mediafire.com/?qnfbxp5ssse3cv7

Quick edit.

Why are you using a script for this? You can easily use an event like this and other common events to enable/disable running while showing how much "energy" you have left using pictures

Also, i thought I'd give you a quick tip - Events can be quite tricky, you may have every event you need in the sequence, but if they aren't in the right order they bug. So if you consider doing more events, and they sometimes bug out, before trying other commands, see if you can change the order of what you have around, it may help ^.^
Taiine
QUOTE (LS-Sir @ Oct 25 2010, 02:44 AM) *
Heres a system for you. It drains the SP as your running (Hold down Z (A in the game)) and regenerates as run is not being used. It takes about a second for run to kick in and about the same for it to dissapear. Hope i helped. Change it as you see fit.


SP drain [Quick Edit] Try this one. It shows a basic use of pictures - http://www.mediafire.com/?qnfbxp5ssse3cv7

Quick edit.

Why are you using a script for this? You can easily use an event like this and other common events to enable/disable running while showing how much "energy" you have left using pictures

Also, i thought I'd give you a quick tip - Events can be quite tricky, you may have every event you need in the sequence, but if they aren't in the right order they bug. So if you consider doing more events, and they sometimes bug out, before trying other commands, see if you can change the order of what you have around, it may help ^.^



Cause I am using Blizz-ABS and it comes with running plus a lot of other very nice features and controls? I also don't need use of pictures, I got a very nice HUD already.
Yay in game screeny


I HAVE tried redoing the order. I'm not a novice at events, and I don't appreciate being treated like I don't have a clue what I'm doing as that's the feeling you're giving me, like how to use images.. I'm guessing you said that cause I said I was using a event to show what the variable was set at for the players SP, but if you'd read I did it to see if yes, it WAS getting stuck at zero, ya know, to DEBUG the issue? Sense potions to refull players SP still kept the variable at 0?
Like this
Just ran until SP hit 0. Var's set to 0 so disable running. It now stops refilling on its own. Refill using pot, var still stuck at 0. Running is stuck disabled, but skills can be used and still properly drain SP.

This is a TEST map BTW >.>

THAT is what I meant by using an event to see what the var was set at. Not cause I don't know how to display it or 'use pictures' >.>


I have fare more complicated events systems set up for other things. (Like one of my boss fights) I just have an issue with this one and have yet to sort out why the part to turn off the running key if your SP is drained keeps it from refilling, when the command to turn off running only does that, disables the key that makes you run, it don't effect anything else.

I wouldn't be asking for assistance if I hadn't already tried to sort it myself (for a good week sense before I asked and even up until now)

I finally got around to making a demo to show the issue. (been busy)

http://www.mediafire.com/?kkk6xq051og3a0r

Shift is run. You can see you can run fine, SP drains, and when you stop (and still have SP), it refills.
But if you drain your SP to zero, it refuses to refill and the variable gets stuck at zero even if you use a potion to refill your sp.
LS-Sir

Just so you know - I have no idea what kind of eventer you are at all. i have no idea how skilled you are. I was giving a tip to be helpful, not be little you or treat you like an idiot, i haven't been here in months so just thought I'd help out.
Taiine
Well, I'd recommend sticking with what is being asked, and not add in your own things or completely change what someones doing less there asking for a better way. You come off as very 'my way is better then how your doing it' or 'you don't need that do it my way' and that wasn't very appreciated. If you didn't mean to come off like that well, then I guess it's fine. If you don't know, you could ask, then offer, not dive in like that, cause it really made it seem like your already assuming I have no idea what I'm doing or that you didn't fully read what I said, on top of not knowing what system I'm using.
LS-Sir
Ok look mate. I didn't know what system you were using because you didn't say. I couldn't tell from your event list because i haven't been here in that long that i have no idea what scripts call what or whatever. I was trying to be helpful, and offer my assistance. I read what you wanted, and gave you what i thought was what you wanted, or some assistance in what you were trying to achieve, not telling you my way was better or that you had no idea what your doing. And besides that, i "recommend" you show a little more respect and understanding to people who have gone out of there way to help you, like i did. I may not have gotten it right, but i at least gave it a shot.
RzrBladeMontage
Okay both of you can calm down now. It was just a little misunderstanding and now it's in the past.

@Taiine
LS-Sir just recommended something, he never did say "Do this, it's better." He was just being friendly and offering another way of doing it. You could of just nicely declined and that would of been the end of it. No need to get all fussy over nothing okay?

@LS-Sir
When posting a response to someones problem, always try to include something to do with their problem, don't just drop another system in their lap. If you can, try to help them in anyway possible but then add at the end of your post, post something simple like "There's also this system you can try as well." and then post links and what-not. Also, make sure to pay attention to what icon is near the topic title. It will tell you what maker the person is using. If there isn't an icon with a designated RPG Maker stated on it, the moderator (Me) will go and change the icon to represent the correct RPG Maker. Also, make sure to read the topics completely and take a note of how the screen shots look. RPG Maker XP and VX look different so it's not hard to tell them apart.

Topic Title Icon


Anyway, back on subject. I took at look at your system Taiine and I'm not exactly sure how to fix this. You have some scripting mixed in there and I'm not too familiar with scripting so I'm trying a few different things to see if I can get this to work. I'l let you know how I'm doing after a bit.
Taiine
The only scripting in there is
Input.press?(Input::Key['DIRECTION KEY']) To show if a direction key is pressed, then $game_player.running? to check if the key to let you run is being pressed. So it means, if the button to run and the direction key are being pressed, then drain SP.

the
$game_system.running_button = TRUE/FALSE
is just to enable and disable the button used to run.
RzrBladeMontage
What if you tried a conditional branch that checked to see if the button is disabled then to add SP back and to re-check to see if there's over a certain amount of SP and then it runs the event as normal? I would try it myself but I don't have everything I need installed on this computer yet (switched over to my laptop, so I have to reinstall everything).
Taiine
That's what the whole thing should be doing. It already checks that if your not running, regen the SP. With out that one highlighted branch, the sp can be fully drained to zero and it will regen back up on it's own. It's that one branch that some how has stopped dead the SP gain after it's fully drained.
lilcooldude69
did u make a state for the regen to work if u look at my mana slip event i used a state for the slip maybe u can use a state for the regen and just implement it inside ur common event like if ur sp is below 100% the state regen initiates and u regen sp then make it disable ur running and when u have full sp it stops regening and re enables running

Edit: might i add if you dont have ur game interpreter fixed u cannont set a variable to ur sp and a few others btw
Taiine
Ili it is very hard to understand you. The screen shot of my eveent shows what I had done. And what interpreter? This is XP, not VX. >.<

I'm still unable to get this to work properly. I'm still hoping for a fix, as I don't want my player to be able to just free run everywhere sad.gif
lilcooldude69
sorry bout the interpreter thing i forgot you were using xp XD, try placing the rest of you common event into the first conditional under the else part of the statement if that doesnt work try this, in ur common event try changing you input conditional statement that if you press the up button that it turns a state on that causes mana to slip then put inside of that conditional another conditional that if that state is on.....here just read the event in the pic it will be easier since u cant understand me well :c

P.S. try changing the $game_system.running_button = FALSE and the $game_system.running_button = TRUE to $game_system.running_button = false and $game_system.running_button = true

Event
Taiine
That changes nothing sadly :/ *sigh* looks like I may have to cut this system completely and just let the player free run wherever. sad.gif
lilcooldude69
can you send me the demo and i will play with, another thing i dont understand is you have the "pressing the up arrow key scripted" when you can event it right from the built in system
Taiine
I posted a demo, check my 2nd post, and again, it's cause of the battle system I am using. Just as I told LS-Sir, it comes with it's own run, jump, sneak, defend, pixel movement, fight on maps, minim map, enemy AI, anti lag system's (plus a LOT more) and has a nice method to disable the command's if needed for special occasions plus allows easy events to go of with a check if a player is doing this action, then do this sort of deal.
lilcooldude69
so is it okay that it regens only if your walking? cuz thats all i can get it to do it wont regen if your completely stopped D: but it will regen if you walk around is that what u wanted?

edit: nvm it wont regen on empty its ur button mixup is why the system buttons are changed around maybe if u somehow removed that then it would work
Taiine
No I wanted it so if your standing still or walking it regens. And what button mix up? You mean the custom controls the script offers that should have nothing at all to do with this event cause it just checks if your arrow key is down and if you are running by the system, a.k.a have shift held down? That's no different then doing this purely through events. If shift is down + arrow key run and drain energy.
lilcooldude69
QUOTE (Taiine @ Nov 11 2010, 12:44 PM) *
No I wanted it so if your standing still or walking it regens. And what button mix up? You mean the custom controls the script offers that should have nothing at all to do with this event cause it just checks if your arrow key is down and if you are running by the system, a.k.a have shift held down? That's no different then doing this purely through events. If shift is down + arrow key run and drain energy.

i just did exactly what u wanted this event to do on an empty project all with events >_>, its the buttons it has to be cuz when u stand still or move i regen but whenever i try it with the scripts it dont work take off the running part of the script and i will give u what u want lol put all this into a blank project and see what happends >_>.

Common Events






after u make all those common events make an event like this on the map

Map event


P.S. actually if their is a script command to turn running on or off without using the button im betting i could make the event i just made to be to your scripting needs just give me all the script calls for the arrows and the script call to turn the running on or off not the button just the actual process of him running (if their is one). if that makes sense if not i'll explain what i mean in next post people cant seem to understand me for some reason somtimes :c
Taiine
I'm not taking off the running part of the script, the battle system has everything set just so, so I can have running animations and effect animations/frames and detect if player is running to do this yada yada.. If I remove it, I lose all of that.

IIf you'd read my post, I already started it has NOTHING to do with the running arrows. they are the SAME as if having 'if up is pressed' only called from another means so you can disable the controls if needed. I also started that the system as a whole works fine, the SP WILL regen if you stand still or walk, but if it drops to zero, something is stopping it from regenning.

I also said it works FINE if you remove the one small branch I had highlighted that sets it to disable the running key. with out it, the script to run and regen sp when you stop works 100% fine, but some reason that one branch set to disable the running key only, some how keeps sp from regenning ONLY if it drops to zero.

Did you look at the demo posted? It has the whole battle system in it and my event.
Night_Runner
Taiine, getting fired up!

I seriously don't know why you posted this question here, it's like asking a great white shark if it knows the directions to the fruit shop.
In the water, the shark knows everything, and would be able to sniff out blood from miles away. But you're asking it a question involving land. Shark's know nothing about land! Even if it is as simple as where to buy fruit!

Just change water to eventing, the shark to the guys that have been trying to help, blood being problems with your eventing, land being scripting, and buying fruit being solve script related problems.


If you're willing to use a switch to run that common event, it's quite responsive, but uses a switch
[Show/Hide] Approach 1 - Involves 1 switch



If you used a variable instead of @sp_rejuv_time, then you wouldn't need a switch.

The code:
CODE
$game_system.running_button =
   $game_party.actors[0].sp > 0

@sp_rejuv_time = 0 if
@sp_rejuv_time.nil?

if Input.dir8 > 0 and
   $game_player.running?
  $game_party.actors[0].sp -= 3
  @sp_rejuv_time = 0
elsif @sp_rejuv_time > 20
  $game_party.actors[0].sp += 3
  @sp_rejuv_time  = 0
else
  @sp_rejuv_time += 1
end


And approach 2 doesn't use a switch, but isn't as responsive:
[Show/Hide] Approach 2 - Sluggish



And the code:
CODE
@time_to_wait = 0
if Input.dir8 > 0 and
   $game_player.running?
  $game_party.actors[0].sp -= 3
else
  $game_party.actors[0].sp += 3
  @time_to_wait = 20
end
$game_system.running_button =
   $game_party.actors[0].sp > 0
@wait_count = @time_to_wait
lilcooldude69
QUOTE (Taiine @ Nov 12 2010, 06:42 PM) *
I'm not taking off the running part of the script, the battle system has everything set just so, so I can have running animations and effect animations/frames and detect if player is running to do this yada yada.. If I remove it, I lose all of that.

IIf you'd read my post, I already started it has NOTHING to do with the running arrows. they are the SAME as if having 'if up is pressed' only called from another means so you can disable the controls if needed. I also started that the system as a whole works fine, the SP WILL regen if you stand still or walk, but if it drops to zero, something is stopping it from regenning.

I also said it works FINE if you remove the one small branch I had highlighted that sets it to disable the running key. with out it, the script to run and regen sp when you stop works 100% fine, but some reason that one branch set to disable the running key only, some how keeps sp from regenning ONLY if it drops to zero.

Did you look at the demo posted? It has the whole battle system in it and my event.

i did read ur post, whats stopping it from regening is when ur sp reaches 0 nothing is telling it to regen u have to do what i did when sp reaches zero make it so u recieve 1 sp so its never actually at 0 that way u can set the next part of the event to anything above 0 will regen if standing still but seems this guy scripted/evented a sp regen thingy so that should fix it hopefully
Taiine
Yep sure am Night Runner!

And lilcooldude69, yes, there IS something that's telling it to regen, look at it. When ever you are NOT running, when you do not have the run key held, it is supiose to regen SP, and it DOES if the disable the run button is not there. It can be fully drained to zero then once you stop running it starts to regen just fine. So that would mean that it does indeed tell it to regen, where your saying nothing is.

Conditional Branch: IS PLAYER RUNNING?
Yes
Change SP -5
ELSE
Change SP +5

Yes, even if it is drained to zero, it still regens.

It's just when the one branch is added to disable running if SP is =< 5 to disable the run key until it is above that.
Some how that is preventing the SP from regening at all once drained.

So you sadly still didn't make much sense saying there is nothing telling it to go up when there is, there's four of them :3

Night Runners way works very well, someone at Chaos Productions also gave me a script call that does the very same thing as his common event as well. So thanks for trying.
lilcooldude69
QUOTE (Taiine @ Nov 13 2010, 05:55 PM) *
Yep sure am Night Runner!

And lilcooldude69, yes, there IS something that's telling it to regen, look at it. When ever you are NOT running, when you do not have the run key held, it is supiose to regen SP, and it DOES if the disable the run button is not there. It can be fully drained to zero then once you stop running it starts to regen just fine. So that would mean that it does indeed tell it to regen, where your saying nothing is.

Conditional Branch: IS PLAYER RUNNING?
Yes
Change SP -5
ELSE
Change SP +5

Yes, even if it is drained to zero, it still regens.

It's just when the one branch is added to disable running if SP is =< 5 to disable the run key until it is above that.
Some how that is preventing the SP from regening at all once drained.

So you sadly still didn't make much sense saying there is nothing telling it to go up when there is, there's four of them :3

Night Runners way works very well, someone at Chaos Productions also gave me a script call that does the very same thing as his common event as well. So thanks for trying.

u have that conditional nested inside of the input button conditional in turn meaning it will only activate if BOTH are true so if you press the up button it makes it true and if running is activated it makes it true therefore u will lose sp as u run however, you have the regen inside of the running enabled conditional statement meaning that will only regen if you are pressing the indicated arrow and running is off which is why whenever u press the indicated arrow key it regens but if u let it go it doesnt and THE SOLE REASON IT WONT REGEN AT 0 is because nothing is telling it to regen at 0 if you look at this screenshot edit i made >_>

Problem with your event


in conclusion, it only regens when u press the arrow keys because you have the Game_running on inside of a statement that needs to be true to work, second it stops regening when it reaches 0 because nothing is below 0 and nothing is above 0 therefore wont work which also explains your stop regnning at 0 problem because, it only regens if game running is off, it cant regen if its not even working am i right, sooo before you go thinking your correct look at the facts im showing you :3333!, a good attempt at trying to school somone at somthing they do on a daily basis every day haha
Rukiri
Easiest way to do this.

Switches: Is_Running
Variables: Timer

if Switch[001: is_Running] ON
variable[001: Timer] add 1
if variable[001: Timer] greater than or equal to 15
$game_party.actors[0].sp -= 1
variable[001: Timer] equal 0
end
end
else
$game_party.actors[0].sp -= 1
variable[001: Timer] equal 0


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.