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.
Key Item + Running [2k3]

0 Members and 1 Guest are viewing this topic.

****
Touhou Fantasy Developer and all around cool person. :)
Rep:
Level 85
T.G. "Thunder God" Xenomic
I know, title is vague but couldn't think of a better one....

So, I was reading some tutorials, and someone suggested me to make a key item that'll let you run faster if you hold a button, much like in the Pokemon games. Thing is, I'm not exactly sure on how to code this. Like....you can walk normally when you have said item, but by holding like say....B....you'll run double speed....kinda like Sprint Shoes, but not equipped.

**
Rep: +0/-0Level 68
RMRK Junior
Common Event (Trigger: Parallel Process)

Branch if Switch [0001] is OFF
 Key Input Processing: Var [0001] (Set to "Equal to 7", untick "Wait until key pressed")
 Branch if Var [0001] is 7
  Move Event: Hero, Increase Move Speed, Change Graphic
  Wait 0.2 Sec
  Switch [0001] ON
 End
End

Branch if Switch [0001] is ON
 Key Input Processing: Var [0001] (Set to "Not 7", untick "Wait until key pressed")
 Branch if Var [0001] is 7 Not
  Move Event: Hero, Decrease Move Speed, Change Graphic
  Wait 0.2 Sec
  Switch [0001] ON
 End
End

If you're increasing and decreasing speed more than what I've shown, remember its a 0.1 Sec wait for each additional movement.

If you want it to trigger only when a certain item is equipped, encase the first part in a "Conditional Branch: HERO equipped with Speed Item". If you want it to work for all heroes, add an else, and put in a "Conditional Branch: HERO2 equipped with Speed Item". If you want to

Probably a neater way, but that should work anyway. Coincidentally, I'm making a Pokémon game. Go figure.

**
Rep:
Level 66
RPG2k3 Meowster
Common Event (Trigger: Parallel Process)

Branch if Switch [0001] is OFF
 Key Input Processing: Var [0001] (Set to "Equal to 7", untick "Wait until key pressed")
 Branch if Var [0001] is 7
  Move Event: Hero, Increase Move Speed, Change Graphic
  Wait 0.2 Sec
  Switch [0001] ON
 End
End

Branch if Switch [0001] is ON
 Key Input Processing: Var [0001] (Set to "Not 7", untick "Wait until key pressed")
 Branch if Var [0001] is 7 Not
  Move Event: Hero, Decrease Move Speed, Change Graphic
  Wait 0.2 Sec
  Switch [0001] ON
 End
End

If you're increasing and decreasing speed more than what I've shown, remember its a 0.1 Sec wait for each additional movement.

If you want it to trigger only when a certain item is equipped, encase the first part in a "Conditional Branch: HERO equipped with Speed Item". If you want it to work for all heroes, add an else, and put in a "Conditional Branch: HERO2 equipped with Speed Item". If you want to

Probably a neater way, but that should work anyway. Coincidentally, I'm making a Pokémon game. Go figure.

Wow, I was never able to figure this out when I tried it myself for my own projects. It always managed to skip itself and go way slower or way faster depending on how often I hit the button. I guess the wait prevents that? o.O

**
Rep: +0/-0Level 68
RMRK Junior
It does, but the whole thing is a pain in the butt. A lot of the time it just decides "hey, I'm gonna screw up".

****
Touhou Fantasy Developer and all around cool person. :)
Rep:
Level 85
T.G. "Thunder God" Xenomic
I remember a friend of mine implementing a run system in his game. There were times when if you mashed the run button (I tested this to see what would happen), it would perma-force you to run faster by a certain speed, and other times, it ends up making you move super slow. @_@