Roll20 uses cookies to improve your experience on our site. Cookies enable you to enjoy certain features, social sharing functionality, and tailor message and display ads to your interests on our site and others. They also help us understand how our site is being used. By continuing to use our site, you consent to our use of cookies. Update your cookie preferences .
×
Create a free account

ScriptCards: Preventing Roll20 from Asking for a Target

So I did actually post this earlier but I fat fingered the 'Save Edit' and hit 'Delete' so that's why that poofed. Anyways, I did actually manage to resolve every issue I had except for one, which is: when I fire my Weapon Attack macro for a weapon that has a loading period, it still asks for a target of the attack even though the weapon isn't attacking. I have to imagine it's something to do with using the #targetToken tag, but I'm not sure how to avoid using it. Here's what the macro is supposed to do: Check to see the load state, or WeaponState, and if it's less than the WeaponStateMax then increase the State by 1 and end. However, if it is equivalent to the StateMax, set the State to 0 and execute an attack. Then the macro requires a target to inflict damage, which it checks to see if the target is a vehicle or not. If yes, it checks for a DamageThreshold. Then it finishes executing damage normally. Finally, it subtracts the AmmoCost from the associated resource on the Source Ship. I tried to make this have a programmatical input instead of hardcoding it but I couldn't figure it out. Now that that's out of the way, here's the Macro, and if anyone can tell me how to stop it from asking for a Target when it isn't firing, it would be much appreciated, thanks! !scriptcard {{ --#title|Vehicle Weapon Attack --#sourceToken|@{selected|token_id} --&DTType|Vehicle --? @{selected|WeaponState} -ne @{selected|WeaponStateMax}|Load --? @{selected|WeaponState} -eq @{selected|WeaponStateMax}|Fire --X| --:Load| --@modattr| _charid [*S:character_id] _WeaponState|1 _silent --+Action|@{selected|character_name} is loading... --X| --:Fire| --@setattr| _charid [*S:character_id] _WeaponState|0 _silent --ISelect A Target;Click Here|t;WeaponTarget;Weapon Target --#targetToken|[&WeaponTarget]s --=TargetAC|@{target|ac} --#emoteText| @{selected|character_name} attacks @{target|character_name}! --=ToHit|1d20 + @{selected|WeaponToHit} --+To Hit|[$ToHit] --? [$ToHit.Base] -eq 20|Crit --? [$ToHit.Total] -ge [$TargetAC]|Hit --? [$ToHit.Base] -eq 1|Fumble --+Miss| The Attack Missed! --^SubtractAmmo| --:Crit| --=Damage|@{selected|WeaponCritDamage} --+Critical Damage|[$Damage] --^SubtractDamage| --:Hit| --=Damage|@{selected|WeaponDamage} --+Damage|[$Damage] --^SubtractDamage| --:Fumble| --+Fumble| The Attack Horribly Missed! --^SubtractAmmo --:SubtractDamage| --? @{target|npc_resistances} -inc @{selected|WeaponDamageType}|>Resist --? @{target|npc_vulnerabilities} -inc @{selected|WeaponDamageType}|>Vuln --? @{target|npc_immunities} -inc @{selected|WeaponDamageType}|>Immune --? "@{target|npc_type}" -inc [&DTType]|SubtractVehicleDamage --@alter|_target|@{target|token_id} _bar|1 _amount|-[$Damage] --^SubtractAmmo| --:SubtractVehicleDamage| --+Damage Threshold|Applying Threshold... --? [$Damage] -ge @{target|DamageThreshold}|SkipDT --=Damage|0 --+Resisted|@{target|character_name} Resisted the Attack! --:SkipDT| --@alter|_target|@{target|token_id} _bar|3 _amount|-[$Damage] --^SubtractAmmo| --:SubtractAmmo| --=NewAmmoCount|@{Ship Alpha|class_resource} - @{selected|WeaponAmmoCost} --+Remaining Ammo|[$NewAmmoCount] --@setattr| _name Ship Alpha _class_resource|[$NewAmmoCount] _silent --X| --:Resist| --Damage|[$Damage] \ 2 --<| --:Vuln| --Damage|[$Damage] * 2 --<| --:Immune| --Damage|0 --<| }}
1618632051
David M.
Pro
API Scripter
If you really want #targetToken so it gives you the icon at the top of the card, then you might want to make the Fire block call another scriptcard macro entirely. Perhaps if the weapon is ready to fire, it prints a button that uses the  [sheetbutton]ButtonCaption::Character::AbilityMacro[/sheetbutton]   syntax made available in v1.1.18 or later? Otherwise, I think the target query is going to happen every time.
That's spectacularly brilliant, thank you! I tested it out and it should exactly for what I need it to!