Spec Ranger/ Hitscript

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.
Post Reply
User avatar
The_Visitor
New User
Posts: 9
Joined: Fri Oct 26, 2007 5:29 am

Spec Ranger/ Hitscript

Post 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..
User avatar
itec
Novice Poster
Posts: 42
Joined: Thu Feb 09, 2006 11:48 pm

Post 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")
User avatar
The_Visitor
New User
Posts: 9
Joined: Fri Oct 26, 2007 5:29 am

Post by The_Visitor »

I have tried skillIDs and attribute, but it makes no different :(
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm

Post by MuadDib »

http://docs.polserver.com/pol096/objref.php#Weapon

.attribute is a string return, not int.

Code: Select all

if ( weapon.attribute == "Archery" )
User avatar
The_Visitor
New User
Posts: 9
Joined: Fri Oct 26, 2007 5:29 am

Post 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 :x
MuadDib
Former Developer
Posts: 1091
Joined: Sun Feb 12, 2006 9:50 pm

Post by MuadDib »

change

Code: Select all

if( weapon.attribute == "ARCHERY" ) 
to

Code: Select all

if( lower(weapon.attribute) == "archery" ) 
User avatar
The_Visitor
New User
Posts: 9
Joined: Fri Oct 26, 2007 5:29 am

Post 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.. :/
User avatar
itec
Novice Poster
Posts: 42
Joined: Thu Feb 09, 2006 11:48 pm

Post 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.
User avatar
The_Visitor
New User
Posts: 9
Joined: Fri Oct 26, 2007 5:29 am

Post 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.
Post Reply