Hello Guest, please login or register.
Did you miss your activation email?
Login with username, password and session length.

Pages: [1]   Go Down

Author Topic: [Request / Listing] Keys?  (Read 3111 times)

0 Members and 1 Guest are viewing this topic.

King Tetiro

Leader of Phoenix Heart
[Request / Listing] Keys?
« on: May 14, 2006, 07:25:56 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
How do you do keys, locked doors and boss keys? Anyone got an engine?
GM6.1 registered. (I have tried to think of a way but I had no luck)
« Last Edit: February 09, 2012, 03:33:53 pm by Niek »
Logged
  • Phoenix Heart
Re: Keys?
« Reply #1 on: May 14, 2006, 07:27:39 pm »
  • =/
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Posts: 2284
Something like this:
Collision with door:

if global.keys > 0{
 with (obj_door) instance_destroy();
}

Assuming the door is an object.
Logged

King Tetiro

Leader of Phoenix Heart
Re: Keys?
« Reply #2 on: May 14, 2006, 07:32:21 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
Yeah but there's a problem, I can't make the rooms permenant.
Would this work? (May be a long bit of work but hey it could work)

global.key_ =0- No key
global.key_ =1-1 key
global.key_ =2- Can't use that certain key again but door no longer there

Would that work (If it does, how could I display it as a number of keys?)
Logged
  • Phoenix Heart
Re: Keys?
« Reply #3 on: May 14, 2006, 07:47:16 pm »
  • Master Of Disaster
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 2330
« Last Edit: February 11, 2012, 07:18:27 am by Niek »
Logged


.TakaM was here
  • Lumeuni

King Tetiro

Leader of Phoenix Heart
Re: Keys?
« Reply #4 on: May 14, 2006, 07:56:34 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
Thanks, I'll try that tomorrow (until then....)
Logged
  • Phoenix Heart
Re: Keys?
« Reply #5 on: May 14, 2006, 08:01:15 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 268
I can tell you how to do key in RM2k PM me If you want to know How
Logged

dylan623

Re: Keys?
« Reply #6 on: May 14, 2006, 08:13:17 pm »
This is simple. Simply set a variable for your character object like dungeon1_boss_key to true when you collide with a boss key object. Then if you collide with the boss door you can get through if dungeon1_boss_key is equal to true.
Logged

aab

^ Evolved from a Hobbit
Re: Keys?
« Reply #7 on: May 14, 2006, 10:03:18 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 992
You could make it that every door in the game (capable of being locked/unlocked) has a unique id.
Store an array or something globally (in a file: even better) with each door id, and its matching value: 0 for 'open', 1 for 'still locked'.
When you enter an area, loop through all the door objects that are in that area: Enable them/set as closed if the door id that that door has been assigned has a value '1', and disable/dont enable if the value is '0'.

Instead of '0' and '1', use identifiers like door_open and door_closed, for versatility, readability and code expansion.
The door id values could simply be their position in the file or in the array, eg: 0,1,2,3 ...
However it'd be easier and more manageable to assigne them something with respect to their room, eg:
a string:
"0:0" first door in room with value 0.
"0:1" second door in room with value 0
"2:34" 35th door in room with value 2
Or if you dont mind a limited number of doors per room:
Same examples:
0000
0001
0234
or just:
0
1
234

Something even more meaningfull would be even more versatile, though less efficient. Certainly flexibilty and it being easier to apply door values would be good.
Could use a meaningfull id string, eg: "Forest Grove:0", or have an array for each room, and use constants given the values of the rooms.


Logged




I ♥ Sol
.... I ♥ Sol ? wtf how long has that been there? >_> *rrrrrrrrar*
  • MySpace

King Tetiro

Leader of Phoenix Heart
Re: Keys?
« Reply #8 on: May 15, 2006, 05:03:24 am »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
I had a thought.
My idea won't work. Could someone make me an engine for keys I mean I'm stumped.

  • Using Lttp sprites
  • GM6.1-Registered
  • Quite easyish to understand
  • Rooms are NOT persistant
  • Hero is
  • Hud for the keys included?(If not too hard)

If anyone can do this, thanks.
Logged
  • Phoenix Heart

A Storm in the Desert

Eternal Triangle
Re: Keys?
« Reply #9 on: May 15, 2006, 10:14:11 am »
  • Wear the Deku Sprout Smile :]
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 222
DOORS

This would go in the Create Event for the door objet.
Code: [Select]
// Argument 0 is the number of the door
execute_string("global.open"+string(argument0) = false)
If your rooms are not persistant then you need global values.

This would go in the code for when the door is opened (by a button or by walking into the door)
Code: [Select]
// Argument 0 is the number of the door
if global.keys => 1
execute_string("global.open"+string(argument0) = true)

And this would go in the Step event for the object
Code: [Select]
// Argument 0 is the number of the door
switch global.open {
 case "false" : image_single = 0
 case "true"  : image_single = 1
 }
The sprite for the door would need to be closed on the first frame (0), and open on the second (1). All of these would be scripts, and you'd make argument 0 a different number for each door. Or a codename. eg: foresttemple1, foresttemple 2,...etc.

KEYS

These would be just scripts.

In the collision event between link and the key:
Code: [Select]
global.keys += 1
instance_destroy(self)

If the key is in a chest, simply put
Code: [Select]
global.keys += 1
in the chest event for when it's opened.

KEY DISPLAY

Create a persistant object.

Create Event
Code: [Select]
global.keys = 0

Draw Event
Code: [Select]
if global.keys < 10
numbertodrawk = "0" + string(global.keys)
else
numbertodrawk =  string(global.keys)

if global.rupees = 0
textcolor = sprLettersGray
if global.rupees = 500
textcolor = sprLettersGreen
if global.rupees != 0 and global.rupees != 500
textcolor = sprLettersWhite
draw_sprite_ext(sprkeyicon, 1, view_xview[0]+8,view_yview[0]+182, 1,1, 0, c_white, c_white)
draw_text_sprite2(view_xview[0]+12,view_yview[0]+186,string(numbertodrawk), -1, 4, textcolor, 33, 1)

Thar. That'll do it. If anyone spots errors, tell me.

EDIT: Oh, and if you want to make the key counter invisible while you're not in a dungeon, just make it invisible while outside.
« Last Edit: May 15, 2006, 10:17:24 am by A Storm in the Desert »
Logged
Surely you can do it!
Believe in your strengths...Believe...

        -Happy Mask Salesman

King Tetiro

Leader of Phoenix Heart
Re: Keys?
« Reply #10 on: May 15, 2006, 03:05:43 pm »
  • *
  • Reputation: +0/-0
  • Offline Offline
  • Gender: Male
  • Posts: 3549
I may have figured out how to. Unless I find it doesn't work, this topic is locked
Logged
  • Phoenix Heart
Pages: [1]   Go Up

 


Contact Us | Legal | Advertise Here
2013 © ZFGC, All Rights Reserved



Page created in 0.25 seconds with 59 queries.

anything