Lone Wolf Development Forums

Lone Wolf Development Forums (http://forums.wolflair.com/index.php)
-   HL - 4th Edition (http://forums.wolflair.com/forumdisplay.php?f=60)
-   -   Scripting Help: Multiple Options (http://forums.wolflair.com/showthread.php?t=58449)

sleepyspoonie May 18th, 2017 06:22 AM

Scripting Help: Multiple Options
 
Sorry, I have no idea how to word this. I need to write a script for a class I'm building, and I'm frankly rather lost. What I'm doing is a modification of the Disruptive Strike/Improved Disruptive Strike from the Hunter class. Improved Disruptive Strike gives the user an additional use of Disruptive Strike as an encounter power per encounter.

The script for Improved Disruptive Strike is as follows:

Quote:

doneif (activated = 0)
hero.childfound[pRgrDisSho].field[spcMax].value += 1
What I want to do instead is rather than just having the one power, I want the user to be able to select from three different powers. I can use the script to add them all at once, but I don't know how to make it so that the user's selection determines which part of the script is active.

sleepyspoonie May 23rd, 2017 06:28 AM

I expect it would go something like this, with the parts I don't know how to write out marked by **

Quote:

if (**the user selects Trick Shot**) then
hero.childfound[pwGSDisSht].field[spcMax].value += 1

elseif (**the user selects Violent Shot**) then
hero.childfound[pwGSViolSh].field[spcMax].value += 1

else (**the user selects Fan the Hammer**) then
hero.childfound[pwGSFtHam].field[spcMax].value +=1
endif
endif

charlieluce May 24th, 2017 03:30 PM

I had my lovely and patient coding expert take a look at this, and she said:
Quote:

Either add the following 3 lines of XML code or, in the editor click the Edit button for “List of Text Items” and enter Trick Shot, Violent Shot & Fan the Hammer in the boxes for rows 0, 1 & 2.
Code:

      <arrayval field="usrArray" index="0" value="Trick Shot"/>
      <arrayval field="usrArray" index="1" value="Violent Shot"/>
      <arrayval field="usrArray" index="2" value="Fan the Hammer"/>

Quote:

Set your eval script to run at or around Setup 1000, and use the following code:
Code:

  doneif (activated = 0)
  if (compare(field[usrSelect].text, "Trick Shot") = 0) then
    hero.childfound[pwGSDisSht].field[spcMax].value += 1
  elseif (compare(field[usrSelect].text, "Violent Shot") = 0) then
    hero.childfound[pwGSViolSh].field[spcMax].value += 1
  elseif (compare(field[usrSelect].text, "Tan the Hammer") = 0) then
    hero.childfound[pwGSFtHam].field[spcMax].value += 1
  endif

Let me know if this works for you or if you have any problems.


All times are GMT -8. The time now is 09:52 PM.

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