You must be logged in to post messages.
Please login or register

Scenario Design
Moderated by Yeebaagooon, TAG, nottud

Hop to:    
Welcome! You are not logged in. Please Login or Register.16 replies
Age of Mythology Heaven » Forums » Scenario Design » Hotkey Movement
Bottom
Topic Subject:Hotkey Movement
Lewonas
Mortal
posted 12 January 2010 03:36 PM EDT (US)         
So I was wondering in what ways I can move units from point A to point B by using hotkeys:

Photobucket

I can move units like this

Photobucket

...and like this. But is there any way to move units from point A to B like

Photobucket

...this? I have an effect called "Move unit relatively from itself" (by inserting values for the x and y vectors). Is there somekind of effect with which you can move a unit from point A to B by inserting values for x and y vectors? Example:

Effect name: Move unit relatively from itself to point B in a curve.

From: Source unit The unit which has to move to point B
To:
vector x:
5
vector y: 5

So instead of moving 5 steps to the east and 5 to the north, or moving square route(50) steps to the northeast, the unit should move in a curve.

edit: html is being annoying

What are the key ingredients to make a popular RPG? To find out, read the results of the RPG survey.
Want to create an advanced patrol/pathfinding system? Have a look at the powerful Pathfinding triggers.
Games I'm playing: The Witness [80%] Chivalry: Medieval Warfare [20%]

[This message has been edited by Lewonas (edited 01-12-2010 @ 03:44 PM).]

AuthorReplies:
THYMOLE
Mortal
posted 12 January 2010 03:43 PM EDT (US)     1 / 16       
Not at the moment, but i guess it could be done by using linear equations for curves. Unless movement is grid based you cant map out a 90 angle path... just think about it :P

It wouldn't be as simple as vector (x,y) I dont think, even once the trigger was made you would need to think a bit before using it to define the curve....

I dont know XS code but it'd be something like

Get location- save it as a vector
Get Linear param- use it to plot five points on the line as the unit's path
Add the value of the vector to every point of the line
Lewonas
Mortal
posted 12 January 2010 04:03 PM EDT (US)     2 / 16       
I know it isn't as simple as the x,y vectors. These vectors are only used for point B, or in other words: they only say where the target area is (where the unit has to walk to).
Get Linear param- use it to plot five points on the line as the unit's path
Hmmm, that's something interesting. You could use this technique to define the curve (the only downside is that you have to press the hotkey five times in order to finish the curve). You've given me some ideas

What are the key ingredients to make a popular RPG? To find out, read the results of the RPG survey.
Want to create an advanced patrol/pathfinding system? Have a look at the powerful Pathfinding triggers.
Games I'm playing: The Witness [80%] Chivalry: Medieval Warfare [20%]
THYMOLE
Mortal
posted 12 January 2010 04:41 PM EDT (US)     3 / 16       
Since you can Queve unit paths by holding down shift it seems likely that you could also queve paths with a trigger, so you could do it all with one key

