• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Windows New vocation Bug

juansanchez

Advanced OT User
Joined
Apr 2, 2015
Messages
223
Reaction score
151
Hey people, i'm having a problem with a new vocation in my server, and i was wondering if someone could help me.
I created this new vocation, and in my server players are allowed to buy skills.
This new vocation uses fist as it main skill. And also uses 2 weapons (which i'm not being able to make it work, i can only use 1 weapon, can anyone help me with this as well?)

I made the script for skill fist, nice and clean like so:

if(param == "skillfist") then
if getPlayerSkillLevel(cid, SKILL_FIST) >= 350 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
return TRUE
end
if not isKnocker(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Knockers podem comprar skill de fist.")
return TRUE
end
if getPlayerItemCount(cid, 9971) >= 1 then
if getCreatureCondition (cid, CONDITION_ATTRIBUTES) == FALSE then
local pid = getPlayerGUID(cid)
local fist = getPlayerSkillLevel(cid, SKILL_FIST)
doPlayerRemoveItem(cid, 9971, 1)
setPlayerStorageValue(cid,11548,os.time()+0)
doRemoveCreature(cid)
db.executeQuery("UPDATE `player_skills` SET `value` = " .. (fist + 1) .. ", `count` = 0 WHERE `skillid` = 1 and `player_id` = " .. pid .. ";")
return TRUE
else
doPlayerSendCancel (cid, "Voce nao pode ter nem uma magia ativa para comprar skills.")
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
return TRUE
end
end

But whenever i try to buy the skill, this happends:
[19:19:08.583] [Error - TalkAction Interface]
[19:19:08.584] data/talkactions/scripts/comprar.lua:onSay
[19:19:08.585] Description:
[19:19:08.585] data/talkactions/scripts/comprar.lua:392: attempt to call global
'isKnocker' (a nil value)
[19:19:08.586] stack traceback:
[19:19:08.587] data/talkactions/scripts/comprar.lua:392: in function <data/talk
actions/scripts/comprar.lua:1>

As if it doesn't recognize the new vocation.
Can anyone help me?

I'm using TFS 0.4
 
Add the new vocation to lib/031-vocations

Oh yeah, now it worked, thanks :)

Btw, could you help me with 2 more things? xD
First, is there a way to make it so i can use 2 items? Like, 2 swords, 2 axes. And also, for some reason, the skill fist is not going up.

Edit: About the skill going up, whenever in vocation.xml, i use <skill id="0" multiplier="1.1"/> higher than 1.1, the skill bugs, and makes the server crash.
 
Last edited:
Hey people, i'm having a problem with a new vocation in my server, and i was wondering if someone could help me.
I created this new vocation, and in my server players are allowed to buy skills.
This new vocation uses fist as it main skill. And also uses 2 weapons (which i'm not being able to make it work, i can only use 1 weapon, can anyone help me with this as well?)

I made the script for skill fist, nice and clean like so:



But whenever i try to buy the skill, this happends:


As if it doesn't recognize the new vocation.
Can anyone help me?

I'm using TFS 0.4

You are trying to call "isKnocker" and it has a nil value. I'm guessing this function should check if the player is a certain vocation so put this on your "data\lib\050-function.lua"

Code:
KNOCKER_VOCATIONID = XXX
function isKnocker(cid)
    if isPlayer(cid) and getPlayerVocation(cid) == KNOCKER_VOCATIONID then
       return true
    end
end

Change "xxx" for the vocation id of this new vocation.

Edit: Nvm @Sheenita answered :p
 
You are trying to call "isKnocker" and it has a nil value. I'm guessing this function should check if the player is a certain vocation so put this on your "data\lib\050-function.lua"

Code:
KNOCKER_VOCATIONID = XXX
function isKnocker(cid)
    if isPlayer(cid) and getPlayerVocation(cid) == KNOCKER_VOCATIONID then
       return true
    end
end

Change "xxx" for the vocation id of this new vocation.

Edit: Nvm @Sheenita answered :p

Yup, thanks anyways ;D
 
Try this:
Code:
if(param == "skillfist") then
if getPlayerSkillLevel(cid, SKILL_FIST) >= 350 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
return TRUE
end
if not isKnocker(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Knockers podem comprar skill de fist.")
return TRUE
end
if getPlayerItemCount(cid, 9971) >= 1 then
if getCreatureCondition (cid, CONDITION_ATTRIBUTES) == FALSE then
local pid = getPlayerGUID(cid)
local fist = 1
doPlayerRemoveItem(cid, 9971, 1)
setPlayerStorageValue(cid,11548,os.time()+0)
doRemoveCreature(cid)
db.executeQuery("UPDATE `player_skills` SET `value` = `value` + "..fist.." ,`count` = 0 WHERE `skillid` = 1 and `player_id` = " .. pid .. ";")
return TRUE
else
doPlayerSendCancel (cid, "Voce nao pode ter nem uma magia ativa para comprar skills.")
end 
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
return TRUE
end
end

About the weapons, you can use this attribute in items <attribute key="dualWield" value="1"/>
 
Try this:
Code:
if(param == "skillfist") then
if getPlayerSkillLevel(cid, SKILL_FIST) >= 350 then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não pode ter skill acima de 350.")
return TRUE
end
if not isKnocker(cid) then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Somente Knockers podem comprar skill de fist.")
return TRUE
end
if getPlayerItemCount(cid, 9971) >= 1 then
if getCreatureCondition (cid, CONDITION_ATTRIBUTES) == FALSE then
local pid = getPlayerGUID(cid)
local fist = 1
doPlayerRemoveItem(cid, 9971, 1)
setPlayerStorageValue(cid,11548,os.time()+0)
doRemoveCreature(cid)
db.executeQuery("UPDATE `player_skills` SET `value` = `value` + "..fist.." ,`count` = 0 WHERE `skillid` = 1 and `player_id` = " .. pid .. ";")
return TRUE
else
doPlayerSendCancel (cid, "Voce nao pode ter nem uma magia ativa para comprar skills.")
end
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Você não possui a quantidade necessária para comprar.")
return TRUE
end
end

About the weapons, you can use this attribute in items <attribute key="dualWield" value="1"/>


Thanks! The dual wield attribute worked, but i still need to fix the problem about the skill, is not with the script, it's with the vocations.xml, for some reason it bugs whenever it's like, above 300 the skill. If i buy skill, and it's 300. The next hit with skill 300, the server crashes, and when i come back the skill it's like 380, 400+, unless i use the skill multiplier = 1.1, above 1.1 it crashes.
 
Thanks! The dual wield attribute worked, but i still need to fix the problem about the skill, is not with the script, it's with the vocations.xml, for some reason it bugs whenever it's like, above 300 the skill. If i buy skill, and it's 300. The next hit with skill 300, the server crashes, and when i come back the skill it's like 380, 400+, unless i use the skill multiplier = 1.1, above 1.1 it crashes.

Because you're using too much skills and it may require c++ edit.
 
Because you're using too much skills and it may require c++ edit.

Let me just ask you something, i used the Dual Wield thing you told me, but for some reason, when i use 2 weapons the player hits waay faster... It's like his attack speed increases, you kArnow anything about it?

Obs: Are you brazilian?
 
Back
Top