"pre-moveto" event
Moderator: Forum Moderators
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
"pre-moveto" event
I'm looking for something like a "pre-moveto" event. I want to fire an event based on a unit's target hex (like moveto), but I want the event to fire as the unit starts moving instead of at the end of its move. Is there a way to do this?
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
- Pentarctagon
- Project Manager
- Posts: 5564
- Joined: March 22nd, 2009, 10:50 pm
- Location: Earth (occasionally)
Re: "pre-moveto" event
There is an "exit_hex" event, which sounds like it would do what you want if you check how many moves the unit has left.
99 little bugs in the code, 99 little bugs
take one down, patch it around
-2,147,483,648 little bugs in the code
take one down, patch it around
-2,147,483,648 little bugs in the code
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: "pre-moveto" event
Exit_hex can tell me that a unit has started moving, but I need to know what hex the unit is going to stop on, and it won't tell me that.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: "pre-moveto" event
I am just guessing here... Units have variables named goto_x and goto_y. I am not sure about them... but maybe you could use them as filters?
Be aware English is not my first language and I could have explained bad myself using wrong or just invented words.
World Conquest II
World Conquest II
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: "pre-moveto" event
Those store the eventual destination of a multi-turn move, and I need the current one.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: "pre-moveto" event
when the move is started the engine doesn't know where the unit move is going to end since the can be sighed events or hidden units that stop the units move.
The only event that fires when a unit starts to move is the exit_hex event. I think they only thing you can try is capture hex where the mouse is over and assume that this is the position where the user clicked moveto. Maybe using the position before if there is a unit on that hex. Ocf that won't for ai moves .
The only event that fires when a unit starts to move is the exit_hex event. I think they only thing you can try is capture hex where the mouse is over and assume that this is the position where the user clicked moveto. Maybe using the position before if there is a unit on that hex. Ocf that won't for ai moves .
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
Re: "pre-moveto" event
If you think of a single-click move from a to b to c as just a graphical convenience for multiple one hex moves, then exit_hex is the "pre-moveto" event. However, this isn't precisely true since you can move over hexes without triggering the moveto event, and for that matter you can also move over villages without capturing them. I'm curious what you're trying to do that capturing exit_hex for the final step isn't sufficient?
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: "pre-moveto" event
I have a scenario that happens on two levels connected by trap-doors in the floor/ceiling. If units are moving over, or standing on the doors, they should be closed, or else the unit will look like it's standing on air. On the other hand, if a unit is switching to a different level, I want to know so I can temporarily replace the trap-door image with the open version. That is for AI or human-controlled units, so capturing the mouse position is not a whole solution.Sapient wrote:I'm curious what you're trying to do that capturing exit_hex for the final step isn't sufficient?
I know there won't be any sighted events or hidden units in this case, so getting the intended destination would be fine. It doesn't have to be exact either. I just want to know if the unit will end on the opposite level than it's currently on.gfgtdf wrote:the engine doesn't know where the unit move is going to end since the can be sighed events or hidden units
I will be surprised if there is really no way to do this.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: "pre-moveto" event
Well, sure there's a way to do it. Expose moveto_x and moveto_y as automatically stored variables, accessible from *_hex events. But that requires a C++ change.beetlenaut wrote:
I will be surprised if there is really no way to do this.
Now that I think about it, such a variables might also be useful in moveto events for detecting interrupted movement.
http://www.wesnoth.org/wiki/User:Sapient... "Looks like your skills saved us again. Uh, well at least, they saved Soarin's apple pie."
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: "pre-moveto" event
So...maybe for 1.14 then?
I guess I will have to redesign the trap-doors to fit behind a unit in the hex, and just have them normally open. I will probably have to close the door if they attack north but at least that I can detect.
I guess I will have to redesign the trap-doors to fit behind a unit in the hex, and just have them normally open. I will probably have to close the door if they attack north but at least that I can detect.
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
Re: "pre-moveto" event
just to be clear your plan is to implement a pre_moveto event that fires when the a unit starts to move even before the leave_hex event and where x2,y2 is the current position of the unit and x1,y1 is the intended destination of the unit ?
Scenario with Robots SP scenario (1.11/1.12), allows you to build your units with components, PYR No preperation turn 1.12 mp-mod that allows you to select your units immideately after the game begins.
- beetlenaut
- Developer
- Posts: 2825
- Joined: December 8th, 2007, 3:21 am
- Location: Washington State
- Contact:
Re: "pre-moveto" event
Yes. But there is actually another option: we could have the exit_hex event store target_x and target_y, and that would work just as well.gfgtdf wrote:just to be clear your plan is to implement a pre_moveto event that fires when the a unit starts to move even before the leave_hex event and where x2,y2 is the current position of the unit and x1,y1 is the intended destination of the unit ?
Campaigns: Dead Water,
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide
The Founding of Borstep,
Secrets of the Ancients,
and WML Guide