the params I imagine necessary are
source unit
distance to move
heading
curve height (the coefficient of x in y=x^2
notes to explain the curve height

I don't know the math to define the heading for most degrees, although I'm guessing it'd be some weird pi related thing
perpetual_n00b
Immortal
posted 12 January 2010 05:24 PM EDT (US)     4 / 16       
To see some hotkey controlled curved movement, check out the video in HailToTheOboe's Rocmaninov showcase. That might give you some ideas on how to do it or you could wait until HailToTheOboe releases his next trigger pack.
nottud
Hero
posted 12 January 2010 05:55 PM EDT (US)     5 / 16       
well you would make it so you "add motion" to the character if it was already moving and set the move points relative to the angle and speed I would reckon.

The boy with the mad imagination
Prepare for the ultimate duel!
Learn to use all my triggers and what you can do with them. Visit here.
Find out and download the transform trigger here.
Play some minigames I have created outside AOM including some 3D games here.
buppy
Mortal
(id: pubby8)
posted 12 January 2010 07:27 PM EDT (US)     6 / 16       
Eh:

location x = cos(direction)*3
location y = sin(direction)*3

Will create 360 movement.
pBiggZ
Mortal
(id: P_J_B)
posted 12 January 2010 08:14 PM EDT (US)     7 / 16       
MY GOD TRIG FUNCTIONS IN AOM TRIGGERS. IM TRUELY AFRAID NOW.

its funny cuz i learned trig functions like last week.

"I NED MOAR RANGE" Pubby8
Green_Turtle
Mortal
posted 12 January 2010 08:15 PM EDT (US)     8 / 16       
You know how you can hold shift and add infinite tasks of any kind to a unit's task list? I wish there were a way to do that with triggers... That'd make this thread alot easier to untagle.

AOM Scenario Trigger Editor Official Thread!

Chat Contains without OOS for online!
Want to know what happens when you mess with water and elevation in a random map script? Well, you'll want to see this, then.

[This message has been edited by Green_Turtle (edited 13-32-2011 @ 13:60 AM).]
HailToTheOboe
Bitten by a radioactive ostrich
posted 12 January 2010 10:25 PM EDT (US)     9 / 16       
Eh:

location x = cos(direction)*3
location y = sin(direction)*3

Will create 360 movement.
Close but not quite, the horizontal plane is X and Z, and its left-handed so all your typical math rules are kaput. So, you're right if x = z and y = x.

I think I made this one, but it may have been perpetual n00b, but either way I think I gave him the trigonometry part
Perhaps it'll be some help or inspiration. TL means trigger loader required.

<Effect name = "Move in direction TL">
<Param name="SrcObject" dispName="Source Units" varType="unit">default</Param>
<Param name="Angle" dispName="Direction" varType="string">0.0</Param>
<Param name="Distance" dispName="Distance" varType="string">5.0</Param>
<Param name="AttackMove" dispName="Attack Move" varType="bool">false</Param>
<Command>trUnitSelectClear();</Command>
<Command loop="" loopParm="SrcObject">trUnitSelect("%SrcObject%");</Command>
<Command>trVectorQuestVarSet("SrcObjPos", kbGetBlockPosition("%SrcObject%"));</Command>
<Command>trVectorQuestVarSet("MoveDiff", xsVectorSet(%Speed%*Math_sin(%Angle%*PI/180.0), 0, %Speed%*Math_cos(%Angle%*PI/180.0)));</Command>
<Command>trVectorQuestVarSet("NewObjPos", trVectorQuestVarGet("SrcObjPos") + trVectorQuestVarGet("MoveDiff"));</Command>
<Command>trUnitMoveToPoint(trVectorQuestVarGetX("NewObjPos"),trVectorQuestVarGetY("NewObjPos"),trVectorQuestVarGetZ("NewObjPos"),-1,%AttackMove%);</Command>
</Effect>

[This message has been edited by HailToTheOboe (edited 01-12-2010 @ 10:26 PM).]

buppy
Mortal
(id: pubby8)
posted 12 January 2010 10:27 PM EDT (US)     10 / 16       
Close but not quite, the horizontal plane is X and Z, and its left-handed so all your typical math rules are kaput. So, you're right if x = z and y = x.
Heh, forgot that aom used the Z axis.
perpetual_n00b
Immortal
posted 13 January 2010 07:24 AM EDT (US)     11 / 16       
HailToTheOboe, I made that one but it was only a simple modification of your Teleport In Direction effect, basically I just changed trUnitTeleport to trUnitMoveToPoint and added in the extra parameters that trUnitMoveToPoint takes, all the hard work was your doing.

Edit: Actually, that's not my one, this is my one using QVs only -
<Effect name = "Move in direction QV TL">
<!--Put on loop with condition always or fast timer-->
<Param name="SrcObject" dispName="Source Units" varType="unit">default</Param>
<Param name="Angle" dispName="Direction" varType="string">QV1</Param>
<Param name="Speed" dispName="Speed" varType="string">QV2</Param>
<Param name="EventID" dispName="Trigger" varType="event">-1</Param>
<Param name="AttackMove" dispName="Attack Move" varType="bool">false</Param>
<Command>trUnitSelectClear();</Command>
<Command loop="" loopParm="SrcObject">trUnitSelect("%SrcObject%");</Command>
<Command>trVectorQuestVarSet("SrcObjPos", kbGetBlockPosition("%SrcObject%"));</Command>
<Command>trVectorQuestVarSet("MoveDiff", xsVectorSet(trQuestVarGet("%Speed%")*Math_sin(trQuestVarGet("%Angle%")*PI/180.0), 0, trQuestVarGet("%Speed%")*Math_cos(trQuestVarGet("%Angle%")*PI/180.0)));</Command>
<Command>trVectorQuestVarSet("NewObjPos", trVectorQuestVarGet("SrcObjPos") + trVectorQuestVarGet("MoveDiff"));</Command>
<Command>trUnitMoveToPoint(trVectorQuestVarGetX("NewObjPos"),trVectorQuestVarGetY("NewObjPos"),trVectorQuestVarGetZ("NewObjPos"), %EventID%, %AttackMove%);</Command>
</Effect>

HailToTheOboe, you changed the Speed parameter in yours to Distance but didn't change it in the Commands
<Effect name = "Move in direction TL">
<Param name="SrcObject" dispName="Source Units" varType="unit">default</Param>
<Param name="Angle" dispName="Direction" varType="string">0.0</Param>
<Param name="Distance" dispName="Distance" varType="string">5.0</Param>
<Param name="AttackMove" dispName="Attack Move" varType="bool">false</Param>
<Command>trUnitSelectClear();</Command>
<Command loop="" loopParm="SrcObject">trUnitSelect("%SrcObject%");</Command>
<Command>trVectorQuestVarSet("SrcObjPos", kbGetBlockPosition("%SrcObject%"));</Command>
<Command>trVectorQuestVarSet("MoveDiff", xsVectorSet(%Distance%*Math_sin(%Angle%*PI/180.0), 0, %Distance%*Math_cos(%Angle%*PI/180.0)));</Command>
<Command>trVectorQuestVarSet("NewObjPos", trVectorQuestVarGet("SrcObjPos") + trVectorQuestVarGet("MoveDiff"));</Command>
<Command>trUnitMoveToPoint(trVectorQuestVarGetX("NewObjPos"),trVectorQuestVarGetY("NewObjPos"),trVectorQuestVarGetZ("NewObjPos"),-1,%AttackMove%);</Command>
</Effect>

[This message has been edited by perpetual_n00b (edited 01-13-2010 @ 08:24 AM).]

HailToTheOboe
Bitten by a radioactive ostrich
posted 13 January 2010 09:02 AM EDT (US)     12 / 16       
Haha, I guess that sorts it out - I gave you Teleport in Direction, you gave me Move in Direction, I tried to modify it to my own taste, but bungled it and never got around to testing it
Mythic_Freak
Mortal
posted 13 January 2010 10:39 AM EDT (US)     13 / 16       
Aahh. Basic trigonometry, good ol' times.

If we knew what it was we were doing, it would not be called research, would it? - Einstein, A.
Master XS - AoM Code Reference - Trigger Loader - Trigger Requests - Chess

Wow, I never thought that I would actually know something before nottud did... it's actually not all that satisfying ~ Steak
HailToTheOboe
Bitten by a radioactive ostrich
posted 13 January 2010 10:43 AM EDT (US)     14 / 16       
Mythic_Freak
Mortal
posted 13 January 2010 10:48 AM EDT (US)     15 / 16       
Btw, you might find this interesting.

My attempt to create a fifa game in AoM. Just a very early prototype though. Never got around finishing it...

link

If we knew what it was we were doing, it would not be called research, would it? - Einstein, A.
Master XS - AoM Code Reference - Trigger Loader - Trigger Requests - Chess

Wow, I never thought that I would actually know something before nottud did... it's actually not all that satisfying ~ Steak
perpetual_n00b
Immortal
posted 13 January 2010 12:32 PM EDT (US)     16 / 16       
I've posted a trigger set up in Shuch_ya_mouf's Street King showcase here that uses Move in Direction TL to get a unit to move in a curve.

Basically it sets the unit's initial speed to 0 and has a looping trigger to move in the direction the unit is facing/heading. Up and down are used to adjust speed (Modify Protounit) and left and right adjust the heading to get the unit to turn.
You must be logged in to post messages.
Please login or register

Hop to:    

Age of Mythology Heaven | HeavenGames