The following warnings occurred:
Warning [2] Use of undefined constant SAPI_NAME - assumed 'SAPI_NAME' (this will throw an Error in a future version of PHP) - Line: 3388 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3388 errorHandler->error
/showthread.php 116 build_archive_link
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/inc/functions.php 3324 build_forum_breadcrumb
/showthread.php 195 build_forum_breadcrumb
Warning [2] Use of undefined constant IN_ARCHIVE - assumed 'IN_ARCHIVE' (this will throw an Error in a future version of PHP) - Line: 3331 - File: inc/functions.php PHP 7.4.33-nmm7 (Linux)
File Line Function
/inc/functions.php 3331 errorHandler->error
/showthread.php 195 build_forum_breadcrumb






Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Tactics, Focus or similar script
Author Message
Archaaz
Journeyman
*

Posts: 98
Likes Given: 12
Likes Received: 4 in 4 posts
Joined: Aug 2013
Reputation: 1



Post: #1
Tactics, Focus or similar script
Does anyone have a soft-coded Tactics, Focus and/or similar script they would be willing to share, or is there one available somewhere? I am trying to create a couple of new skills that function similarly, though with some significant changes, and am looking for something I can use as a point of reference (very new to scripting).

Thanks in advance.
09-24-2013 07:08 PM
Find all posts by this user Like Post Quote this message in a reply
RanXerox
Master
**

Posts: 550
Likes Given: 1
Likes Received: 12 in 9 posts
Joined: Dec 2010
Reputation: 19



Post: #2
RE: Tactics, Focus or similar script
Here is a example of a passive focus gain:

The skill looks like this (feel free to remove the SYSMESSAGES when you are convinced it is working correctly)

Code:
[SKILL 50]
DEFNAME=skill_Focus
KEY=Focus
TITLE=Stoic
//FLAGS=SKF_SCRIPTED|SKF_NOANIM
ADV_RATE=5.0,50.0,100.0
GAINRADIUS=100.0
VALUES=1,50,100
BONUS_STATS=0
BONUS_STR=0
BONUS_DEX=0
BONUS_INT=0
STAT_STR=0
STAT_INT=0
STAT_DEX=0
ON=@Success
   SRC.SYSMESSAGE @color_text,,1 Focus skill used!
ON=@UseQuick
   SRC.SYSMESSAGE @color_text,,1 Focus skill used!

The Skill needs to be triggered every once in a while... so this EVENT is added to the player. All it does is add a timer to them when they login, the timer does the real work:

Code:
[EVENTS e_focus]
ON=@Login
   IF !(<SRC.FINDID.i_focus_timer>)
      SERV.NEWITEM=i_focus_timer
      NEW.CONT=<SRC>
      NEW.TIMER=10
   ENDIF

The timer triggers every 10 seconds and decides if the player should use their Focus skill:

Code:
[ITEMDEF i_focus_timer]
ID=i_candle_thin_lit
TYPE=t_eq_script
LAYER=layer_special
WEIGHT=0
ON=@Create
   ATTR=attr_decay|attr_can_decay
   TIMER=10
ON=@Timer
   IF (<CONT.STAM> < <CONT.MAXSTAM>) || (<CONT.HITS> < <CONT.MAXHITS>) || (<CONT.MANA> < <CONT.MAXMANA>)
      //FIXME: "use skillcheck first?"
      //FIXME: "test if skill is locked"
      LOCAL.Difficulty=<EVAL <CONT.Focus> / 10>
      IF (<LOCAL.Difficulty> > 90)
         LOCAL.Difficulty=90
      ENDIF
      IF (<LOCAL.Difficulty> < 10)
         LOCAL.Difficulty=10
      ENDIF
      CONT.SKILLGAIN focus <LOCAL.Difficulty>
   ENDIF
   TIMER=10
   RETURN 1
09-25-2013 09:11 AM
Find all posts by this user Like Post Quote this message in a reply
Archaaz
Journeyman
*

Posts: 98
Likes Given: 12
Likes Received: 4 in 4 posts
Joined: Aug 2013
Reputation: 1



Post: #3
RE: Tactics, Focus or similar script
Ah, thanks! This is an excellent starting place for what I want to do (create two separate, simple hybrid tactics/focus skills), and gives me a better idea of certain aspects of the server architecture, as well as some ideas. Tying such an event to one particular SkillClass, for example, or to gains in other skills, hits with certain weapons, etc.

