[XML] Control of sources and targets in triggers

Discussion in 'Suggestions' started by Null, Dec 7, 2011.

  1. Null

    Null Will Mod for Digglebucks

    After having looked at the scripting for rooms, I came to have an idea. What if the source of a spell could be changed by triggering this. This still keeps the same caster and everything, but acts as if it were cast from a different location.

    The uses of this are actually a lot. For instance this could create a projectile from anywhere. It could create a beam between any two points. Maybe it could even allow the teleportation of anything from anywhere to somewhere else (assuming you treated the source as the teleporting object/creature for it).

    The usage of this would be used with this notation
    Code:
    <effect type="trigger" spell="Dummy" source="absolutesource" target="relativetarget" sourceX="0" sourceY="1" targetX="0" targetY="-1"/>
    
    That would cause the spell Dummy to trigger as if it were being cast from the tile 1 below the player, to the tile in front of the target of the spell (front being defined the same as it is right now, where instead of the player being the center, it would be the source of the triggering spell). So for example if it were cast like such:
    :dmg_transmutative::dmg_aethereal::dmg_aethereal::dmg_aethereal::dmg_piercing:
    where transmutative is the target piercing is the player and source, it would trigger Dummy as follows:
    :dmg_righteous::dmg_aethereal::dmg_aethereal::dmg_piercing::dmg_existential:
    :dmg_transmutative::dmg_aethereal::dmg_aethereal::dmg_aethereal::dmg_aethereal:
    The piercing is the new source, the righteous the old target, and the existential the player's position. The relative direction is rotated like a template would be, up is left when the target is to the left of the source, right is up, down is right. And it's the same for each direction. Absolute values are not rotated ever.

    So the posible sources and targets would be as follows:
    absolutesource
    relativesource
    absolutetarget
    relativetarget
    rotatesource
    rotatetarget
    caster

    If not given a value it would default to as follows:
    source="absolutesource" target="absolutetarget" sourceX="0" sourceY="0" targetX="0" targetY="0"


    caster is quite self-explanatory.

    rotatesource and rotatetarget are two that weren't explained. It depends to what extent this would go to, whether 90/180/270 or some other angle in between, but the idea behind these are that it rotates a certain angle of the source around the target or target around the source.
    The more important of the two is rotatesource, and the main purpose of this is for knockbacks. For instance when making say a storm of some sort, and deciding that it should make enemies rotate around in it. This would be accomplished by upon cast triggering the source of the effect as absolutetarget (defaulting in an x and y of zero would simply yield the targeted location), and in that trigger rotatesource as the source of the knockback, with an angle of 270 (we'll say it rotates clockwise, thus 270 degrees counterclockwise). This would then push all enemies clockwise around the circle perfectly perpendicular to the center.

    Let's say we have a fancy boomeranging missile ability as well. It will hit an enemy, then rotate 90 degrees counterclockwise then return to the player. Ignore that there are no requirements, anims or icons as it's just for the demonstration purposes of this mechanism's use.
    Code:
    <spell name="Boomerang" type="missile">
    	<effect type="damage" slashing="7" slashingF="0.20" crushing="3" crushingF="0.10"/>
    	<effect type="trigger" spell="Boomerang 2" source="absolutetarget" target="rotatesource" sourceangle="90"/>
    	<!-- absolutetarget gets the current target of the missile, ie where it hits, and fires from that location. It then takes the source, and rotates it 90 degrees around the target of Boomerang 1 to get the new target, which it then fires Boomerang 2 to -->
    </spell>
    <spell name="Boomerang 2" type="missile">
    	<effect type="damage" slashing="5" slashingF="0.15" crushing="2" crushingF="0.8"/>
    	<effect type="trigger" spell="Boomerang 3" source="absolutetarget" target="caster"/>
    	<!-- same thing here except this time the target is the caster, it fires back to us -->
    </spell>
    <spell name="Boomerang 3" type="missile">
    	<effect type="damage" affectsCaster="0" slashing="4" slashingF="0.12" crushing="2" crushingF="0.6"/>
    	<effect type="spawnitematlocation" itemName="Dwarven Boomerang"/> <!-- your boomeranging skills allow it to fly -->
    </spell>
    
    Here it does take three spells but isn't that hard to follow, each time we define source as absolutetarget, meaning our current target, as x and y default to zero, resulting in it's exact location (we could also use relativetarget but I'd prefer to use absolutetarget for consistency). Then the source is the next location to fire to, either 90 degrees to another location or back to the caster.

    There's other uses as well. For instance let's say we want to pull a target towards the caster.

    Code:
    <spell name="Pull" type="targetfloor">
    	<effect type="trigger" spell="Knockback" source="relativetarget" sourceX="0" sourceY="-1"/> 
    	<!-- triggers it from one tile past the monster, thus causing a pull instead. Maybe this could instead be <effect type"knock" source="relativetarget" etc instead but for this purposes it's a trigger"/>
    </spell>
    <spell name="Knockback" type="target"/>
    	<effect type="knock"/> <!-- completely unrelated but you know amount doesn't work on this but you keep using it -->
    </spell>
    
    
    Those are just a few examples but more could be made. While this mostly affects missile, beam, diggingbeam target types and the knock effect type, there's plenty of uses that could be had with those. The one thing which doesn't seem to consider the source that I would suggest is teleport be able to teleport anything by changing the source to that object's location.
     
    Essence likes this.