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
Trying to emulate skill advancement and override the original skill (almost) totally.
Author Message
Rayvolution
Journeyman
*

Posts: 135
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 1

Aetharia

Post: #1
Trying to emulate skill advancement and override the original skill (almost) totally.
I haven't scripting in years, I used to be an old scripter back in the TUS days, 51a and eventually in the 55i days.. but, I've forgotten a lot in the past 5 years or so, and I can't seem to wrap my head around this problem and I feel it should be simple.

Basically, I'm trying to (if possible) trigger the "Skillgain chance" in an unnatural environment for a skill.

What I plan on doing is completely disabling ItemID's normal functions, and "fake it" with another function. The new way I plan on writing ItemID (and Arms Lore, but that's not important right now) is when you single click on an item it'll tell you information about that item in a SYSMESSAGE, based on how high your ItemID skill is, and then, "test" the skill and allow skillgain like you would if you used it normally.

Alternatively, I wouldn't mind simply having a "Random chance" script that just raised the skill at random, but I'd rather it just test the skill correctly and let Sphere decide if it wants to give the user a skillgain.

Here's a quick script I have written up, I just need to plugin the value that either tests the skill (allowing for default skill gains) or just stick in a random variable for a chance at a gain. Either will work, but I'm stuck trying to figure it out.