My first thoughts on this skill was to tie it to an active use of the skill. Pressing the skill button would automatically activate the skill, and it would remain so for a certain amount of time, or until log-off, or until the skill button was pressed again. Though I no longer want to go this route, I see how it could be done. I am going to play around with this a bit, though I might have some further questions, if you don't mind. Again, many thanks!
09-25-2013 01:59 PM
Find all posts by this user Like Post Quote this message in a reply
Archaaz
Journeyman
*

Posts: 98
Likes Given: 12
Likes Received: 4 in 4 posts
Joined: Aug 2013
Reputation: 1



Post: #4
RE: Tactics, Focus or similar script
This is what I have come up with so far. I am designing my shard such that each SkillClass has a skill that is exclusive to that SkillClass. Basically, the intention is that the Battle Focus skill can only be learned by the Fighter SkillClass.

Quote:[SKILL 50] // Focus
DEFNAME=SKILL_BattleFocus
KEY=Focus
TITLE=Fighter
FLAGS=SKF_SCRIPTED|SKF_NOANIM
STAT_STR=30
STAT_INT=40
STAT_DEX=60
BONUS_STR=0
BONUS_DEX=0
BONUS_INT=0
BONUS_STATS=0
ADV_RATE=10.0,200.0,800.0
GAINRADIUS=100.0

ON=@Success
SKILLGAIN skill_battlefocus, <EVAL <battlefocus> / 10 + 1>

The basic idea here is to, hopefully, perform a skill check any time a character scores a hit with a melee weapon:

Quote:[EVENT e_battlefocus_check]

@Hit
If <serv.itemdef.<argo>.type>!=t_weapon_bow
SKILLCHECK skill_battlefocus, <EVAL <battlefocus> / 10>
endif

[eof]

This one I am not sure about all, esp. the syntax. I want the skill to work passively, but am not sure the best method to go about it, as far as balancing, correct format, ease and efficiency of scripting, etc.

What I am trying to achieve here is to decrease stamina regen by 1 sec for every 20 points of Battle Focus. Perhaps it would be better, and more useful, to increase the amount gained every 10 seconds instead, or go another route.

It may be worth noting that PvP is not going to play major role (and can be opted out of at character creation), that the Fighter skillclass cannot learn Magery (or any other magic skill), but can learn Healing and Anatomy, and that there is no longer a universal Focus skill.

Quote:[EVENT e_battlefocus_passive]

if <battefocus> >= 20.0 && <battlefocus> <= 39.9
SRC.TAG.OVERRIDE.REGEN_stam = 1
endif
if <battlefocus >= 40.0 && <battlefocus> <= 59.9
SRC.TAG.OVERRIDE.REGEN_stam = 2
endif
if <battlefocus >= 60.0 && <battlefocus> <= 79.9
SRC.TAG.OVERRIDE.REGEN_stam = 3
endif
if <battlefocus >= 80.0 && <battlefocus> <= 99.9
SRC.TAG.OVERRIDE.REGEN_stam = 4
endif
if <battlefocus >= 100.0
SRC.TAG.OVERRIDE.REGEN_stam 5
endif

[eof]

Here I have removed the damage bonus from Anatomy and replaced it with a similar one for Battle Focus. I have likewise removed the Lumberjacking damage bonus.

Quote:// DAMAGE BONUS (sphere_combat_functions)

[function f_combatsys_damagebonus_uor]
local.bonus.tactics = <eval (<tactics> / 10) + 50>
local.bonus.str = <eval <str> / 5>
if <battlefocus> > 0 //Redundant as only Fighter SKillClass can learn
local.bonus.battlefocus = <eval <battlefocus> / 50>
endif

return <eval <local.bonus.tactics> + <local.bonus.str> +<local.bonus.battlefocus>>

[eof]
09-25-2013 07:24 PM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #5
RE: Tactics, Focus or similar script
If you are using SCP combat system you can do the weapon check inside f_combatsys_damagebonus_uor just by checking the following
Code:
[function f_combatsys_damagebonus_uor]
local.bonus.tactics = <eval (<tactics> / 10) + 50>
local.bonus.str = <eval <str> / 5>
if (<argo.IsWeapon>)  && !(<argo.type>==t_weapon_bow || <argo.type>==t_weapon_xbow)
    if <battlefocus> > 0 //Redundant as only Fighter SKillClass can learn
        local.bonus.battlefocus = <eval <battlefocus> / 50>
        SkillGain 50 //skillgain skill_battlefocus
    endif
