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-nmm6 (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-nmm6 (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-nmm6 (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
@SkillGain
Author Message
Somersby
Apprentice
*

Posts: 6
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: Nov 2017
Reputation: 0



Post: #1
@SkillGain
Hello! I'm new at Sphere and I'm trying to figure some things out!

I want to make a reward item when a player reaches 100.0 in a specific skill. I'm using Sphere 56c.
[EVENTS e_players]
On=@SkillGain
if !<src.isplayer>
return 0
endif

if (<src.tinkering> == 1000)
if !<src.tag.reward_tinkering>
src.tag.reward_count = <eval ((<src.tag.reward_count>) + 1)>
src.tag.reward_tinkering = 1
src.sysmessage @,,1 Tinkering Complete!
src.dialog d_reward_gump
endif
endif

Ok. I have 99.9 Tinkering and I'm macroing... 100.0. Nothing happens. But if I keep macroing (one more time, to be exactly), it works.

What's wrong in there? Sad

Thanks!
(This post was last modified: 11-06-2017 11:18 PM by Somersby.)
11-06-2017 11:15 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: @SkillGain
You have to use @SkillChange and the argn1 and argn2 value, @SkillGain is fired before the skill increase and is always fired whenever the skill will increase or not.

https://wiki.spherecommunity.net/index.p...killChange

Code:
[EVENTS e_players]
On=@SkillChange
if !<src.isplayer>
return 0
endif

if ( <argn1> == 37 ) && (<argn2> == 1000) //37 is the tinkering skill
if !<src.tag.reward_tinkering>
src.tag.reward_count = <eval ((<src.tag.reward_count>) + 1)>
src.tag.reward_tinkering = 1
src.sysmessage @,,1 Tinkering Complete!
src.dialog d_reward_gump
endif
endif
(This post was last modified: 11-07-2017 12:36 AM by darksun84.)
11-07-2017 12:34 AM
Find all posts by this user Like Post Quote this message in a reply
[+] 1 user Likes darksun84's post
Somersby
Apprentice
*

Posts: 6
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: Nov 2017
Reputation: 0



Post: #3
RE: @SkillGain
(11-07-2017 12:34 AM)darksun84 Wrote:  You have to use @SkillChange and the argn1 and argn2 value, @SkillGain is fired before the skill increase and is always fired whenever the skill will increase or not.

https://wiki.spherecommunity.net/index.p...killChange

Code:
[EVENTS e_players]
On=@SkillChange
if !<src.isplayer>
return 0
endif

if ( <argn1> == 37 ) && (<argn2> == 1000) //37 is the tinkering skill
if !<src.tag.reward_tinkering>
src.tag.reward_count = <eval ((<src.tag.reward_count>) + 1)>
src.tag.reward_tinkering = 1
src.sysmessage @,,1 Tinkering Complete!
src.dialog d_reward_gump
endif
endif

Thanks!!!
11-07-2017 02:17 AM
Find all posts by this user Like Post Quote this message in a reply
Somersby
Apprentice
*

Posts: 6
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: Nov 2017
Reputation: 0



Post: #4
RE: @SkillGain
So... I have a table (with skills I will use to give a reward). It works great. But, there's any way to combine skills in there? Example... Thief = Snooping+Stealing+Hiding+Stealth.

Code:
[DEFNAME reward_skills]
skillreward.Alchemy 58
skillreward.Musicianship 29
skillreward.Provocation 22
skillreward.Peacemaking 9
skillreward.Enticement 15
skillreward.Blacksmithing 7
skillreward.Carpentry 11
skillreward.Fishing 18
skillreward.Lumberjacking 44
skillreward.Magery 25
skillreward.Mining 45
skillreward.Tailoring 34
skillreward.Tinkering 37
skillreward.Snooping 28
skillreward.Lockpicking 24
skillreward.Stealth 47
skillreward.Hiding 21
skillreward.Stealing 33
skillreward.Taming 35
skillreward.Bowcraft 8

for r 1 58
local.name = <serv.skill.<local.r>.key>
    if (<argn1> == <eval <def.skillreward.<local.name>>>) && (<argn2> == 1000)
     if (<eval <def.skillreward.<local.name>>> == 0)
        return 0
     endif
        if !<eval <src.tag0.reward_<local.name>>>
            src.tag0.reward_<local.name> = 1
            src.tag0.reward_count = <eval ((<src.tag0.reward_count>) + 1)>  
            src.dialog d_reward_gump
        endif
    endif
endfor
(This post was last modified: 11-09-2017 11:27 AM by Somersby.)
11-09-2017 10:52 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #5
RE: @SkillGain
You can use skilltest for checking the values of multiple skills

Code:
//Skilltest returns 1 if you have all the skills in the list at the appropriate level, otherwise returns 0
if <src.skilltest snooping 1000,stealing 1000,hiding 1000, stealth 1000>
  //your code...
endif

Also pay attention that your FOR index should starts from 0 and not from 1, that's because the Alchemy skill has index 0.
11-09-2017 08:38 PM
Find all posts by this user Like Post Quote this message in a reply
Somersby
Apprentice
*

Posts: 6
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: Nov 2017
Reputation: 0



Post: #6
RE: @SkillGain
(11-09-2017 08:38 PM)darksun84 Wrote:  You can use skilltest for checking the values of multiple skills

Code:
//Skilltest returns 1 if you have all the skills in the list at the appropriate level, otherwise returns 0
if <src.skilltest snooping 1000,stealing 1000,hiding 1000, stealth 1000>
  //your code...
endif

Also pay attention that your FOR index should starts from 0 and not from 1, that's because the Alchemy skill has index 0.

Yeah, I had a problem with it... Because my for returns all values to 0 (of the skills that I don't want it), if I put 0 in there, all skills will be triggered (even if I don't want them). I made a "new" Alchemy, just copying the KEY and put it on 58.
11-10-2017 04:37 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #7
RE: @SkillGain
I don't think it's safe to do that Confused

A faster and safer alternative is this, create a new file and place the following code

Code:
[DEFNAME custom_skill_flags]
skillReward  01
Open spheretables.scp and add the new file before sphere_skills.scp.
Then open sphere_skills.scp and for each skill that you want a reward add the following line in the skill block

Code:
GROUP= skillReward

Go back in your trigger SkillChange and change it in this way:

Code:
local.name = <serv.skill.<argn1>.key>
if (<serv.skill.<argn1>.group>&<def0.skillReward>) && ( <argn2> == 1000 )
     if !<eval <src.tag0.reward_<local.name>>>
            src.tag0.reward_<local.name> = 1
            src.tag0.reward_count = <eval ((<src.tag0.reward_count>) + 1)>  
            src.dialog d_reward_gump
    endif
endif

http://wiki.spherecommunity.net/index.ph...Operations
(This post was last modified: 11-10-2017 05:06 AM by darksun84.)
11-10-2017 04:59 AM
Find all posts by this user Like Post Quote this message in a reply
Somersby
Apprentice
*

Posts: 6
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: Nov 2017
Reputation: 0



Post: #8
RE: @SkillGain
Pretty cool way!!!

Everything's working, except Alchemy! Sad

ERROR:(c_event_player.scp,14)Can't resolve <serv.skill.0.key>
11-10-2017 05:35 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 245
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #9
RE: @SkillGain
Did you added back the key to the alchemy? Usually you need to restart the server when you make a change to the SKILL block (this also apply to the SPELL blocks)
11-10-2017 05:38 AM
Find all posts by this user Like Post Quote this message in a reply
Somersby
Apprentice
*

Posts: 6
Likes Given: 1
Likes Received: 0 in 0 posts
Joined: Nov 2017
Reputation: 0



Post: #10
RE: @SkillGain
(11-10-2017 05:38 AM)darksun84 Wrote:  Did you added back the key to the alchemy? Usually you need to restart the server when you make a change to the SKILL block (this also apply to the SPELL blocks)

Oh, I didn't restart the server for the spell blocks. Now it's working.

Man, thank you SO much for your help. I really appreciate it. ^^
11-10-2017 05:41 AM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


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