Lone Wolf Development Forums  

Go Back   Lone Wolf Development Forums > Hero Lab Forums > HL - Pathfinder Roleplaying Game
Register FAQ Community Today's Posts Search

Notices

Reply
 
Thread Tools Display Modes
jmm
Junior Member
 
Join Date: Aug 2011
Posts: 7

Old May 23rd, 2012, 11:31 AM
I'm trying to create a new weapon ability that will adjust the category of the weapon it's applied to. Two handed weapons become one handed, one-handed weapons become light weapons, and light weapons.... well, too bad. Anyway, not being exceptionally gifted at coding (understatement), I tried something like this:

Code:
        if (container.tagis[wClass.TwoHanded] <> 0) then
          perform container.delete[wClass.TwoHanded]
          perform container.assign[wClass.OneHanded]
        if (container.tagis[wClass.OneHanded] <> 0) then
          perform container.delete[wClass.OneHanded]
          perform container.assign[wClass.Light]
It's a modified version of the code used to make mithral armor, but it's clearly not working, so I could use some help. If anyone give me a hand, or direct me to something else that creates the same kind of modifications, I'd appreciate it.
jmm is offline   #1 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old May 23rd, 2012, 12:10 PM
Your script is basically fine, but I suspect your timing may be wrong.

Try this code at Pre-levels/1000

Code:
if (container.tagis[wClass.TwoHanded] <> 0) then
          perform container.delete[wClass.TwoHanded]
          perform container.assign[wClass.OneHanded]
elseif (container.tagis[wClass.OneHanded] <> 0) then
          perform container.delete[wClass.OneHanded]
          perform container.assign[wClass.Light]
endif
Sendric is offline   #2 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old May 23rd, 2012, 12:18 PM
Assuming what posted is exactly what your trying to use the main issue is you don't have endif statements. Also what timing are you using? Early in the Pre-Levels phase is the timing I'd try first.

Also in like 3.6 of HL a new feature was added to make this a little easier. Basically tagreplace does the same actions of delete and assign but all in one step.

Also my advice is to add "COMMENTS" to your scripts. You do this by having a "~" in front of text. Everyone hates adding comments but god it makes code easier to read for yourself when you come back to stuff in a day or week or even a month.

Code:
        
~ Check the magic container Thing to see if we are a Two-Handed weapon
~ if we are then make us a One-Handed weapon instead
if (container.tagis[wClass.TwoHanded] <> 0) then
    container.tagreplace[wClass.TwoHanded,wClass.OneHanded]
endif

~ Check the magic container Thing to see if we are a one-Handed weapon
~ if we are then make us a Light weapon instead
if (container.tagis[wClass.OneHanded] <> 0) then
    container.tagreplace[wClass.TwoHanded,wClass.Light]
endif

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.
ShadowChemosh is offline   #3 Reply With Quote
Mathias
Senior Member
Lone Wolf Staff
 
Join Date: May 2005
Posts: 13,217

Old May 23rd, 2012, 12:28 PM
ShadowChemosh - you want elseif, not a second if statement. Currently, if it's a two-handed weapon, the first if will succeed and turn it into a one-handed weapon, and then the second if will be tested - it'll suceed, so it'll become a light weapon.
Mathias is offline   #4 Reply With Quote
Sendric
Senior Member
 
Join Date: Jul 2010
Posts: 3,147

Old May 23rd, 2012, 12:28 PM
Quote:
Originally Posted by ShadowChemosh View Post
Also in like 3.6 of HL a new feature was added to make this a little easier. Basically tagreplace does the same actions of delete and assign but all in one step.
Nice. I really oughta read up more on some of the fun things Pathfinder uses.
Sendric is offline   #5 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old May 23rd, 2012, 04:05 PM
Quote:
Originally Posted by Mathias View Post
ShadowChemosh - you want elseif, not a second if statement. Currently, if it's a two-handed weapon, the first if will succeed and turn it into a one-handed weapon, and then the second if will be tested - it'll suceed, so it'll become a light weapon.
I was testing you Mathias and you passed.

Yep your totally correct on that one. May bad..

Of course this is a good lessen in why you should always TEST your script.

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.

Last edited by ShadowChemosh; May 23rd, 2012 at 04:08 PM.
ShadowChemosh is offline   #6 Reply With Quote
jmm
Junior Member
 
Join Date: Aug 2011
Posts: 7

Old May 23rd, 2012, 11:31 PM
Ah, thanks so much, guys. The responses were very helpful. Nice to find out about the tagreplace command. SC's code worked perfectly, once I added the perform command and the elseif statement to it.

I was also able to add the fragile condition (yes, all by my little lonesome; aren't I all grown up now), however I'm having some difficulty finding the proper tag to require that these be masterwork weapons. Any suggestions?
jmm is offline   #7 Reply With Quote
ShadowChemosh
Senior Member
Volunteer Data File Contributor
 
Join Date: Jan 2010
Location: Chicago, IL (USA)
Posts: 10,729

Old May 24th, 2012, 08:00 AM
Quote:
Originally Posted by jmm View Post
however I'm having some difficulty finding the proper tag to require that these be masterwork weapons. Any suggestions?
I wish I could say there was a tag for Masterwork but their is not one. LW has mentioned adding one for a long time but it has yet to happen.

So what I have done and this *sort of* works is to look at the field[wAttBonus] and see if its 1. That is the field that gets set when the weapon is Masterwork. While the field[wBonus] gets set when magical. Now of course here is the kicker that is possible for scripts to set those values when the item is NOT MW or magical.

So like I said this *sort of* works. I am all ears if anyone has found a better way.

Hero Lab Resources:
Pathfinder - d20pfsrd and Pathfinder Pack Setup
3.5 D&D (d20) - Community Server Setup
5E D&D - Community Server Setup
Hero Lab Help - Hero Lab FAQ, Editor Tutorials and Videos, Editor & Scripting Resources.
Created by the community for the community
- Realm Works kickstarter backer (Alpha Wolf) and Beta tester.
- d20 HL package volunteer editor.
ShadowChemosh is offline   #8 Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -8. The time now is 10:06 AM.


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