endif

return <eval <local.bonus.tactics> + <local.bonus.str> +<local.bonus.battlefocus>>

So you can now make propper use of @Gain in this skill
Code:
ON=@Gain
if (<r100><<argn2>)//argn2 passes the chance of gaining, so we make custom rand num to bypass default calculation... otherwise gain will be called after we need it
    50 ++
    f_battlefocus_regen_gain
endif
return 1
So we now have the skill gain and a function that calls for regen update
Code:
[function f_battlefocus_regen_gain]
return <eval <battlefocus>/200>//so now you have 1 point of regen per 20.0 points of battlefocus

I think this will help you, if I didn't get what you want ... just tell me, my english is not specially good xD
09-25-2013 09:31 PM
Find all posts by this user Like Post Quote this message in a reply
Archaaz
Journeyman
*

Posts: 98
Likes Given: 12
Likes Received: 4 in 4 posts
Joined: Aug 2013
Reputation: 1



Post: #6
RE: Tactics, Focus or similar script
(09-25-2013 09:31 PM)XuN Wrote:  I think this will help you, if I didn't get what you want ... just tell me, my english is not specially good xD

Well, my Sphere is virtually non-existent y mi español es sólo un poco mejor...Smile. Your English is actually quite good, mi amigo. Gracias.

I think this is indeed what I am trying to do, though your coding is a little (a lot) beyond my knowledge. It is much more elegant and efficient than my clumsy attempt. In all honesty, I cannot pretend to understand the more complex coding in your script (but want to). I do think that for the most part I understand how it functions and why.

Let me make sure I understand what this does:

1. Player hits and does damage with non-archery weapon
2. Trigger SkillGain on Skill 50
3. Skill Check is performed on Skill 50, if it passes, Skill 50 increases (or is the gain automatic when the hit succeeds with no skill check to Battle Focuse)?
4. If the Skill Check passes it also applies the regen formula and returns the new regen gain amount.
5. Damage bonus for Battle Focus is applied (with other bonuses).

Now for some things I do not understand, if you do mind teaching a little...

1. if (<r100><<argn2>) This performs the Skill Check against Battle Focus, yes? Or is there no Skill Check for Battle Focus and it automatically increases with every successful hit? I want it so that it performs a Battle Focus skill check each time before actually increasing the skill (like with Tactics), or else skill gain will be too fast.

2. What does 50 ++ mean and what does this function do?

3. The ON=@Gain part should be pasted in the actual Battle Focus script, yes?

Code:
ON=@Gain
if (<r100><<argn2>)//argn2 passes the chance of gaining, so we make custom rand num to bypass default calculation... otherwise gain will be called after we need it
    50 ++
    f_battlefocus_regen_gain
endif
return 1

4. I understand the formula below, but how can I apply this to a passive increase in stamina regen for the character?

Code:
[function f_battlefocus_regen_gain]
return <eval <battlefocus>/200>//so now you have 1 point of regen per 20.0 points of battlefocus
09-26-2013 12:27 AM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #7
RE: Tactics, Focus or similar script
Well, at first, regen function was wrong coded as it shouldn't return anything and it must set the regen value
Code:
[function f_battlefocus_regen_gain]
TAG.OVERRIDE.REGEN_2=<eval <battlefocus>/200>

Argn2 in @Gain is a % of gaining a point of skill and <r100> gives you a random numer from 0 to 100 (you can use it also like <r1,100>, <r5,15> or any number(s) you want), at low skill rates argn2 is 90+ so you'll have a VERY HIGH chance of skillgain (you may want to test it further and make a better calcs or wait if someone have a better way of doing it!) as if (<r100> would almost always be lower than this <argn2> until this skill goes up)

