Zion774

Regular
Regular
Joined
Jul 24, 2015
Messages
40
Reaction score
1
First Language
English
Primarily Uses
Hello so i'm making a game where you can fight enemies, and then after a certain amount of time they respawn.
Now my friend and I (mostly him) wrote a ruby script that allowed us to have that event respawn, through an event call.
But we need to only respawn the event if the event has been erased.

We tried this...
if $game_map.events[3].erase
$game_map.respawn_event(3)
end
$end

now the respawn event works. But what happens is instead of checking if the event has been erased. It just completely erases it. which confused both of us.

we also tried $game_map.events[3].erase = true and $game_map.events[3].erase?

but obviously those did not work.
If anybody knows how to do this I would be so grateful! HERE is the script we (mostly him) wrote.
upload_2018-2-8_20-6-53.png
 

Attachments

  • upload_2018-2-8_20-6-40.png
    upload_2018-2-8_20-6-40.png
    620.9 KB · Views: 5

TheoAllen

Self-proclaimed jack of all trades
Regular
Joined
Mar 16, 2012
Messages
7,534
Reaction score
12,008
First Language
Indonesian
Primarily Uses
N/A
You would need to create a new method to detect if it's erased first
Code:
class Game_Event
  def erased?
    return @erased
  end
end
Then to check, you can use the method
 

Zion774

Regular
Regular
Joined
Jul 24, 2015
Messages
40
Reaction score
1
First Language
English
Primarily Uses
You would need to create a new method to detect if it's erased first
Code:
class Game_Event
  def erased?
    return @erased
  end
end
Then to check, you can use the method
Thank you so much!!!!! I figured it would just be making another method but I wasn't 100% sure on where to put it (EX Class Game_Event) Thank you so much again!
 

Kes

Regular
Regular
Joined
Aug 3, 2012
Messages
23,894
Reaction score
13,906
First Language
English
Primarily Uses
RMMZ
[move]Learning Ruby and RGSSx[/move]
 

Latest Threads

Latest Profile Posts

Updated my game's development post with the first video of it in action!


'Milestone Get!' :p
Heh, heh. I've been experimenting with a naughty word detector Common Event and using scripts to check certain strings. I never thought I would see such language in computer code. I would post a screen shot, but it probably wouldn't be appropriate, even with a Spoiler. But it certainly makes me laugh and it works great.
Yknow what? Im seriously considering recruiting a manager to oversee my games development.
Because I cannot focus or complete these tasks by myself. I need someone to give me orders, without having them be my boss.

Forum statistics

Threads
136,806
Messages
1,270,211
Members
180,560
Latest member
Tvrangerflipper
Top