Language: 
To browser these website, it's necessary to store cookies on your computer.
The cookies contain no personal information, they are required for program control.
  the storage of cookies while browsing this website, on Login and Register.

Author Topic:  lua function SetSkill()  (Read 128 times)

0 Members and 0 Guests are viewing this topic.

Dolfo

« on: 18, December 2021, 17:45:02 »
Damn it's like searching the whole world for a piece of answer.

In relation to daimonin_object.c line 1300 in src/plugin_lua or this topic

https://www.daimonin.org/11609/core-lua-methodobjectsetskill/msg103871/#msg103871

there is a limitation in this function. First you can only go 1 level up or down, but that's not the problem. Script has a build in protection for indirect skill.

line 1472 daimonin_object.c
Code: [Select]
/* If ->item_level == ->level, this means it has already gained
 * some experience via a script this level so the player will
 * have to go back to normal grinding for experience until next
 * level. This prevents scripts being exploited too much to
 * gain mega-levels. Return 4, skill, 0, 0. */
 if (skill->item_level == skill->level &&
 (level > 0 || (level == 0 && exp > 0)))
 {
  failure = 4;
  level = exp = 0;
}

Why this? No normal player can start this script. Only a mapper or a scripter can do this. And only dev-team can implement maps or scripts on your servers. So with lua-script i currently didn't see a way to increase levels on indirect skill without this limitation?

I can also use GetSkill() to gain read access, but there is no other way than SetSkill() for write access.

local sobj = pl:GetSkill(game.TYPE_SKILL, skill_sling)

So i can read obj.experience, but can't write.

Writing obj.experience is unreachable from script level, except this one function? Currently i see no way to increase an indirect level only by lua script, without this strange blocking behavior. :o

Other way is to remove this block an recompile plugin_lua.
« Last Edit: 18, December 2021, 18:10:37 by Dolfo »
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Dolfo

« Reply #1 on: 20, December 2021, 22:56:35 »
I removed this block and recompiled it. Ok i used a fast ugly fix, more for testing this.  :P
Code: [Select]
if (0)
 // if (skill->item_level == skill->level &&
 // (level > 0 || (level == 0 && exp > 0)))
 {
  failure = 4;
  level = exp = 0;
}
Don't believe the shit, you hear in mainstream. Believe your own body. Your body is speaking always the true to you. But you need to understand your body. Hear to your body, not to your ego. And when body is calling to you: "Hey something is wrong!" find the reason(s) for that. Man in White don't go for that, they don't want to heal you. They want earn money and sell you medicine, you should take rest of your life. You are not the patient, you are their customer. Never forget this!

Tags:
 

Related Topics

  Subject / Started by Replies Last post
19 Replies
6663 Views
Last post 25, June 2009, 00:01:00
by grommit
8 Replies
20195 Views
Last post 24, October 2012, 15:57:13
by clobber
0 Replies
10841 Views
Last post 30, September 2013, 18:46:21
by smacky
5 Replies
3151 Views
Last post 07, March 2014, 15:06:04
by smacky
10 Replies
167 Views
Last post 01, September 2023, 11:32:20
by Shroud