Author Topic: Questions about DC  (Read 16287 times)

Offline Nol Drek

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2213
    • Nol Drek's Web Site
Re: Questions about DC
« Reply #195 on: December 17, 2017, 09:31:24 PM »
I think you forgot to establish a value to 'par5'.
(The comment alone won't suffice.).

Thanks, I fixed it above.

When ComputeDamage returns a value, as in manikus' script, is that the same as setting a new value for hook parameter 5?
"Into the Drachensgrab Mountains!"

http://www.noldrek.com

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2251
Re: Questions about DC
« Reply #196 on: December 18, 2017, 08:55:06 AM »
Quote from: Nol Drek
ComputeDamage....a new value for hook parameter 5

According to the documentation:

http://dianneandpaul.net/UAF/Help/SAComputeDamage.html

Changing Hook Parameter 5 has no effect whatsoever.  Only the
return value is used by the engine.

Offline Nol Drek

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2213
    • Nol Drek's Web Site
Re: Questions about DC
« Reply #197 on: December 18, 2017, 09:19:31 PM »
So the "item_LongSwordVSGiants" SA in the default database (which I based my script off of) must not work either.

Code: [Select]
$VAR tgt; // target
$VAR par5; // Hook parameter 5
$VAR name;
tgt = $IndexOf($TargetContext());
par5 = $GET_HOOK_PARAM(5);
name = $GET_CHAR_NAME(tgt);
$IF ($GET_ISGIANT($TargetContext())){$SET_HOOK_PARAM(5,(par5 *# 2) +# 1);};
$IF ($GET_MONSTERTYPE_SA(name,"subGiant") != "-?-?-"){$SET_HOOK_PARAM(5,par5 +# 1);};

I take it those $SET_HOOK_PARAM(5,N) statements should instead be $RETURN N statements.

Thank you, gentlemen, for your guidance as I continue to learn this scripting language.
"Into the Drachensgrab Mountains!"

http://www.noldrek.com

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2251
Re: Questions about DC
« Reply #198 on: December 19, 2017, 12:41:59 AM »
Yes.  I think you are right.  That hook will not
work as currently implemented.

I just examined the engine code and it appears to
expect a return value, not  a change to hookparameter 5.

At least the code appears to agree with the documentation.
That is a plus.

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9886
Re: Questions about DC
« Reply #199 on: December 19, 2017, 12:45:22 PM »
There is no problem with the parameters for this Hook. They are used to retrieve information - parameter 5 retrieves the value of the damage that will be done. You wouldn't want to set the parameters to anything else in this script, but you do want to retrieve the information.

Plus, using a variable means that i can change the value of the variable without needing to change what the script returns.

(This is more of an explanatory note for the folks not resounding to this part of the thread, but for people who will read this and wonder what is goinng on.)

Offline Paul R. Stevens

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2251
Re: Questions about DC
« Reply #200 on: December 19, 2017, 06:43:59 PM »
Manikus, I don't understand what the last two
lines of that script are for.  They set hook parameter 5
and then exit.  That value will be ignored, I think.

Offline Nol Drek

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2213
    • Nol Drek's Web Site
Re: Questions about DC
« Reply #201 on: December 19, 2017, 09:02:05 PM »
Here is my super simple Special Ability for a Long Sword that deals an extra 1d6 damage:

item_LongSwordExtraDamage
ComputeDamage:
Code: [Select]
$RETURN $GET_HOOK_PARAM(5) +# $RANDOM(6) +# 1;

Of course, you should manikus' script instead because it checks whether or not the target is immune to fire or resistant to fire.
"Into the Drachensgrab Mountains!"

http://www.noldrek.com

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9886
Re: Questions about DC
« Reply #202 on: December 20, 2017, 12:37:00 PM »
quote author=Paul R. Stevens link=topic=2194.msg52420#msg52420 date=1513730639]
Manikus, I don't understand what the last two
lines of that script are for.  They set hook parameter 5
and then exit.  That value will be ignored, I think.
[/quote]

I am confused - my script doesn't set Parameter 5 at all.

My script is more comprehensive than Nol's script - it does no damage if the target is immune to fire attacks, it does half damage if the target is resistant to fire attacks and does full damage if the target is neither immune nor resistant to fire.

Here is an updated version fo the script, because my line for fire restance was too effective. ;)
Code: [Select]
\(BEGIN)
name = item_LongSwordFlameTongue
[ComputeDamage] = $VAR p5;
-$VAR noFire;
-$VAR someFire;
-$VAR fireDamage;
-p5 = $GET_HOOK_PARAM(5);
-noFire = $GET_CHARACTER_SA($TargetContext(),"elemental_ImmuneFire");
-someFire = $GET_CHARACTER_SA($TargetContext(),"elemental_ResistantFire");
-fireDamage = $RANDOM(6) +# 1; // we add 1 because  the $RANDOM function will provide a number from 0 to 5
-$IF (noFire != "-?-?-") {$RETURN p5;};
-$IF (someFire != "-?-?-") {$RETURN p5 +# (fireDamage /# 2);};
-$RETURN p5 + fireDamage;
\(END)

edited to add:
This script assumes that the sword does regular damage, and the only fire damage is the extra d6. If it were all fire damage, the script would look a little different.
« Last Edit: December 20, 2017, 12:38:38 PM by manikus »

Offline Milos Gulan

  • Hero Member
  • *****
  • Posts: 3194
Re: Questions about DC
« Reply #203 on: December 20, 2017, 04:12:11 PM »
Thank You :) I will try to implement it soon. Right now I have started to do skeleton sprites. Beside that I am preparing Greyhawk adventures for my group and what happened till now is that they have passed a lot dungeoncrawling in Castle Greyhawk up till level 8 (gave up on a black dragon but did fantasticaly till that). Now I have I think 4 paths main is to defeat major evil and continue to adventure in GH castle. 2nd is to find lair of Dragotha dracolich and then later to find Keraptis and deal with them (3rd part of White Plume mountain). 3rd is defeat Suel archmage from past, then go to past and prevent Scarlet Brotherhood from stoping the change of usual things that happened in past. 4th is Queen of spiders story.

Problem with all this beside converting to DC which i think will be very hard with my current knowledge is that they will advance in levels and other paths are the same level as they curent characters are. Anyway here is the pic I better finish it and hopefuly to prepare for playing tomorrow :). I was thinking about GH mod but I just have problems with lots of rules that I probably will not be able to do. But not giving up, will do my mod to se how it is done.
« Last Edit: December 20, 2017, 04:14:47 PM by Milos Gulan »

Offline Nol Drek

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2213
    • Nol Drek's Web Site
Re: Questions about DC
« Reply #204 on: December 20, 2017, 07:17:35 PM »
I am confused - my script doesn't set Parameter 5 at all.

Paul was talking about the script for "item_LongSwordVsGiants". I think I have the most up-to-date version of the SA database. Is there a more recent script for a Giant Slaying Sword?

Your Flame Tongue script is awesome. We can attach it to any melee weapon (not just Swords) and it shows exactly how to make weapons which deal bonus damage from Cold, Electricity, Acid, Sonic, etc.
"Into the Drachensgrab Mountains!"

http://www.noldrek.com

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9886
Re: Questions about DC
« Reply #205 on: December 21, 2017, 12:55:32 PM »
I am confused - my script doesn't set Parameter 5 at all.

Paul was talking about the script for "item_LongSwordVsGiants". I think I have the most up-to-date version of the SA database. Is there a more recent script for a Giant Slaying Sword?

Your Flame Tongue script is awesome. We can attach it to any melee weapon (not just Swords) and it shows exactly how to make weapons which deal bonus damage from Cold, Electricity, Acid, Sonic, etc.

Thanks, Nol. You probably have the most up-to-date databases, but I need to fix some old scripts. I don't think that particular script has been changed in literally years - probably not much since version 1.0.

Here is an updated script for the Long Sword vs Giants:
Code: [Select]
\(BEGIN)
name = item_LongSwordVsGiants
[ComputeDamage] = $VAR tgt; // target
-$VAR par5; // Hook parameter 5
-$VAR name;
-tgt = $IndexOf($TargetContext());
-par5 = $GET_HOOK_PARAM(5);
-name = $GET_CHAR_NAME(tgt);
-$IF ($GET_ISGIANT($TargetContext()) ==# 1){$RETURN par5 *# 2 +# 1;};
-$IF ($GET_MONSTERTYPE_SA(name,"subGiant") != "-?-?-"){$RETURN par5 +# 1;};
[DoesAttackSucceed] = $VAR tgt; // target
-$VAR name;
-$VAR par5; // Hook parameter 5
-$VAR par6; // Hook parameter 6
-tgt = $IndexOf($TargetContext());
-name = $GET_CHAR_NAME(tgt);
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-$SET_HOOK_PARAM(7,2);
-$IF ($GET_MONSTERTYPE_SA(name,"subGiant") != "-?-?-" || $GET_ISGIANT($TargetContext()))
- {
- $SET_HOOK_PARAM(6,par6 -# 1);
- $SET_HOOK_PARAM(7,3);
- };
-$IF (par5 >=# par6){$RETURN "Y";}
-$ELSE {$RETURN "N";};
\(END)

Offline Milos Gulan

  • Hero Member
  • *****
  • Posts: 3194
Re: Questions about DC
« Reply #206 on: January 03, 2018, 06:18:38 AM »
Ok I have to admit that I can't do it and that I will need help. I made new item as shown Long Sword Flame Tongue. Then I have added SA in Special Abilites.txt then imported it in database. Now I don't know how to link it to the sword. I have used Manikus script:

\(BEGIN)
name = item_LongSwordFlameTongue
[ComputeDamage] = $VAR p5;
-$VAR noFire;
-$VAR someFire;
-$VAR fireDamage;
-p5 = $GET_HOOK_PARAM(5);
-noFire = $GET_CHARACTER_SA($TargetContext(),"elemental_ImmuneFire");
-someFire = $GET_CHARACTER_SA($TargetContext(),"elemental_ResistantFire");
-fireDamage = $RANDOM(6) +# 1; // we add 1 because  the $RANDOM function will provide a number from 0 to 5
-$IF (noFire != "-?-?-") {$RETURN p5;};
-$IF (someFire != "-?-?-") {$RETURN p5 +# (fireDamage /# 2);};
-$RETURN p5 + fireDamage;
\(END)

Offline Nol Drek

  • Dungeon Craft Tester
  • Hero Member
  • ***
  • Posts: 2213
    • Nol Drek's Web Site
Re: Questions about DC
« Reply #207 on: January 03, 2018, 11:19:21 AM »
1) Click on the Magical Props button.
2) Click on the Special Abilities button.
3) Click on the Add button.
4) In the Name field, type "item_LongSwordFlameTongue".
5) In the Value field, type "1".

The Value field is arbitrary. You could type "Yes" or "1d6" instead of "1". Just don't leave it blank.  Edited: You can even leave it blank.
« Last Edit: January 05, 2018, 12:24:39 AM by Nol Drek »
"Into the Drachensgrab Mountains!"

http://www.noldrek.com

Offline Milos Gulan

  • Hero Member
  • *****
  • Posts: 3194
Re: Questions about DC
« Reply #208 on: January 04, 2018, 11:21:21 AM »
It works  ;D Thank You very much. And I have finished my skeleton :) now I have a skeleton with Lonsgword Flametongue 8)

Offline manikus

  • Skriptor
  • Administrator
  • Hero Member
  • *****
  • Posts: 9886
Re: Questions about DC
« Reply #209 on: January 04, 2018, 12:53:36 PM »
1) Click on the Magical Props button.
2) Click on the Special Abilities button.
3) Click on the Add button.
4) In the Name field, type "item_LongSwordFlameTongue".
5) In the Value field, type "1".

The Value field is arbitrary. You could type "Yes" or "1d6" instead of "1". Just don't leave it blank.

Thank you, Nol. That is a good description of what to do.

Not trying to confuse matters, but you don't need to put anything in the Value field if you don't want to. DC can differentiate between an SA with no value and an SA which odoesn't exist. ;)

 

anything