PenUltima Online

It is currently Thu Aug 28, 2008 3:10 pm

All times are UTC - 8 hours




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Spec Ranger/ Hitscript
PostPosted: Tue Oct 30, 2007 3:25 pm 
Offline
User avatar

Joined: Fri Oct 26, 2007 5:29 am
Posts: 6
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]

Quote:
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..


Top
 Profile  
 
 Post subject:
PostPosted: Tue Oct 30, 2007 6:46 pm 
Offline
User avatar

Joined: Thu Feb 09, 2006 11:48 pm
Posts: 35
Location: Finland
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")


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 31, 2007 5:03 am 
Offline
User avatar

Joined: Fri Oct 26, 2007 5:29 am
Posts: 6
I have tried skillIDs and attribute, but it makes no different :(


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 31, 2007 5:28 am 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 834
Location: Indiana, USA
http://docs.polserver.com/pol096/objref.php#Weapon

.attribute is a string return, not int.

Code:
if ( weapon.attribute == "Archery" )

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 31, 2007 3:42 pm 
Offline
User avatar

Joined: Fri Oct 26, 2007 5:29 am
Posts: 6
There I changed my script to ... :

[Still in hitscript.inc..]

Code:
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


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 31, 2007 4:24 pm 
Offline
POL Developer
User avatar

Joined: Sun Feb 12, 2006 9:50 pm
Posts: 834
Location: Indiana, USA
change

Code:
if( weapon.attribute == "ARCHERY" )


to

Code:
if( lower(weapon.attribute) == "archery" )

_________________
POL Developer - The Penguin Scripter


Top
 Profile  
 
 Post subject:
PostPosted: Wed Oct 31, 2007 6:14 pm 
Offline
User avatar

Joined: Fri Oct 26, 2007 5:29 am
Posts: 6
MuadDib wrote:
change

Code:
if( weapon.attribute == "ARCHERY" )


to

Code:
if( lower(weapon.attribute) == "archery" )


Done and nothing happend.. :/


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 01, 2007 5:33 am 
Offline
User avatar

Joined: Thu Feb 09, 2006 11:48 pm
Posts: 35
Location: Finland
You should debug the code, starting from very basics.

Try replacing this:
Code:
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:
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.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Nov 01, 2007 10:46 am 
Offline
User avatar

Joined: Fri Oct 26, 2007 5:29 am
Posts: 6
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.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 8 hours


Who is online

Users browsing this forum: No registered users and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
Style based on FI Subice by phpBBservice.nl