I haven't seen any script that does.
In example i would like to see something like this:
Code: Select all
[Attacker] fires an arrow and hits [TargetName] at a [Angle] degree angle.
[Attacker] successfully bypasses [Targetname]'s shield.
Moderators: dorpond, trevor, Azhrei, Gamerdude
Code: Select all
[Attacker] fires an arrow and hits [TargetName] at a [Angle] degree angle.
[Attacker] successfully bypasses [Targetname]'s shield.
You should be able to work this out by grabbing the token locations, facing, and then working out the math.imB_YipMan wrote:Is it possible to return the facing of a token in a targeting script?
I haven't seen any script that does.
In example i would like to see something like this:
Code: Select all
[Attacker] fires an arrow and hits [TargetName] at a [Angle] degree angle. [Attacker] successfully bypasses [Targetname]'s shield.
I am making a turn based version of Mount and blade bannerlord - partially copying the combat system there, with some modifications to make it work in turn based game play.Full Bleed wrote:You should be able to work this out by grabbing the token locations, facing, and then working out the math.imB_YipMan wrote:Is it possible to return the facing of a token in a targeting script?
I haven't seen any script that does.
In example i would like to see something like this:
Code: Select all
[Attacker] fires an arrow and hits [TargetName] at a [Angle] degree angle. [Attacker] successfully bypasses [Targetname]'s shield.
Wiki: getTokenFacing()
Wiki: getTokenX()
Wiki: getTokenY()
Category:Mathematical_Function
That said, this would be a luxury feature... most certainly with a degree of precision you don't get on a table. Do you need that sort of precision to resolve this sort of thing? How do you do this when playing on a table?
Code: Select all
<TARGETTING DATA>
<Get player ID and Facing >
[h:PlayerID = currentToken()]
[h:PlayerFacing = getTokenFacing(PlayerID)]
<Get attacker ID & Relative Offset>
[h: EnemyFacing = getTokenFacing(SelectedTargetID)]
[h,if(EnemyFacing > 0), CODE: {
[h:RelativeAngle = (180-abs(EnemyFacing))*(-1)]
};{
[h:RelativeAngle = (180-abs(EnemyFacing))]
}]
[h,if(abs(PlayerFacing - RelativeAngle) < 180), CODE: {
[EnemyAttackAngle = PlayerFacing - RelativeAngle]
};{
[h,if(abs(PlayerFacing-RelativeAngle) > 0), CODE: {
[EnemyAttackAngle =(180+ (180- abs (PlayerFacing - RelativeAngle)))* (-1) ]
};{
[EnemyAttackAngle = 180- abs (PlayerFacing - RelativeAngle)]
}]
}]
[h:EnemyAttackAngle = abs(EnemyAttackAngle)]
<hr>
Player facing: [PlayerFacing] <br>
Enemy facing: [EnemyFacing]<br>
Relative angle: [RelativeAngle]<br>
The resulting angle is: [EnemyAttackAngle]<br>