Graal Forums  

Go Back   Graal Forums > Development Forums > NPC Scripting
FAQ Members List Calendar Today's Posts

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 07-22-2010, 07:35 AM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Need help dealing with functions.

Okay, I didnt really know what to title this topic, but anywho..

I have a skill that reduces damage taken if the opposing player attempts to attack from a particular direction. However, the damage script is of course in a separate weapon. So heres where my problem comes in.. I need to know how to go about interrupting the function that normally processes damage, and instead check to see if they have the skill and if the conditions apply, then to go back to the function that was interrupted, process the results and finally adjust the final damage results accordingly.
Instead of, you know, just stamping the skill code into the damage code and checking to see if the player has obtained the skill by checking a flag.

Any tips?
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
  #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
  #3  
Old 07-22-2010, 06:08 PM
Jiroxys7 Jiroxys7 is offline
Hazard to Graal
Jiroxys7's Avatar
Join Date: Apr 2009
Posts: 343
Jiroxys7 will become famous soon enough
Thanks, I'll play around with that
__________________
MY POSTS ARE PRONE TO EDITS!
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 09:07 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.