50 in this whole code is focus skill number, so skillgain 50 means skillgain focus and 50++ does the same as 50=<50>+1 (i'm using 50 as key for focus but you can use focus ++ wich would result in focus=<focus>+1). I don't know if you were asking about '50' or the '++' but I tell you that you can use ++,-- for add or sustract values for an existing key (tags,locals,stats,skills, almost everything that it calls itself in same way to get values and to set values)

And you got what this does perfectly. But i will clarify your point 3: As you said, skill GAIN check is performed on focus, if it passes it got increased AND ALSO your regens updated, otherwise won't gain nor call for regens update, and it will return 1 the default gain, so we don't have double gain AND in this case not-updated regens
09-26-2013 01:26 AM
Find all posts by this user Like Post Quote this message in a reply
Extreme
Grandmaster Poster
***

Posts: 1,141
Likes Given: 217
Likes Received: 90 in 77 posts
Joined: May 2012
Reputation: 20

SphereCommunity

Post: #8
RE: Tactics, Focus or similar script
Just an idea...
PHP Code:
[function f_combatsys_damagebonus_uor]
return <eval (<
tactics>/10)+50+(<str>/5)+(<battlefocus>/50)> 

STEPS BEFORE CREATE A THREAD
- Check the revisions log;
- Use the search button and use the keywords of your problem;
- Check the WIKI;
- Create a thread.
09-26-2013 02:14 AM
Find all posts by this user Like Post Quote this message in a reply
Archaaz
Journeyman
*

Posts: 98
Likes Given: 12
Likes Received: 4 in 4 posts
Joined: Aug 2013
Reputation: 1



Post: #9
RE: Tactics, Focus or similar script
(09-26-2013 01:26 AM)XuN Wrote:  Well, at first, regen function was wrong coded as it shouldn't return anything and it must set the regen value

Code:
[function f_battlefocus_regen_gain]
TAG.OVERRIDE.REGEN_2=<eval <battlefocus>/200>

Ah, okay that makes sense....Smile I was wondering whether I needed to use the override tag or not, and how the return figured into it.

Thank you very much for the script and the explanation. So r is like RAND. The gain should work fine with the range you set, at least for my purposes.

I was indeed wondering about the ++. Quite a useful function. Thank you very much. This is exactly what I wanted the script to do in my initial attempt.

(09-26-2013 02:14 AM)Extreme Wrote:  Just an idea...
PHP Code:
[function f_combatsys_damagebonus_uor]
return <eval (<
tactics>/10)+50+(<str>/5)+(<battlefocus>/50)> 

Ah, thanks! Between the three of you helping me this script will end up being two lines long....Smile
(This post was last modified: 09-26-2013 02:52 AM by Archaaz.)
09-26-2013 02:49 AM
Find all posts by this user Like Post Quote this message in a reply
XuN
Sphere Developer
*****

Posts: 852
Likes Given: 102
Likes Received: 156 in 119 posts
Joined: Jul 2013
Reputation: 30



Post: #10
RE: Tactics, Focus or similar script
(09-26-2013 02:49 AM)Archaaz Wrote:  Ah, thanks! Between the three of you helping me this script will end up being two lines long....Smile

If you wanne improve it more I think you should cleanup code from SCP formula.settings and left up only what you are going to use, I mean...
Code:
[function f_combatsys_hitchance]
doswitch <def.scp.Combat_FormulasUsed>
   return <args> // SPHERE
   begin // Custom - Reference to scp.Combat_HitChance
      doswitch <def.scp.Combat_HitChance>
         return <args>
         return <qval <r100> <= <eval ((<<combat.skill.uor>> * 10) + 5000) / (((<src.<src.combat.skill.uor>> / 10) + 50) * 2)> ? 0 : -100>
         return <qval <r100> <= <f_combatsys_hitchance_aos> ? 0 : -100>
      enddo
   end
   return <qval <r100> <= <eval ((<<combat.skill.uor>> * 10) + 5000) / (((<src.<src.combat.skill.uor>> / 10) + 50) * 2)> ? 0 : -100>
   return <qval <r100> <= <f_combatsys_hitchance_aos> ? 0 : -100>
enddo
You have this and you are going to use AOS formulas? cleanup time!
Code:
[function f_combatsys_hitchance]
return <qval <r100> <= <f_combatsys_hitchance_aos> ? 0 : -100>
It will only last this part of function and you can /2 scripts size and what it's more important for you now... you get some experience in cleaning up! and also you will read up better what this scripts are doing.

And if you are going to work with SkillClasses with different damage bonus per class... it won't be a bad idea to cut up your main damage events and apply on that skillclasses with only their bonus so you can customize better.
09-26-2013 03:00 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)