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
If you're not familiar with variables or run into some other problem, I can write something out in more detail if you want.
You can either do this completely through variable operations and such, or with a little bit of scripting. The latter method only requires 1 variable and this is how you should set up your pages:
Page 1[i.imgur.com]
Page 2[i.imgur.com]
If you want to do this with event commands only, reserve about half a dozen variables:
Make a new event command, on the first page there's Control Variables... -> Set -> Game Data... -> Character [Player]'s [Map X] and store that in an empty variable. Do the same for [Player]'s [Map Y], [This event]'s [Map X] and [This event]'s [Map Y].
Now take the variable containing the Player's X, and subtract the This event's X from it. Do the same for the Player's Y and the This event's Y. Make a Conditional Branch to check if either of them is negative, and if so, multiply that variable by -1 to make it positive.
If both the X-difference and Y-difference are positive, just add them together and you have the distance (in tiles) from the monster to the player. Then you can just do another Conditional Branch to see if it's close enough for the monster to start following.
Define a range of which event ids should be checked.
Determine a Radius. If the Event is inside it, the Self Switch A of that Event will turn on.
On that new Eventpage you could make a new moveroute where the event chases the player.
1. Create a Common Event with Trigger None.
2. Use the Eventcommand "Script" on the 3rd page of Event Commands.
And paste the following Code:
#----------------------------------------------
#Hit_Box
#----------------------------------------------
for a in (1..50) #<-Range of Enemy_Ids#
if $game_map.events[a] != nil
if Math.hypot($game_map.events[a].screen_x -
$game_player.screen_x , $game_map.events[a].screen_y -
$game_player.screen_y) <= 32 #<--Pixel Range Radius#
$game_self_switches[[$game_map.map_id, a, 'A']] = true
end ; end
end
3.
Make one Event on your Map that is Paralell processing. (You will have 1 Event that can handle hundrets thats better than having too many parallel events at the same time).
4.
Insert the Eventcommand: Call Common Event (Choose the Common Event which include our above Code)
5.
Insert the Eventcommand: Wait 60Frames (Thatway its only asking once per seccond on that map)
now it should work.
Edit: Insteed of making a common event you could just use the paralell process without calling the common event. i do it with common event because i use same system on several maps. and its easier to change one commomnn event than many events one per map.
Edit2: there are many different ways to build something that does exxactly what people want^^.
and for yours Hajami, how would I define a range of Id's and a radius at the beginning of the solution?
Otherwise, it depends on the variable you do the calculations on. You'd want to use at least 4 variables (to store the player's x and y and the monster's x and y) and then it's up to you. Either you can make a new variable and do the calculations in that one, though it's faster to just take one of those 4 starting variables and do the calculations on those.
(e.g.: Variable 1 has the player's x, variable 3 has the monster's x. You subtract variable 3 from variable 1. Variable 1 now contains the distance over the x-axis.)
You just have to follow the steps but you can change the values in the event script.
for a in (1..50) <--These are the Event Ids that will be Checked when the Common Event is Called. In this Case Events 1 till 50 you can change the numbers.
if Math.hypot($game_map.events[a].screen_x -
$game_player.screen_x , $game_map.events[a].screen_y -
$game_player.screen_y) <= 32 #<-- 32is a Radius of 1 Map Tile. Change the number to change the Radius to the distance you want.
Edit: Iam no Scripter, i just know a little operators and some logic, so i cant help with advanced solutions, but like i said there are many ways to achieve the same goal.
http://steamcommunity.com/app/363890/discussions/0/357284767233145316/