Help. Trying to create a stealth tag event system

JustKrancy

Warper
Member
Joined
Mar 17, 2018
Messages
1
Reaction score
0
First Language
English
Primarily Uses
RMMV
Hi,

I'm trying to create a stealth tag event system as the title says, where the event will wonder the map until it sees you, then it'll chase you and catch you.

I found this thread which I've based my code on, translating the code for RMMV: https://forums.rpgmakerweb.com/index.php?threads/direction-based-line-of-sight-events.3452/

My current problem I'm having is a SyntaxError: Unexpected end of input and I'm not sure what to do.

I've included a screenshot of the console when the error occures.

This is my first time posting, so apologies if this is in the wrong section.

What I've got...
Code:
function getEventId() {($gameMap.event(this._eventId).x - $gamePlayer.x).abs <= 1 && ($gameMap.event(this._eventId).y - $gamePlayer.y).abs <= 3 || ($gameMap.event(this._eventId).y - $gamePlayer.y).abs <= 1 && ($gameMap.event(this._eventId).x - $gamePlayer.x).abs <= 3
Code:
function getEventDir() {$game_map.event(this._eventid).direction == 2 && $gameMap.event(this._eventId).y < $gamePlayer.y || $gameMap.event(this._eventId).direction == 8 && $gameMap.event(this._eventId).y > $gamePlayer.y || $gameMap.event(this._eventId).direction == 4 && $gameMap.event(this_eventId).x > $gamePlayer.x || $gameMap.event(this._eventId).direction == 6 && $gameMap.event(this._eventId).x < $gamePlayer.x}
Code:
function oneBlockCheck() {(($gameMap.event(this._eventId).x - $gamePlayer.x).abs + ($gameMap.event(this._eventId).y - $gamePlayer.y).abs) == 1}
 

Attachments

Last edited by a moderator:

Kes

Veteran
Veteran
Joined
Aug 3, 2012
Messages
22,299
Reaction score
11,713
First Language
English
Primarily Uses
RMVXA
@JustKrancy If you want to add additional information, please just edit your earlier post and include it there. I have merged your two posts into one.
 

Clock Out

Veteran
Veteran
Joined
Jun 14, 2016
Messages
92
Reaction score
45
First Language
English
Primarily Uses
RMMV
Defining a function in a Script Event Command doesn't create the function for use later. Create a plugin file for your functions and add it to the plugin to the project.

The getEventId() function is missing it's closing brace/curly bracket which is the source of the error message. Game_Event objects do not have an abs property and trying to access a property an object does not have results in a value of undefined. I assume the code means to get the absolute value of the x coordinate of an event. There's no return statement in the getEventId()which means its return value will be undefined. I'm guessing the language being translated from has some form of implicit return feature but JavaScript functions have to be told to return a value.

Code:
function example() {
    1 + 1;
}

example(); // Return value: undefined

function example1() {
    return 1 + 1;
}

example1(): // Return value: 2
There's more but that's all I've got time I've got for now.
 
Last edited:

Users Who Are Viewing This Thread (Users: 0, Guests: 1)

Latest Threads

Latest Profile Posts

Day 9 of giveaways! 8 prizes today :D
He mad, but he cute :kaopride:

Our latest feature is an interview with... me?!

People4_2 (Capelet off and on) added!

Just beat the last of us 2 last night and starting jedi: fallen order right now, both use unreal engine & when I say i knew 80% of jedi's buttons right away because they were the same buttons as TLOU2 its ridiculous, even the same narrow hallway crawl and barely-made-it jump they do. Unreal Engine is just big budget RPG Maker the way they make games nearly identical at its core lol.

Forum statistics

Threads
106,040
Messages
1,018,476
Members
137,824
Latest member
dobratemporal
Top