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.

Lockpicking system

So that is what i request. Lockpicking system.

It should work like that:

- You will have lockpicking lvl:s. As more you have level, that easy those door opens will be.

- On door, they is system that asks lockpicking. Then there is random system which is trying to open door.

So if you have level 100 lockpicking, all doors will open.

Every lockpicking gives lockpicking EXP.
 
It's pretty simple. You could use a common event and few variables. You really don't need a script to do this but if you want one, here it is:

Code:
[SIZE=2][COLOR=#0000ff][SIZE=2][SIZE=2][COLOR=black]class Game_Actor[/COLOR][/SIZE][/SIZE][/COLOR][/FONT]
[SIZE=2][COLOR=#0000ff][SIZE=2][COLOR=black]attr_accessor :lockpicking_level[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]attr_accessor :lockpicking_level_max[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]attr_accessor :lockpicking_exp[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]alias dargor_lock_actor_initialize initialize[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]def initialize[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]  dargor_lock_actor_initialize[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]  @lockpicking_level = check_lockpicking_level [/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]  @lockpicking_level_max = 100[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]  @lockpicking_exp = 0[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]end[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]def lockpick(lock_level)[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]  #simple formula[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]  success_rate = (@lockpicking_level*100)/lock_level[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]  if rand(100) <= success_rate[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    @lockpicking_exp += 5[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    @lockpicking_level = check_lockpicking_level[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    # Success[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    return true[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]  else[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    # Failure[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    return false[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]  end[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]end[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]# Change lockpicking level[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]# I know the leveling "formula" is horrible[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]def check_lockpicking_level[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]  case @lockpicking_exp[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    when 0...19[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]      return 1[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    when 20...39[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]      return 20[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    when 40...59[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]      return 50[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    when 60...79[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]      return 75[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    when 80...100[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]      return 100[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    else[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]      return 1[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]    end[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black] end[/COLOR][/FONT][/SIZE]
[SIZE=2][COLOR=black]end[/COLOR][/FONT][/SIZE]
[/COLOR][/SIZE][/SIZE]

It's a pretty simple code made in 5 minutes, at school using Near Fantastica's RGSS Scripter:p. I can't test this script right now but I will when I'll get back home.

How To Use:
1-Set up your door event.

2-Add a "Lockpick" choice

3-Add this script line in under the choice:
Code:
$game_actors[actor_id].lockpick(lock_level)
where actor_id is the id of the actor trying to lockpick the door, lock_level is the lock level of the door.

4-Add a conditional branch under the script line and put a scripted condition (4th tab):
Code:
$game_actors[actor_id].lockpick == true

5-When condition is met, show a message saying something like "Success!" and when the condition is not met, show a message saying something like "Failed..."

If you encounter some problems, tell me.
Hope you like it!

-Dargor
 
$game_actors[id].lockpicking_level is the variable containing the lockpicking level of a given actor. You can make a window displaying it.

EDIT: The leveling system is so crappy, I'll make a better one soon.
 
What about my error? Something with the script interferes with Game Actor. I think you should fix that or supply a fix. And I agree with Isopaha, there should be a way of notifying your character when he or she has achieved a lock picking level, or what their current lock picking level is.
 
That will be most helpful. Hope to see it completed. I would do it with events but I don't want to take up all my variables for a lock picking system, and it's easier with a script.
 
Sorry guys, i didn't have time to post the script last night. I'll post a demo tonight with a lil' lockpicking menu. You can choose which party member will try to lockpick the door + there's a window in the top left corner displaying the actor's lockpicking level and exp. Keep posting suggestions if you have some!
 
I suggest you to wait a bit, i made it in 5/10 minutes and personally, it's crap:p There's almost no comments, the leveling system is ugly, ect.
I'll release an official version tonight, the coding will be way better!:p
 
the script is 99% completed. And I love it! :)
I just want to know something Isopaha. How do you want to use the lock pick? Do you want an actor to equip it and use it or simply have it into your inventory without having to equip it?
 
Dargor;194946 said:
the script is 99% completed. And I love it! :)
I just want to know something Isopaha. How do you want to use the lock pick? Do you want an actor to equip it and use it or simply have it into your inventory without having to equip it?

Hmm.. I think it is better when it not have to be equip it. Then script selects the best lockpick what is in inventory.
 

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