Author Topic: Making an object show only once?  (Read 2682 times)

BoshyMan741

  • Wannabe
  • Posts: 29
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 36.0.1985.143 Chrome 36.0.1985.143
    • View Profile
  • Playstyle: Keyboard
Making an object show only once?
« on: December 07, 2014, 08:14:00 PM »
Does anyone here know how to make objects only appear once. (In Gamemaker 8.1) Kinda like the warnings in Happil 2 how they only appear once until you reset/press esc. No one on skype knew how.  :BibleThump:

pieceofcheese87

  • Global Moderator
  • The Kid
  • Posts: 346
  • Personal Text
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 39.0.2171.71 Chrome 39.0.2171.71
    • View Profile
    • Twitch Tv Channel
  • Playstyle: Keyboard
Re: Making an object show only once?
« Reply #1 on: December 07, 2014, 09:38:17 PM »
Make it a persistent object. Have it become invisible instead of destroying itself, and it destroys itself on the room end event
Signature

Sephalos

  • Spike Dodger
  • Posts: 228
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Chrome 38.0.2125.111 Chrome 38.0.2125.111
    • View Profile
  • Playstyle: Gamepad
Re: Making an object show only once?
« Reply #2 on: December 07, 2014, 11:03:08 PM »
Global variables would do the trick. Simply do something similar to this.

Code: [Select]
If global.warning[1] = 0 {
      // put your warning script here
      global.warning[1] = 1;
}

Global variables are persistant until you close or reset the game (or until you reset them to 0 manually). The number 1 within the square brackets can be changed so you can have many different warnings in your game.

BoshyMan741

  • Wannabe
  • Posts: 29
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 36.0.1985.143 Chrome 36.0.1985.143
    • View Profile
  • Playstyle: Keyboard
Re: Making an object show only once?
« Reply #3 on: December 07, 2014, 11:53:16 PM »
Thank you!  :BloodTrail:

BoshyMan741

  • Wannabe
  • Posts: 29
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 36.0.1985.143 Chrome 36.0.1985.143
    • View Profile
  • Playstyle: Keyboard
Re: Making an object show only once?
« Reply #4 on: December 08, 2014, 01:22:36 AM »
Oops... By reset I meant as in pressing F2 not R. Is there a way to change it?

Stepcore

  • Cherry Eater
  • Posts: 87
  • Dreamer of Wizard
  • OS:
  • Windows 7/Server 2008 R2 Windows 7/Server 2008 R2
  • Browser:
  • Chrome 39.0.2171.71 Chrome 39.0.2171.71
    • View Profile
  • Playstyle: Keyboard
Re: Making an object show only once?
« Reply #5 on: December 08, 2014, 03:10:40 AM »
If it shows every time you press R it's because you manually set it to 0 in that room or it's not global.
:PogChamp:

Sephalos

  • Spike Dodger
  • Posts: 228
  • OS:
  • Windows XP Windows XP
  • Browser:
  • Chrome 38.0.2125.111 Chrome 38.0.2125.111
    • View Profile
  • Playstyle: Gamepad
Re: Making an object show only once?
« Reply #6 on: December 08, 2014, 03:04:43 PM »
If your global variables are reseting to 0 when you press "R" you might be having a problem with the engine.

Check the load scripts and make sure the game doesn't have a restart_game in there. If you do that however, you might have other problems with global trigger variables wich you will need to set to 0 when pressing "R". (before the loadGame script is executed)

BoshyMan741

  • Wannabe
  • Posts: 29
  • OS:
  • Windows 8.1/Server 2013 Windows 8.1/Server 2013
  • Browser:
  • Chrome 36.0.1985.143 Chrome 36.0.1985.143
    • View Profile
  • Playstyle: Keyboard
Re: Making an object show only once?
« Reply #7 on: December 08, 2014, 07:00:40 PM »
Yep that was the problem too.  :tenKapple: I fixed the other global variables too. Thanks.  :atkHappy: