Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - Savage Worlds (http://forums.wolflair.com/forumdisplay.php?f=59)
-   -   2 Combat Edges as a Prerequisites? (http://forums.wolflair.com/showthread.php?t=50543)

dartnet September 1st, 2014 08:55 AM

2 Combat Edges as a Prerequisites?
 
How would I script this?

zarlor September 1st, 2014 09:07 AM

You could either do:
Code:

hero.tagis[Edge.edgTDNCO] + hero.tagis[Edge.edgTDOffic] <> 0
For every combat Edge (seems like a lot to list, though, and you'll miss any if you happen to add one later.)

Or set up a variable to act as a counter, step through Edges just like you would when stepping through Knowledge skills, and check for the Edge type (I'm not sure of the syntax on that but I can try to find it tomorrow) and increment the variable by 1 each time it finds a Combat one. Then you just set a validif for the variable being > 1 and drop out of the foreach loop.

SeeleyOne September 1st, 2014 09:10 AM

So, you mean how to make it be "Any 2 Combat Edges"? That would need to reference an eachpick where Edge is EdgeType.Combat.

SeeleyOne September 1st, 2014 09:44 AM

OK, I got it if you mean "Any 2 Combat Edges"

Make a Pre-reqs
Message is "Requires any 2 Combat Edges."
Code:

        var total as number
        total = 0

        ~Make sure at least two Combat Edges exist.
          foreach pick in hero where "EdgeType.Combat"
              total += 1
          nexteach

        ~if we have at least two valid edges, we're valid
        validif (total >= 2)

        ~if we got here, we're invalid
        if (@ispick <> 0) then
          altpick.linkvalid = 0
          endif


dartnet September 1st, 2014 10:42 AM

Thanks.

zarlor September 2nd, 2014 11:58 AM

I think you can simplify that a bit. Maybe something like:

Code:

        var total as number
        total = 0

        ~Make sure at least two Combat Edges exist.
          foreach pick in hero where "EdgeType.Combat"
              total += 1
            if (total >= 2)
                validif (total >= 2)
                done
            endif
          nexteach

        ~if we got here, we're invalid
        if (@ispick <> 0) then
          altpick.linkvalid = 0
          endif

That "done" should get your dropped out of the code a lot quicker if it gets there. I'm also not sure you should bother including the whole "if (@ispick <> 0) then" section since is stays invalid unless it's forced valid by the validif line, but there could be some completely other reason for that of which I'm utterly unaware (which is entirely likely, mind you).


All times are GMT -8. The time now is 04:23 AM.

Powered by vBulletin® - Copyright ©2000 - 2024, vBulletin Solutions, Inc.
wolflair.com copyright ©1998-2016 Lone Wolf Development, Inc. View our Privacy Policy here.