Author Topic: Special Magic Weapons? Ex: Sword vs. Undead +3  (Read 558 times)

Offline Draugr

  • Jr. Member
  • **
  • Posts: 99
Special Magic Weapons? Ex: Sword vs. Undead +3
« on: October 05, 2015, 07:39:41 PM »
Hi.

I recall doing this years ago in FRUA, but I can't seem to figure out how to create a Sword +1 vs. <Some monster type>. Can this be done currently in DC? I'm hoping to make a weapon such as Axe +2 vs. Goblinoids. Goblinoids might be goblins, hobgoblins, maybe orcs. If that is too specific, then a weapon +'x' vs. a single monster type such as vs. Goblins would be good as well, or if there is some way to link a group such as +3 vs. Dragons.

Any info is appreciated.

John

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9916
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #1 on: October 06, 2015, 02:33:10 PM »
Good question. :)

We can totally do this in DC. You need to add a Special Ability to the weapon in question.

Let's create a Long Sword +2, +4 vs Undead. You can do this in the editor or in the txt database.
1) make a copy of your Long Sword +2 and name it something appropriate. Note: Perhaps you want it's unidentified name to stay the same which in the default database is "Long Sword|3". Everything afte the bar - | - is invisible to th eplayer, so you could name it something like, "Long Sword|Undead Slayer".
2) change the id name to whatever you want the player to see when they identify the sword, eg. :ong Sword +2, Undead Slayer.
3) Click on the Special Abilties button (or add aline in the text called "Special Ability =" and add a name that makes sense to you. For this exxample, lets call it "item_LongSwordVsUndead"

Save your work and close the item editor and open the special ability editor.
1) Enter the name we just used "item_LongSwordVsUndead in the new new name box.
2) Click on  Create Special Ability
3) Select "Add Line"
4) In the box that pops up, you need to put the namme of the Hook you want to use for this Special Ability (SA) While we are only going to need one for this SA, you can have more than one Hook. In the top space, enter "ComputeDamage" and click Okay.
5) Select ComputeDamage and choose "Script" on the list and then press the Edit Line button
6) This is where our script gets entered. We want to have an extra amount of damage done to any opponent that is of the type "Undead". Heres teh script I wrote:
Code: [Select]
$IF ($IsUndead($TargetContext())) // checks to see if target is Undead
{
$RETURN $GET_HOOK_PARAM(5) +# 2; // retrieves damage that would be given and adds 2
};

To learn more about ComputeDaamage, please see this page...
http://manikus.reonis.com/Help/SAComputeDamage.html

7) Click "Test Syntax". (You should always do this after entering a script.)

Click Okay until you get back to the main editor and save your work.

That's it. The new magical sword is read to be used in your design. :)
« Last Edit: October 06, 2015, 02:35:55 PM by manikus »

Offline Draugr

  • Jr. Member
  • **
  • Posts: 99
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #2 on: October 06, 2015, 03:08:34 PM »
Damn Manikus... This is awesome! I can really use your advice above for a bunch of ideas that have been popping up in my head as I'm working on my first design. DC certainly is much more powerful than FRUA was (although for it's time FRUA was amazing).

Thanks a bunch for all your help in my many posts. LOL

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9916
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #3 on: October 06, 2015, 03:31:37 PM »
You're welcome. :)

You can really do anything as a search - if there isn't a function for it, like getting a monster's race (for goblinoids, etc), ou can add an SA to the monster type, like "Special Ability = lefthanded" and in the IF query check to see if monster has said SA.

It is not much harder to create armor that is only usable by Lawful Good Dwarves. ;)

Offline ArmorNox (Funky Dynamite)

  • Jr. Member
  • **
  • Posts: 72
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #4 on: January 29, 2018, 09:55:56 AM »
Excuse me for digging up a old post, but how would you do this for "Arachnids"
I try a variation of this code,  but it says the code is not valid
"Where does he get those -wonderful- toys?!"
"Why, I sell my soul, of course...."

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2262
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #5 on: January 29, 2018, 10:12:16 AM »
Quote
but it says the code is not valid

Does it really say "Code is not valid"?  Or something similar?
The precise error message might help us determine the problem.

Perhaps you could show us the code.  We might be able to
spot the error.

Offline ArmorNox (Funky Dynamite)

  • Jr. Member
  • **
  • Posts: 72
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #6 on: January 29, 2018, 11:03:43 AM »
No, of course it doesn't.  I was  just trying to be simple....

