Indie Dev

Hello Guest!. Register a free account today to become a member! Once signed in, you'll be able to participate on this site by adding your own topics and posts, sell your games, upload content, as well as connect with other members through your own private inbox!

Turn Towards This Event

Status
Not open for further replies.
U

Unmercyful

Guest
Is there a command or script call that makes the player turn towards the currently running event? Closest thing I could find is in Galv's Move Route Extras:

this.turn_toward(i);

But with that command you have to input an eventId number on each event. I am looking for an alternative way to do this, but without having to write each individuals eventId number. If anyone knows of a possible solution I be very much appreciated
 

MinisterJay

Administrator
Staff member
Administrator
Can the event be approached from different directions? If so, you could put events as the player approaches, that within the parameter of event you want them to 'look at"/face. Simply create an event, and on 2nd set Set Movement Route, then Turn [Desired Direction]. Within same event, put a wait feature, that gives player the signal something important is ahead of me. If there are multiple directions to face from, just cut and paste this event on parameter, and change the direction turned for the different directions, within each individual event.
 
U

Unmercyful

Guest
Thanks for the reply. I have a lot of ABS events set on player approach that I am trying to make the player turn to target before shooting or melee. And with: "this.turn_toward(i); " it simplified things, but still have to input each Id number. My battle sequences are in Common events. If your option is easier and I am misunderstanding I'd really like to know and could you please reinform me.
 

MinisterJay

Administrator
Staff member
Administrator
Sometimes going more complex takes simplicity. Why not try it one time, and sees if it functions, the way you desire. This method does not require an idea number, it just requires character to touch the event. Immediate after, you could then place the Common Events, or whatever else you desire.
 
U

Unmercyful

Guest
How would that work on a ranged attack in the player is not able to touch the event ?

I must be missing something here easy or just not visualizing what you are saying, I did what you said, I think, but just not able to get the player to turn towards the event to target unless it is event touch or player touch.
 
Last edited by a moderator:
U

Unmercyful

Guest
I really appreciate your input but that option won't work with what I am looking for. If you or anyone else knows of another way I be happy to hear from you (wide)
 

eivl

Local Hero
Xy$
0.00
So.. i think i have been hit with a stupid stick today, what are you trying to do?
Events are stored on the map and can be accessed with $gameMap.event
if you want to do something when event x is happening i first need to know what the event is doing, because if it is moving you can access this information.

$gameMap.events()[eventId].isMoving()

if there is something else you need to check for you have to options, add code via a plugin that let you check for it like this

$gameMap.events()[eventId].isEventDoingSomething()

or you need to add variable checks or switches during runtime and check agains those.
 
U

Unmercyful

Guest
Basically, I'm just trying to have the player turn and face an moving event that has their x and y coordinates locked and the event is more than 1 tile away. I am using Galv's Move Route Plugin that has this command " this.turn_toward(i); " but that you have to input the events id number on each event. I have been looking for a way to do this without having to input Id's for each ABS event. Here is screen shot of the command I am using atm:
Screenshot (105).png

I hope that kinda explains better what I am trying to accomplish. If not I'll do what I can to explain better(wide)
 

eivl

Local Hero
Xy$
0.00
you just go through all events on the map and do a isMoving() check to find it, then you have your id to use with galvs turn_toward function.

did that make any sense? you could also send me a sample map of what you are doing as well! That might be easier ;)
[doublepost=1455025537,1455025487][/doublepost]
How do you know the event is "currently running"?
well, guessing that there is some controls that makes it so only one event is moving
[doublepost=1455025951][/doublepost]Just to see if i get this...

Let us say you have 4 events, they move in a little circle one after the other. one is north, one is east, one is south and one is west.

so you want it so the turn_toward(i) function will work no matter who moves?
 
U

Unmercyful

Guest
The event is set on attacking the player which is activated by line of sight.
[doublepost=1455026809,1455025963][/doublepost]
Just to see if i get this...

Let us say you have 4 events, they move in a little circle one after the other. one is north, one is east, one is south and one is west.

so you want it so the turn_toward(i) function will work no matter who moves?
I can do that already, just looking for a way to do this without having to input the 'i' in turn_toward(i) function on every single event.
 

eivl

Local Hero
Xy$
0.00
Then what you are explaining you want does not make this possible.
I was under the impression that events where moving and you wanted to check agains that.

are you using the build in approach player from the editor?
 
The event is set on attacking the player which is activated by line of sight.
- conditional branch: if [event] sees [player] (I am assuming you have this set up already, and I am assuming I have understood right in that if the event sees the player)

Then you probably want this in JS form (@eivl!) in that conditional branch

variable eventId = this.eventId (setting to a global variable)

Then on the player's movement route...

this.turn_toward(eventId);

I'm a bit confused though - could you draw or diagram what you want? I'm not sure who's meant to be doing the turning - you say the player, but then the events are mentioned again?
 

eivl

Local Hero
Xy$
0.00
Oh.-.. wait... do you want the player or the event (or both) to turn to each other?

yeah... i am confused as well now...

make a drawing of what you want and i will fix it for you ;)
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
Sounds like you will need a Plugin for this. Specifically a few snippets, a for loop to run through each event and check which one is moving and closest to you then to return a value which you can input into your turn towards command. I can't see any other way to accomplish this as there is no way to check all events to see what one is moving and then for it to return a value based on distance without doing loop of some sort.
 
U

Unmercyful

Guest
Then what you are explaining you want does not make this possible.
I was under the impression that events where moving and you wanted to check agains that.
Sounds like you will need a Plugin for this. Specifically a few snippets, a for loop to run through each event and check which one is moving and closest to you then to return a value which you can input into your turn towards command. I can't see any other way to accomplish this as there is no way to check all events to see what one is moving and then for it to return a value based on distance without doing loop of some sort.
After days of trying to figure this out through eventing, I believe you are right. I'll either have to deal with imputing each events id number or find someone to pay to have a plugin made.

you could also send me a sample map of what you are doing as well! That might be easier ;)
If you still think that it is maybe possible through eventing then I will make a small demo to send to you if you don't mind checking it out.

Just one last thing. I really appreciate your time, patience and knowledge. I know I am not the best at explaining myself and your help has gone above and beyond. Thanks so much !!
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
I personally don't think it would be a complicated plugin to create because technically you only need a piece of code which will return the event which is near you and moving. I got the day off today, let me play around a bit and see what I can come up with for you as a plugin.
 
U

Unmercyful

Guest
That would be awesome! You do understand what I want though. I know I can be confusing (my epilepsy doesn't help much).
 

LTN Games

Master Mind
Resource Team
Xy$
0.01
You want the player to turn towards the event which is closest to him/her? Assuming you want this to run all the time as it is unpredictable when an event is close to the player as it can happen anytime. That being said it would need to be a plugin that will always check through all events and when one event is close enough automatically turn the player towards the event. It's actually really similar to my Event Fade plugin, which is as easy as putting inside the events move route[ this._visibleRange = 12; ]and whatever event has this will make the event only visible from 12 tiles and as they get closer the more opaque they become.
 
Status
Not open for further replies.
Top