View Single Post
  #2  
Old 07-22-2010, 12:54 PM
Skyld Skyld is offline
Script-fu
Skyld's Avatar
Join Date: Jan 2002
Location: United Kingdom
Posts: 3,914
Skyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud ofSkyld has much to be proud of
Send a message via AIM to Skyld
If you want to do it the function way and have the damage script to ask the skill weapon each time if they have the skill then in the skill weapon, mark the function as public (this allows it to be called from other scripts but will only work clientside->clientside or serverside->serverside):
PHP Code:
public function hasSkill()
{
  if (
conditions// find out if the player has the skill
  
{
    return 
true// return true if they do (which breaks out of the function)
  
}
  
  return 
false// otherwise, return false

… then in your damage script you could do something like:
PHP Code:
if (findweapon("WeaponName").hasSkill())
{
  
// do some stuff here

It might be more efficient though overall if you store some flag in the client flags that determines if the player has that skill, but this reduces the flexibility:
PHP Code:
clientr.hasskill_lessdamage=
… in the client flags, and then:
PHP Code:
if (clientr.hasskill_lessdamage)
{
  
// do some stuff here

… in the damage script.
__________________
Skyld
Reply With Quote