This is the code I tried:
$IF ($IsArachnid($TargetContext()))
   {
      $RETURN $GET_HOOK_PARAM(5) +# 2;
   };

As you can see, it is the code above, but "Arachnid" replacing "Undead"
When i test the syntax, i get the attachment....

I flagged the appropriate monsters with a SA "IsArachnid"

I have tried a couple variations on the code above, granted experimenting with removing the "$", but obviously I'm doing wrong....
"Where does he get those -wonderful- toys?!"
"Why, I sell my soul, of course...."

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9916
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #7 on: January 29, 2018, 06:37:31 PM »
Thanks for asking a good question. :)

Your script does not work because there is no "$IsArachnid" function in Dungeon Craft. I believe in addition to $IsUndead, there is also $IIsMammal, $IsGiant, $IsSnake - all things that match up with FRUA (Forgotten Realms: Unlimited Adentures).

There are two way you can do this, the easiest being to add a Special Ability (SA) to all of the spiders and other arachnids in the monster database, something like "IsArachnid" with whatever parameter you would like.
Then, instead of looking for $IsArachnid, you $GET_COMBATANT_SA($TargetContext(),"IsArachnid").

Code: [Select]
$IF ($GET_COMBATANT_SA($TargetContext(),"IsArachnid") != "-?-?-") // checks to see if target has SA IsArachnid
{
$RETURN $GET_HOOK_PARAM(5) +# 2; // retrieves damage that would be given and adds 2
};

This works just like the above script, but you have to add a Special Ability called "IsArachnid" to each monster you want affected by this.

Offline steve_mcdee

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 1965
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #8 on: January 29, 2018, 07:00:01 PM »
I flagged the appropriate monsters with a SA "IsArachnid"

... you have to add a Special Ability called "IsArachnid" to each monster you want affected by this.
It sounds like ArmorNox(FD) actually did this already ("I flagged the appropriate monsters with a SA "IsArachnid""), so it seems that the key is to use $GET_COMBATANT_SA($TargetContext(),"IsArachnid") rather than $IsArachnid.

Offline ArmorNox (Funky Dynamite)

  • Jr. Member
  • **
  • Posts: 72
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #9 on: January 30, 2018, 06:46:05 AM »
Yes, I did, steve.
And thank you, Manikus.  I was able to quickly figure out the others, such as "$IsMammal" and the like were coded, I just couldn't figure quite out where to go from there....
A couple of finishing touches: 
1.) does my "IsArachnid" SA need the "$"?
2.) Manikus, you talk about perameters....  I assume you mean the second space in the SA box, like you put on Items and Monsters...?  I am very, very unclear wht to put there...a number?  A word?
"Where does he get those -wonderful- toys?!"
"Why, I sell my soul, of course...."

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2262
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #10 on: January 30, 2018, 11:10:40 AM »
Special Ability names are arbitrary.  Call them what you like.
The parameter is arbitrary.  Put anything there that you find
useful.  For example, particular monsters might have the
Special Ability called "FraidyCat"; with a parameter describing
the degree - a number from 1 to 10, perhaps.  Another monster
might have the SpecialAbility named "MORPH" with a parameter
describing the monster it could morph into - 'Elephant', perhaps.
These Special Abilities are nothing more than two text strings
as far as the engine is concerned.  They have no meaning or
syntax.

Offline ArmorNox (Funky Dynamite)

  • Jr. Member
  • **
  • Posts: 72
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #11 on: January 30, 2018, 01:11:29 PM »
Nod.  Thank you.
"Where does he get those -wonderful- toys?!"
"Why, I sell my soul, of course...."

Offline steve_mcdee

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 1965
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #12 on: January 30, 2018, 03:10:27 PM »
Paul — so instead of “IsMammal” you could have an SA called TaxonomicClass for each animal and give it parameters like “Mammal”, “Bird”, “Amphibian”, etc?

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9916
Re: Special Magic Weapons? Ex: Sword vs. Undead +3
« Reply #13 on: January 30, 2018, 03:22:58 PM »
Paul — so instead of “IsMammal” you could have an SA called TaxonomicClass for each animal and give it parameters like “Mammal”, “Bird”, “Amphibian”, etc?

That is correct. You don't need to scrunch it all together, either. "Taxonomic Class" would work just as well.
You would use the $GET_COMBATANT_SA() function to retrieve the SA parameter that you set, i.e. "Mammal", "Bird", etc. If there is no value, but the SA exists, it will return "". If the SA does not exist, it will reutrn "-?-?-".