• Please note: In an effort to ensure that all of our users feel welcome on our forums, we’ve updated our forum rules. You can review the updated rules here: http://forums.wolflair.com/showthread.php?t=5528.

    If a fellow Community member is not following the forum rules, please report the post by clicking the Report button (the red yield sign on the left) located on every post. This will notify the moderators directly. If you have any questions about these new rules, please contact support@wolflair.com.

    - The Lone Wolf Development Team

Making a list with tagnames

frumple

Well-known member
I am trying to make a list of attacks/weapons targeted by an ability with Target.xs tags (x is the id of the weapon).

I can do this for all weapons easily enough, except for the weapons Other Melee and Other Ranged I want the list to show its livename not "Other Melee Weapon" or "Other Ranged Weapon"

For example, if the ability was the tags Target.wBite and Target.wOtherMel (with the other melee having the livename 'Touch') I want the ability to list the weapons as Bite or Touch, not Bite or Other Melee Weapon.

Here is the code I have so far:

Code:
~ list attacks
	~ parse list going though each one
	   var lstCnt as number
	   lstCnt = tagcount[Target.?]
	   
	   if (lstCnt =0) then
	       disDesc &= field[livename].text
	   elseif (lstCnt = 1) then
	       disDesc &= tagnames[Target.?,""]
	   elseif (lstCnt = 2) then
	       disDesc &= tagnames[Target.?," or "]
	   else
	       var lst as string
	       lst = tagnames[Target.?,", or "]
	       lst = replace(lst,", or ",", ",lstCnt-2)
	           disDesc &= lst
	   endif
 
So the below script assumes that the Natural Attacks of the "Target" tags exist on the monster your putting the Racial Special on. This seems like safe assumption as why have the ability affect Bite and Claw for example on a monster that only has a Bite attack.

If that is not the case then this script is going to have become allot more complex to take into account tags without the actual natural attack.

Final/100
Code:
~ If we've been Disabled, get out now!
doneif (tagis[Helper.SpcDisable] <> 0)
~ If no target tags get out now!
doneif (tagcount[Target.?] = 0)

var nCount  as number
var sSearch as string
var sName   as string
var iX      as number
~ Set count and search tags
nCount = tagcount[Target.?]
sSearch = tagids[Target.?,"|"]
~ Loop through all the target weapons
foreach pick in hero from BaseWep where sSearch
   iX += 1
   ~ If we are the very first weapon then simply add its live name
   If (iX = 1) Then
      sName = eachpick.field[livename].text
   ~..We have found more than one weapon so we need to figure out
   ~..to add OR or a comma.
   Else
      ~ If the number of target weapons equal the loop counter than
      ~ add in OR before the last name
      If (nCount = iX) Then
        sName &= " or " & eachpick.field[livename].text
      ~..We have at least 3 names so add a comma instead
      Else
        sName &= ", " & eachpick.field[livename].text
      Endif
   Endif
nexteach
~ append the new list of target weapons on to the thing name
~ to create the new live name.
field[livename].text = field[thingname].text & " " & sName

The above script produced this on a racial special called "Frumple Attack" and the "Touch" attack is the Other Melee Attack with a livename of "Touch". The target tags where "wBite, wOtherMel, and wKick"
Noname.jpg
 
Back
Top