Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

Two Key Activated Events

I'm back with some more requests (I have off from school this week, so I'm working a lot on my game now).  I tried these using events, but they did not work right.  As for the requests, here they go:

1) First, I need a script that will allow the player to turn on an oil lamp by pressing "L" on the keyboard (both the item "Oil Lamp" and "Oil" must be in their inventory).  The event must reduce the amount of "Oil" (by one) in the player's inventory every time the event is activated, and also must reduce the amount of "Oil" by one every 400 frames.  While active, the oil lamp should set the screen color tone around the player to the default setting (0,0,0,0) over a period of 20 frames (leave the rest of the screen dark).  When the "L" button is released (or when the oil runs out), the event should end, and the screen should return to it's normal state of darkness.  When the player tries to activate the event without oil in the inventory, a text box should appear that says "You need oil to use this lamp."  If the player tries to activate this event when the switch "darkness" is off, a text box should appear that says "You have no use for that here."  This event should also be activated when the player chooses the item "Oil Lamp" from the inventory.

2) My other request is similar, but probably a lot simpler.  I basically need a script that changes the player's speed from 3 to four when holding "R" and when it is released, the speed returns to normal.  I know there are scripts for this already, but I need some other features added to it that are not in other scripts.  First of all, the player should only be capable of using this "running" ability once a certain switch is activated.  Secondly, I would like the script to make the character floating on top of a blue semi-transparent disk (feet don't move when on the disk, but the disk would stay under the character as he/she floats along).  I realize that I can't ask you to create the graphics and such, but could you create the script, and then explain how to add my disk graphic into it (or where to store my disk graphic so that it will appear under the character.  That would be really helpful.

Thanks in advance for the help!  I appreciate it!
 
*Cough, can be done with common events, cough* Waits for moderator to get mad. Seriously though all you have to do for 2 is make a common event that is parrel process activated by said switch and have it change the speed from 3 to 4. Then make a new grphic with your dude on the disk, and go back to the common event and add the change graphic cammand. Then you'll probably want a second off switch that ativates another common event that makes it all normal again. As I said, I now await the nasty, "He wanted scripts, not events!", comments I have coming. Good day!
 
Only problem is you can't use L or R on the keyboard, so you'll need a script to get those commands if you REALLY want them. Otherwise, stick to pressing Q, W, A, S, D, Z, X, or C.
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top