Page 1 of 1
Spec Ranger/ Hitscript
Posted: Tue Oct 30, 2007 3:25 pm
by The_Visitor
Hi, I cant figure out what I´m doing wrong..
I´m trying to add more dmgs for spec rangers when they are using a bow.
But it wont work...
This is what I have done:
[This is my hitscript.inc file and Im using Pol095]
function ModByDist( attacker, defender, weapon, basedamage )
if( weapon.skillid == SKILLID_ARCHERY )
basedamage := basedamage
* ((attacker.dexterity + 0) * 0)
/ (((attacker.strength + 0.0)) / 10.0);
var dist := Distance( attacker, defender );
if( (dist <1> 10) )
basedamage := basedamage * 0.25;
endif
else
var level := GetObjProperty( attacker, CLASSEID_RANGER );
if( level )
basedamage := basedamage * ClasseBonusByLevel( level );
endif
endif
return basedamage;
endfunction
Could sure need some help, thx..
Posted: Tue Oct 30, 2007 6:46 pm
by itec
I could be wrong, but the skillIDs are removed in POL95, instead of:
if( weapon.skillid == SKILLID_ARCHERY )
you should use:
if (weapon.attribute == "Archery")
Posted: Wed Oct 31, 2007 5:03 am
by The_Visitor
I have tried skillIDs and attribute, but it makes no different

Posted: Wed Oct 31, 2007 5:28 am
by MuadDib
http://docs.polserver.com/pol096/objref.php#Weapon
.attribute is a string return, not int.
Code: Select all
if ( weapon.attribute == "Archery" )
Posted: Wed Oct 31, 2007 3:42 pm
by The_Visitor
There I changed my script to ... :
[Still in hitscript.inc..]
Code: Select all
function ModByDist( attacker, defender, weapon, basedamage )
if( weapon.attribute == "ARCHERY" )
var ranger := GetObjProperty( attacker, CLASSEID_RANGER);
var skill := GetEffectiveSkill( attacker, SKILLID_ARCHERY );
var base := CInt( basedamage * (attacker.dexterity + 0)/(attacker.strength)/10);
if( ranger )
basedamage := CInt( base * 40 * skill * ClasseBonus( attacker, CLASSEID_RANGER ) );
var dist := Distance( attacker, defender );
if( (dist <1> 10) )
basedamage := basedamage * 0.25;
endif
endif
else
basedamage := CInt( basedamage * (attacker.dexterity + 0)/(attacker.strength)/10);
var dist := Distance( attacker, defender );
if( (dist <1> 10) )
basedamage := basedamage * 0.25;
endif
endif
return basedamage;
endfunction
But Ranger do the same dmg as anyone else..
Gah! really need some help on this one

Posted: Wed Oct 31, 2007 4:24 pm
by MuadDib
change
Code: Select all
if( weapon.attribute == "ARCHERY" )
to
Code: Select all
if( lower(weapon.attribute) == "archery" )
Posted: Wed Oct 31, 2007 6:14 pm
by The_Visitor
MuadDib wrote:change
Code: Select all
if( weapon.attribute == "ARCHERY" )
to
Code: Select all
if( lower(weapon.attribute) == "archery" )
Done and nothing happend.. :/
Posted: Thu Nov 01, 2007 5:33 am
by itec
You should debug the code, starting from very basics.
Try replacing this:
Code: Select all
if( weapon.attribute == "ARCHERY" )
var ranger := GetObjProperty( attacker, CLASSEID_RANGER);
var skill := GetEffectiveSkill( attacker, SKILLID_ARCHERY );
var base := CInt( basedamage * (attacker.dexterity + 0)/(attacker.strength)/10);
if( ranger )
basedamage := CInt( base * 40 * skill * ClasseBonus( attacker, CLASSEID_RANGER ) );
var dist := Distance( attacker, defender );
if( (dist <1> 10) )
basedamage := basedamage * 0.25;
endif
endif
else
With this:
Code: Select all
if( lower(weapon.attribute) == "archery" )
basedamage := basedamage * 5;
else
Piece by piece put the code back to track down the problem. (What's this "(dist <1> 10)" supposed to be?) Also put a SendSysMessage() in the end to report the damage.
Posted: Thu Nov 01, 2007 10:46 am
by The_Visitor
Aha! thx for the tip, Im getting a bit closer to the source of the "error" now ^^
I really appreciate the help MuadDib and itec.
I will post my solution for this as soon as I´m finished.
I think ppl will have this error if they have downloaded the zhfa095 shard.