• 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

Addinga bonus to Fighting skill based on weapon

Gumbytie

Well-known member
I think I am heading in the right direction but something obviously wrong with the code. So I have an Edge Sykes-FairBairn that gives a +1 Fighting if armed with a knife. Thought maybe I could script it so it could be an Activated Ability.

I came up with this:

Code:
if (field[abilActive].value <> 0) then
~go through all weapons and find any that are "knives"
foreach pick in hero where "thingid.Weapon"
if (hero.tagis[Weapon.wpRKBayo1] + hero.tagis[Weapon.wpRKBowie] + hero.tagis[Weapon.wpRKKBar] <> 0) then
      	perform #traitroll[skFighting,+,1,"Sykes-Fairbairn"]
endif
nexteach        		
endif

But when I compile I get an error message:
Tag 'Weapon.wpRKBayo1' not defined

I only have the three 'knife' weapons listed above. So am I over-complicating this somehow?

Cheers.
 
I think since you are picking your way through them you would not use "hero.tagis" but rather eachpick.tag. And of course make sure that Unique ID exists and is spelled correctly. Interesting idea, BTW. Makes me wonder if I have some other places in my data files where I could do something like that. Is there a reason you're making that one activate, though? If the bonus always applies with knives and you're trapping for the knives then you can probably just apply the bonus on the knives without having to have the player hit the checkbox to activate it. Now if you wanted to make it activatable as a bonus where you don't check if it's a knife, then I can see doing that. Unless there is another reason, of course.
 
Last edited:
I run into this all the time, what I do is go into the weapon in the editor and in the tags tab on that weapon. Put "Weapon" in group Id And in the tags ID put "RLBowie" and then change in your script instead of wpRLBowie put RLBowie without the wp in the front. That usually works for me. you need to do that with all of them - wpRKBayo1 to RKBayo1 etc. make the tags and change in script.
 
Last edited:
Hmm... does that mean Weapon.wp(Whatever) isn't a tag, then? Maybe it's something else. We might need Mathias or CC to jump in on that one.
 
I have no idea - I just tried doing it the way I said a few months ago and it worked. the other way I couldn't seem to get to work at all - I would always get the error he got above until I did it that way. You could use the wp in front of the other in the tag tab and it would work. It's just that there is a limit to how many characters you use in the ID. So I just shortened the name.
 
Some thoughts about the suggestions

First, not sure why I was thinking it needed to be activated :) I believe I was working on another Edge that required Activation and just cut and pasted that part. Yes it does not need the Activation portion.

Second, removing the 'wp' from wpRKBayo1, for example. I write all of my datafiles by hand in an XML editor, don't use the Editor anymore. It helps me learn the coding a bit better :) That 'wp' is used in the core files for weapons. I have always stuck to the naming conventions based on the core files. Not sure if we have to, but there it is.

I also am aware of potential conflict with other user created files which is where the RK comes from. Ragnarok = RK, for Gaslight I just used 'G', and a Savage Swords file would be SS. Just so you are aware.

So in the core rules we have a Bayonet, id=wpBayonet. I try to keep as much of the original name as possible. So in Ragnarok I get a Bayonet, id=wpRKBayo1. I added the '1' because Ragnarok tracks a Bayonet used by hand as one weapon and fixed to a Rifle as another, hence the 1 and 2.

But to test that theory, I re-tagged each of the three 'knives' without the 'wp', made the change in scrip, ran and got same errors, just minus the 'wp' in the error message.
 
I also just realized that even if I figure why I get the error, I am still not achieving what I set out to do, sigh.

I don't actually want to make skFighting +1. I want the +1 bonus applied to the knife itself when calculating the Fighting skill.

So say, Fighting d6, no Edge, Bowie Knife is d6, like other melee attacks.

Second case, Fighting d6, has Edge, Bowie Knife is d6+1, all other melee attacks still d6.

But I think I still need the first portion to work, I need to identify if the character actually has the weapon or not.
 
What you are doing is making a special new tag that the script is looking for is all, I'm beginning to think that the savage world game files don't always make tags for the things we make and doesn't recognize what you have as Tags - that's why you get the error. In the editor you can use the you can add your own tags as long as it recognizes the group ID - You can call it "duh" as long as it knows the the group ID. LOL. If your Doing it hard code I think you need to add some kind of Tag Identifier of some kind. So it knows to add that tag to the thing your trying to find.
 
I agree that Savage World seems to not play nice with what we create sometimes, sigh.

But this isn't anything special I have made. I simply just created 3 new weapons with all of the default tags and definitions. The Edge is new but nothing fancy about it except what I am trying to add with code.

It could be that "thingid.Weapon" and hero.tagis[Weapon.wpRKBowie] is not exactly being used correctly by myself. I am not sure about proper syntax, etc. As we learn by grabbing code from elsewhere and just drop in our own ideas :)
 
Well, what jbear is saying is that if it's not recognizing the hero.tagis[Weapon.wpRKBowie] then it may be because the program doesn't create a tag called that on the weapon you created. Which I think might also be the case. You're calling for a tag, but it may not automatically make that as a tag but as something else (it could be a thing, or a field or who knows what.) JBEar's work around was to force the creation of an actual tag called Weapon.RKBowie (I'm guessing he removed the wp just so it wouldn't be confused with the weapon ID, but I would guess if it isn't automatically creating a tag with that wp before it then you should be able to just make it without a problem, but maybe it gripes about a UniqueID if you do? Not sure.) AT any rate he's saying first create a Tag on the weapon and then use that Tag as what you search on in your code.

But, yeah, I suppose you're right if you search through and just modify the traitroll of skFighting it's going to modify the base skill itself, not whatever it's called that the weapon creates when it takes skFighting and modifies it (if needed) before displaying the weapon version of what your Fighting skill would be with that weapon. So THAT tag (again, assuming it's even a tag) is the one you really need to modify.

I may try to look at it more in the morning, but this may be one we need some of the real experts to help out on. I can't help but think I could use the answer to this one in some other areas if I think abut it.
 
Okay, I had to take a break and get away from coding. Played some Cthulhu via Skype and watched the latest Doctor Who...all good :)

So after reading Bear's and Zarlor's posts everything finally clicked. The break definitely helped.

This isn't a deal-breaker, the Edge works properly without code. I am just one of those guys who likes HeroLabs to reflect all the possible states for players and GMs, hence wanting the Edge to change attack on any knife wielded.

So I simply created a new tag (Knife) as suggested and came up with this:
Code:
~go through all weapons and find any that are "knives"
foreach pick in hero where "thingid.Weapon"
   	if (hero.tagis[WeaponType.Knife] <> 0) then
		perform #traitroll[skFighting,+1,"Sykes-Fairbairn"]
   	endif
nexteach

It works, mostly. It will only modify a weapon with the tag="Knife" and add a +1 to the attack. Now the problem, it does it all the time. So now I need to add an 'if' or something to check if the character actually has the Edge or not.
 
I'd suggest another foreach loop outside this one to check if the character has the Edge or not, and then only go through this if they do.
 
It finally hit me one of the other places I might use this myself. Most of the Deadlands settings are set up so that a Cult Leader (or similar) gets a +2 fighting with a Ritual Dagger. I had set that up just so there was a hidden "Ritual Dagger" weapon that just had a +2 Attack Bonus on it and just put a note on it saying the +2 only applied for Cult Leaders, but I think this is actually a cleaner way to set that up. I may have to look at doing an update on some files in the near future.
 
Back
Top