News:

Be sure to check out the updated artwork by Vix, located in the "Art Reviews and Previews" board!

Main Menu

Limit items by race

Started by Randomdays, March 29, 2025, 11:41:26 PM

Previous topic - Next topic

Randomdays

Is there a way to limit an item's use/ bonus's by race? In the SA database, I see scripts only for elf/ and Half elf

Adapting Manikus's Longsword vs Giants, this is what I'm trying to do, though its not working;

name = item_HammerDwarfThrower
[ComputeDamage] = $VAR tgt; // target
-$VAR par5; // Hook parameter 5
-$VAR mNm; // monster name
-tgt = $IndexOf($TargetContext());
-par5 = $GET_HOOK_PARAM(5);
-mNm = $GET_CHAR_NAME(tgt);
-$IF ($GET_COMBATANT_SA($AttackerContext(),"IsDwarf") != "-?-?-" && $GET_ISGIANT($TargetContext())){$SET_HOOK_PARAM(5,(par5 *# 3) +# 1);};
-$IF ($GET_MONSTERTYPE_SA(mNm,"subGiant") != "-?-?-"){$SET_HOOK_PARAM(5,par5 +# 1);};
[DoesAttackSucceed] = $VAR tgt; // target
-$VAR mNm; // monster name
-$VAR par5; // Hook parameter 5
-$VAR par6; // Hook parameter 6
-tgt = $IndexOf($TargetContext());
-mNm = $GET_CHAR_NAME(tgt);
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-$IF ($GET_MONSTERTYPE_SA(mNm,"subGiant") != "-?-?-" || $GET_ISGIANT($TargetContext()))
- {
- $IF (par5 >=# (par6 -# 1)){$RETURN "Y";}
- $ELSE {$RETURN "N";};
- };
\(END)

 

Randomdays

#1
I was able to figure it out...Yay!

I tested the following with a Human character, since I didn't have a dwarf ready, and it worked fine with "human" in the race variable. I'm going to assume that since "human" worked, "dwarf" should also work the same way.

Tested with a giant and a non giant enemy.

From testing;

1) If you aren't a human, do normal hammer damage

2) If you are a human and the enemy is not a giant, do 2x damage

3) If you are a human and the enemy is a giant, do triple damage.

Final code, put the "dwarf" back in

Still not sure what a "subGiant" is though

\(BEGIN)
name = item_HammerDwarfThrower1
[ComputeDamage] = $VAR tgt; // target
-$VAR par5; // Hook parameter 5
-$VAR mNm; // monster name
-$VAR race;
-race = $GET_CHAR_RACE(tgt);
-tgt = $IndexOf($TargetContext());
-par5 = $GET_HOOK_PARAM(5);
-mNm = $GET_CHAR_NAME(tgt);
-$IF (race != "Dwarf") {$RETURN "N";};
-$IF ((race == "Dwarf")){$SET_HOOK_PARAM(5,(par5 *# 2) +# 1);};
-$IF ($GET_ISGIANT($TargetContext())){$SET_HOOK_PARAM(5,(par5 *# 3) +# 1);};
-$IF ($GET_MONSTERTYPE_SA(mNm,"subGiant") != "-?-?-"){$SET_HOOK_PARAM(5,par5 +# 1);};
[DoesAttackSucceed] = $VAR tgt; // target
-$VAR mNm; // monster name
-$VAR par5; // Hook parameter 5
-$VAR par6; // Hook parameter 6
-tgt = $IndexOf($TargetContext());
-mNm = $GET_CHAR_NAME(tgt);
-par5 = $GET_HOOK_PARAM(5);
-par6 = $GET_HOOK_PARAM(6);
-$IF ($GET_MONSTERTYPE_SA(mNm,"subGiant") != "-?-?-" || $GET_ISGIANT($TargetContext()))
- {
- $IF (par5 >=# (par6 -# 1)){$RETURN "Y";}
- $ELSE {$RETURN "N";};
- };
\(END)

Nol Drek

Is it possible that "subGiant" refers to the Giant-Kin (Firbolg, Verbeeg, Voadkyn, and Fomorian) as distinct from the True Giants?
"The time has come," the Walrus said, "to talk of many things:
Of shoes — and ships — and sealing-wax — of cabbages — and kings —
And why the sea is boiling hot — and whether pigs have wings."

http://www.noldrek.com