I eventually plan on plugging this into every single item in the game (Yes, I know, I'm crazy.) but first I need to figure the skill gains out. Smile

Super-basic script I have so far, yes, I know I overwrote a core ITEMDEF, I did it on purpose. Smile
Code:
[ITEMDEF 0f0c]
DEFNAME=i_bottle_medium_empty
TYPE=T_POTION_EMPTY
SKILLMAKE=TINKERING 21.3,t_tinker_tools
RESOURCES=2 i_ingot_iron
WEIGHT=1

ON=@CLICK
IF (<SRC.ITEMID> < 10)
SRC.SYSMESSAGE It's an empty glass bottle.
ELSE
IF (<SRC.ITEMID> < 30)
SRC.SYSMESSAGE It's a medium sized empty glass bottle.
ELSE
IF (<SRC.ITEMID> < 60)
SRC.SYSMESSAGE It's a medium sized empty glass bottle, used in alchemy. It can be filled with water.
ELSE
IF (<SRC.ITEMID> < 90)
SRC.SYSMESSAGE This is a glass bottle, commonly used for alchemy. Alchemists would mix their reagents and some water inside this bottle to create a potion.
ELSE

[Image: 4_Logo.png]
An MMORPG based on the Ultima Online engine.
Completely Custom Map, GUI, AI, Combat, Skills, Crafts, Art, Music and so much more.
http://aetharia.com - Home of Ambition!
(This post was last modified: 07-21-2012 03:28 PM by Rayvolution.)
07-21-2012 03:25 PM
Find all posts by this user Like Post Quote this message in a reply
Gil Amarth
Journeyman
*

Posts: 189
Likes Given: 2
Likes Received: 1 in 1 posts
Joined: May 2012
Reputation: 0



Post: #2
RE: Trying to emulate skill advancement and override the original skill (almost) totally.
Another possibilty is give to all items a tevent like: e_ItemID_sysmessage
Putting TEVENTS = e_ItemID_sysmessage in the ITEMDEF definition, below TYPE, for example.

And later write a single file [TYPEDEF e_ItemUD_sysmessage], with all the descriptions, much cleaner in my opinion.

[TYPEDEF e_ItemUD_sysmessage]

ON=@DCLICK

IF (<DEFNAME> == i_bottle_medium_empty)
Your code
ELSEIF (<DEFNAME> == i_hammer_smith)
Your code
...
...
..
ENDIF

It´s still a colossal work, but you will have everything in a single file.
(This post was last modified: 07-21-2012 07:18 PM by Gil Amarth.)
07-21-2012 07:17 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: #3
RE: Trying to emulate skill advancement and override the original skill (almost) totally.
About the skillgain, there is the function

SKILLGAIN skill, difficulty

Invokes Sphere's skill gain for the specified skill, with the given difficulty (0-100)

I don't know if for difficulty, it means the skill value or the action's difficulty!
(This post was last modified: 07-22-2012 03:13 AM by darksun84.)
07-22-2012 03:13 AM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #4
RE: Trying to emulate skill advancement and override the original skill (almost) totally.
Your IF/ELSEIF/ELSE/ENDIF structure is wrong:
Code:
IF (<SRC.ITEMID> < 10)
SRC.SYSMESSAGE It's an empty glass bottle.
ELSEIF (<SRC.ITEMID> < 30)
SRC.SYSMESSAGE It's a medium sized empty glass bottle.
ELSEIF (<SRC.ITEMID> < 60)
SRC.SYSMESSAGE It's a medium sized empty glass bottle, used in alchemy. It can be filled with water.
ELSEIF (<SRC.ITEMID> < 90)
SRC.SYSMESSAGE This is a glass bottle, commonly used for alchemy. Alchemists would mix their reagents and some water inside this bottle to create a potion.
ELSE
//?
ENDIF

also, you should compare skill amounts by the tenth of a decimal point

Code:
if (<src.itemid> < 10) //1.0%,
elseif (<src.itemid> < 10.0) //10.0% <-- correct.
elseif (<src.itemid> < 100) //10.0%
endif

SKILLGAIN function was added in a while ago, it works like so:
Code:
skillgain <skill name/key> <difficulty to gain at>
example:
Code:
IF (<SRC.ITEMID> < 10)
SRC.SYSMESSAGE It's an empty glass bottle.
SRC.SKILLGAIN itemid 10.0 //skillgain at 10.0%, unless you meant 1.0%?
ELSEIF (<SRC.ITEMID> < 30)
SRC.SYSMESSAGE It's a medium sized empty glass bottle.
SRC.SKILLGAIN itemid 30.0
ELSEIF (<SRC.ITEMID> < 60)
SRC.SYSMESSAGE It's a medium sized empty glass bottle, used in alchemy. It can be filled with water.
SRC.SKILLGAIN itemid 60.0
ELSEIF (<SRC.ITEMID> < 90)
SRC.SYSMESSAGE This is a glass bottle, commonly used for alchemy. Alchemists would mix their reagents and some water inside this bottle to create a potion.
SRC.SKILLGAIN itemid 90.0
ELSE
//?
ENDIF

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
(This post was last modified: 07-22-2012 03:30 AM by Skul.)
07-22-2012 03:20 AM
Visit this user's website Find all posts by this user Like Post Quote this message in a reply
Rayvolution
Journeyman
*

Posts: 135
Likes Given: 0
Likes Received: 2 in 2 posts
Joined: Jul 2012
Reputation: 1

Aetharia

Post: #5
RE: Trying to emulate skill advancement and override the original skill (almost) totally.
Thanks, I'll give it a shot and see how it works when I get home. Smile

I knew my statements were all messed up, it was a sloppy job to test the concept. No where near a final product. Although I didn't notice I forgot my ENDIF, whoops!

I didn't realize sphere added a skillgain function, is this new in 56b? I don't remember having it in 55i. Although, I may of just never had a reason to use it.

[Image: 4_Logo.png]
An MMORPG based on the Ultima Online engine.
Completely Custom Map, GUI, AI, Combat, Skills, Crafts, Art, Music and so much more.
http://aetharia.com - Home of Ambition!
(This post was last modified: 07-22-2012 10:40 AM by Rayvolution.)
07-22-2012 10:38 AM
Find all posts by this user Like Post Quote this message in a reply
Skul
Master
**

Posts: 413
Likes Given: 0
Likes Received: 19 in 15 posts
Joined: Jun 2012
Reputation: 9



Post: #6
RE: Trying to emulate skill advancement and override the original skill (almost) totally.
skillgain is a new function, added during the 56b development.

"I ask a question to the answer I already know."

Marchadium :: http://www.marchadium.ca/ :: Join us!
07-22-2012 11:10 AM
Visit this user's website 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)