Install Steam
login
|
language
简体中文 (Simplified Chinese)
繁體中文 (Traditional Chinese)
日本語 (Japanese)
한국어 (Korean)
ไทย (Thai)
Български (Bulgarian)
Čeština (Czech)
Dansk (Danish)
Deutsch (German)
Español - España (Spanish - Spain)
Español - Latinoamérica (Spanish - Latin America)
Ελληνικά (Greek)
Français (French)
Italiano (Italian)
Bahasa Indonesia (Indonesian)
Magyar (Hungarian)
Nederlands (Dutch)
Norsk (Norwegian)
Polski (Polish)
Português (Portuguese - Portugal)
Português - Brasil (Portuguese - Brazil)
Română (Romanian)
Русский (Russian)
Suomi (Finnish)
Svenska (Swedish)
Türkçe (Turkish)
Tiếng Việt (Vietnamese)
Українська (Ukrainian)
Report a translation problem
As you can see from GM's example you will first need a grid, and then a controller object updates the enemy every few seconds.
You can convert this to your style by
1. creating a grid in the create event of the enemy (without globalvar in front of it) and start the alarm event to update 30-90 steps (1-3 seconds)
EDIT: the code has been revised a few times since original post. I added in the path_end() and path_clear_points() functions in the alarm event for possible old/new path conflicts. You'll also notice that you'll have to change the names of objects, paths, and other resources to fit your game. Also the values of the path_start function may not be your desired values.
So what's the proper way to make it trigger whenever the player object comes into range then?
Alarms work by counting down. You give the alarm a starting value (such as 3) and every step it will count down 1 until it reaches (0) and triggers the event. When the alarm is shut off (aka: not counting) the value is (-1)
So to expand on MrDave's comment. When you say
so would that be something like
in the step event
EDIT: at zero the alarm event will trigger any actions/code you have in the alarm event. Doing something like this can skip the event all together
EDIT: setting the alarm to zero executes the alarm's action/code. This is how we short circuit the alarm. Say you set the alarm to go off in 30 steps. Like patrolling. But then the player comes into view and you want to stop his alarm and go to chase. You would just set the alarm to zero to execute the actions, or -1 if you just want to stop the alarm