A while ago, Elriched released a trailer for his Thrynn scenario, and part of the title sequence had a whole bunch of walls sliding into place to spell out the title. I thought it was a pretty cool effect.
So rather than waiting for Thrynn's release, I coded some similar triggers for myself so I could use them for my Christmas Cinematic entry back in December. Some people were impressed by the special effects I accomplished using them and requested me to release the triggers, so here they are.
These triggers are single-player only, and require the Trigger Loader by Mythic Freak and invent00r
Trigger Loader
Transport Unit in Line
Description: This trigger takes one object and a destination, and teleports the object to many points in a line towards the destination, creating the illusion of smooth movement. Automatically stops when the target is reached.
How to use
LOOP: YES
Condition: Always, or Timer MS Accurate with a short time. The faster the loop, the less choppy the motion will appear.
Effect: Transport Unit in Line
Parameters:
Source Unit: Select the unit that you want to move.
Target Unit: Select a unit at the destination you want to move towards (you can use cinematic block)
Step Size: Distance that the unit will move every time the trigger is fired. Higher step size means faster, but choppier motion.
Transport Unit in Circle
Description: This trigger takes one object and a location, and teleports the object along a circular path around the central location.
How to use
LOOP: YES
Condition: Always, or Timer MS Accurate with a short time.
Effect: Transport Unit in Circle
Parameters:
Source Unit: Select the unit that you want to move.
Target Unit: Select a unit to act as the cenre of the circle (you can use cinematic block)
Height: Choose the height of the circle above the ground (if the unit can be teleported to arbitrary heights)
Radius: Choose the size of the circle (distance between object and centre)
Phase: Choose the starting angle between 0 and 360 degrees. Zero means the object starts rotating from due north of the centre, 180 means it starts from due south of the centre.
Clockwise:Change direction of rotation.
Moving in a circle and a line not enough for you?
No problem. Try Transporting one unit in a line towards another unit who is also being transported in a line somewhere else. You can make nearly endless shapes and patterns by combining multiple lines and circles.
What is this good for?
Anything you want it to be good for. InLet Heaven and Nature Sing, I used it to simulate Northern Lights, a sleigh crossing the sky, children sliding down hills of snow, sun rising and setting, and more, but there is really no limit.
If you make multiple units orbet the same target, you can make a halo.
If you loop "change unit type" you can have special effects like "Curse SFX" moving around.
If you replace the radius or height of a circle with trQuestVarGet("radius") or trQuestVarGet("height"), you can modify the QVs over time to get spirals, helices, and other shapes.
I have submitted a very short demo scenario with a few examples. You can watch it to see these triggers in action, and take a look at the triggers to better understand how I did it.
http://aom.heavengames.com/downloads/showfile.php?fileid=8496
Play the .scn file that is appropriate for your version of AoM
Finally, the trigger code itself. Paste the following code into your typetest.xml in your trigger or trigger2 directory, after the rest of your effects.
NEW: Transport Units in Circle Heading
Same as Transport Units in Circle, but replaced the "Height" Parameter with "Heading Relative to Centre," which controls the units heading with respect to the centre of the circle. Zero points towards the centre, 180 points outwards, and 90/-90 point along the circle, and any other angle works as well. I replaced the height parameter because I needed one more, and as far as I can tell, heading does not matter for most units that you can set the height of.
I hope people find these useful or handy.
Updates
March 15, 2009 - added Step Size to Transport Units in Circle
March 15, 2009 - added Transport Units in Circle Heading
Jan 4, 2010 - replaced Circle and Circle Heading with a better version that lets you select multiple units, and it will space them evenly in the circle.
| HailToTheOboe's Work |
| Let Heaven and Nature Sing (5.0) | Spinning Wheel (5.0) | Screenshots | Prime |
| Calendar Competition 2009 | Screenshot Tournament I | Screenshot Tournament III |
| Farewell. City of the Sea | We're on a Mission From God | Going for a Drive |
| Trigger pack:Target Protounit Query (5.0) | Rocmaninov | AOM World Cup |
So rather than waiting for Thrynn's release, I coded some similar triggers for myself so I could use them for my Christmas Cinematic entry back in December. Some people were impressed by the special effects I accomplished using them and requested me to release the triggers, so here they are.
No problem. Try Transporting one unit in a line towards another unit who is also being transported in a line somewhere else. You can make nearly endless shapes and patterns by combining multiple lines and circles.
Anything you want it to be good for. In
If you make multiple units orbet the same target, you can make a halo.
If you loop "change unit type" you can have special effects like "Curse SFX" moving around.
If you replace the radius or height of a circle with trQuestVarGet("radius") or trQuestVarGet("height"), you can modify the QVs over time to get spirals, helices, and other shapes.
I have submitted a very short demo scenario with a few examples. You can watch it to see these triggers in action, and take a look at the triggers to better understand how I did it.
Play the .scn file that is appropriate for your version of AoM
Finally, the trigger code itself. Paste the following code into your typetest.xml in your trigger or trigger2 directory, after the rest of your effects.
<Effect name="Transport Units in Line">
<Param name="SrcObject" dispName="Source Units" varType="unit"> default< /Param>
<Param name="DstObject" dispName="Target Unit" varType="unit"> default< /Param>
<Param name="StepSize" dispName="Step Size" varType="float"> 1< /Param>
<Command> trUnitSelectClear();< /Command>
<Command loop="" loopParm="SrcObject"> trUnitSelect("%SrcObject%");< /Command>
<Command> for(id=0;> 1) {}< /Command>
<Command> id=kbGetBlockID("%SrcObject%")*kbGetBlockID("%DstObject%")-kbGetBlockID("%SrcO bject%");< /Command>
<Command> if(%StepSize% > trUnitDistanceToUnit("%DstObject%"))< /Command>
<Command> trQuestVarSet("transportcheck"+id,1);< /Command>
<Command> if(trQuestVarGet("transportcheck"+id)==0){< /Command>
<Command> trVectorQuestVarSet("SrcObjPos", kbGetBlockPosition("%SrcObject%"));< /Command>
<Command> trVectorQuestVarSet("DstObjPos", kbGetBlockPosition("%DstObject%"));< /Command>
<Command> trVectorQuestVarSet("diff", trVectorQuestVarGet("DstObjPos")-trVectorQuestVarGet("SrcObjPos"));< /Command>
<Command> trQuestVarSet("diffmag",Math_sqrt(trVectorQuestVarGetX("diff")*trVectorQues tVarGetX("diff")+trVectorQuestVarGetY("diff")*trVectorQuestVarGetY("diff")+ trVectorQuestVarGetZ("diff")*trVectorQuestVarGetZ("diff")));< /Command>
<Command> trVectorQuestVarSet("diffu", xsVectorSet(trVectorQuestVarGetX("diff")/trQuestVarGet("diffmag"),trVectorQ uestVarGetY("diff")/trQuestVarGet("diffmag"),trVectorQuestVarGetZ("diff")/t rQuestVarGet("diffmag")));< /Command>
<Command> trQuestVarSet("stepx",trVectorQuestVarGetX("SrcObjPos")+1.0*%StepSize%*trVe ctorQuestVarGetX("diffu"));< /Command>
<Command> trQuestVarSet("stepy",trVectorQuestVarGetY("SrcObjPos")+1.0*%StepSize%*trVe ctorQuestVarGetY("diffu"));< /Command>
<Command> trQuestVarSet("stepz",trVectorQuestVarGetZ("SrcObjPos")+1.0*%StepSize%*trVe ctorQuestVarGetZ("diffu"));< /Command>
<Command> trVectorQuestVarSet("currentstep", xsVectorSet(trQuestVarGet("stepx"),trQuestVarGet("stepy"),trQuestVarGet("st epz")));< /Command>
<Command> trUnitTeleport(trVectorQuestVarGetX("currentstep"),trVectorQuestVarGetY("cu rrentstep"),trVectorQuestVarGetZ("currentstep"));< /Command>
<Command> }< /Command>
</Effect>
<Effect name="Transport Units in Circle TL SP">
<Param name="SrcObject" dispName="Source Units" varType="unit"> default< /Param>
<Param name="DstObject" dispName="Centre Object" varType="unit"> default< /Param>
<Param name="Height" dispName="Height" varType="string"> 0< /Param>
<Param name="Radius" dispName="Radius" varType="float"> 10< /Param>
<Param name="Phase" dispName="Phase Angle" varType="float"> 0< /Param>
<Param name="Step" dispName="Step Size (degrees)" varType="string"> 5< /Param>
<Command> for(id=0;> 1) {} for(theta=0;> 1) {}< /Command>
<Command> for(count=0;> 1) {}< /Command>
<Command> id=kbGetBlockID("%SrcObject%")+kbGetBlockID("%DstObject%");< /Command>
<Command> theta=trQuestVarGet("transportcircle"+id);< /Command>
<Command> if(trQuestVarGet("circlecount"+id)==0){< /Command>
<Command loop="" loopParm="SrcObject"> count = count+1; trQuestVarSet("circle"+id+"unit"+count,kbGetBlockID("%SrcObject%"));< /Command>
<Command> trQuestVarSet("circlecount"+id,count);< /Command>
<Command> }< /Command>
<Command> for(i=trQuestVarGet("circlecount"+id);> 0) {< /Command>
<Command> trUnitSelectClear();< /Command>
<Command> trUnitSelectByID(trQuestVarGet("circle"+id+"unit"+i));< /Command>
<Command> trVectorQuestVarSet("DstObjPos", kbGetBlockPosition("%DstObject%"));< /Command>
<Command> trQuestVarSet("stepx",trVectorQuestVarGetX("DstObjPos")+1.0*%Radius%*Math_s in(1.0*(1.0*theta+360.0*(1.0*i-1.0)/trQuestVarGet("circlecount"+id)+1.0*%Ph ase%)*PI/180.0));< /Command>
<Command> trQuestVarSet("stepy",trVectorQuestVarGetY("DstObjPos")+1.0*%Height%);< /Command>
<Command> trQuestVarSet("stepz",trVectorQuestVarGetZ("DstObjPos")+1.0*%Radius%*Math_c os(1.0*(1.0*theta+360.0*(1.0*i-1.0)/trQuestVarGet("circlecount"+id)+1.0*%Ph ase%)*PI/180.0));< /Command>
<Command> trUnitTeleport(trQuestVarGet("stepx"),trQuestVarGet("stepy"),trQuestVarGet( "stepz"));< /Command>
<Command> }< /Command>
<Command> trQuestVarSet("transportcircle"+id,trQuestVarGet("transportcircle"+id)+1.0* %Step%);< /Command>
<Command> if(-1.0> =trQuestVarGet("transportcircle"+id)) trQuestVarSet("transportcircle"+id,trQuestVarGet("transportcircle"+id)+360. 0);< /Command>
<Command> if(trQuestVarGet("transportcircle"+id)> =361.0) trQuestVarSet("transportcircle"+id,trQuestVarGet("transportcircle"+id)-360. 0);< /Command>
</Effect>
<Effect name="Transport Units in Circle Heading TL SP">
<Param name="SrcObject" dispName="Source Units" varType="unit"> default< /Param>
<Param name="DstObject" dispName="Centre Object" varType="unit"> default< /Param>
<Param name="Heading" dispName="Heading" varType="string"> 0< /Param>
<Param name="Radius" dispName="Radius" varType="float"> 10< /Param>
<Param name="Phase" dispName="Phase Angle" varType="float"> 0< /Param>
<Param name="Step" dispName="Step Size (degrees)" varType="string"> 5< /Param>
<Command> for(id=0;> 1) {} for(theta=0;> 1) {}< /Command>
<Command> for(count=0;> 1) {}< /Command>
<Command> id=kbGetBlockID("%SrcObject%")+kbGetBlockID("%DstObject%");< /Command>
<Command> theta=trQuestVarGet("transportcircle"+id);< /Command>
<Command> if(trQuestVarGet("circlecount"+id)==0){< /Command>
<Command loop="" loopParm="SrcObject"> count = count+1; trQuestVarSet("circle"+id+"unit"+count,kbGetBlockID("%SrcObject%"));< /Command>
<Command> trQuestVarSet("circlecount"+id,count);< /Command>
<Command> }< /Command>
<Command> for(i=trQuestVarGet("circlecount"+id);> 0) {< /Command>
<Command> trUnitSelectClear();< /Command>
<Command> trUnitSelectByID(trQuestVarGet("circle"+id+"unit"+i));< /Command>
<Command> trVectorQuestVarSet("DstObjPos", kbGetBlockPosition("%DstObject%"));< /Command>
<Command> trQuestVarSet("stepx",trVectorQuestVarGetX("DstObjPos")+1.0*%Radius%*Math_s in(1.0*(1.0*theta+360.0*(1.0*i-1.0)/trQuestVarGet("circlecount"+id)+1.0*%Ph ase%)*PI/180.0));< /Command>
<Command> trQuestVarSet("stepy",trVectorQuestVarGetY("DstObjPos"));< /Command>
<Command> trQuestVarSet("stepz",trVectorQuestVarGetZ("DstObjPos")+1.0*%Radius%*Math_c os(1.0*(1.0*theta+360.0*(1.0*i-1.0)/trQuestVarGet("circlecount"+id)+1.0*%Ph ase%)*PI/180.0));< /Command>
<Command> trUnitTeleport(trQuestVarGet("stepx"),trQuestVarGet("stepy"),trQuestVarGet( "stepz"));< /Command>
<Command> trUnitSetHeading(theta+%Phase%+360.0*(i-1.0)/trQuestVarGet("circlecount"+id )+180.0+%Heading%);< /Command>
<Command> }< /Command>
<Command> trQuestVarSet("transportcircle"+id,trQuestVarGet("transportcircle"+id)+1.0* %Step%);< /Command>
<Command> if(-1.0> =trQuestVarGet("transportcircle"+id)) trQuestVarSet("transportcircle"+id,trQuestVarGet("transportcircle"+id)+360. 0);< /Command>
<Command> if(trQuestVarGet("transportcircle"+id)> =361.0) trQuestVarSet("transportcircle"+id,trQuestVarGet("transportcircle"+id)-360. 0);< /Command>
</Effect>
I hope people find these useful or handy.
| HailToTheOboe's Work |
| Let Heaven and Nature Sing (5.0) | Spinning Wheel (5.0) | Screenshots | Prime |
| Calendar Competition 2009 | Screenshot Tournament I | Screenshot Tournament III |
| Farewell. City of the Sea | We're on a Mission From God | Going for a Drive |
| Trigger pack:Target Protounit Query (5.0) | Rocmaninov | AOM World Cup |
[This message has been edited by HailToTheOboe (edited 01-07-2010 @ 10:47 PM).]