• 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!

onLogin adding bonuses.

kito2

www.masteria.net
Joined
Mar 9, 2009
Messages
3,764
Solutions
1
Reaction score
227
Location
Chile, Santiago
Hi there, I want a script that when you log in, it checks a condition, and if it so, then it adds speed, hp recovery, mp recovery, ml, skills and % absorb.

Also it needs a logOut/prepareDeath/onDeath? part that removes bonuses.

To get an idea on how it works: http://otland.net/f82/addon-bonus-system-67961/

I tried to do it by myself, but couldn't.
 
When login check a storage value, if the player has it at 1, then it gives to the player extra speed, more ml, more skills, more hp, more mp, more hp recovery, more mp recovery.
 
When login check a storage value, if the player has it at 1, then it gives to the player extra speed, more ml, more skills, more hp, more mp, more hp recovery, more mp recovery.

I've been see you for many time asking for script and you still don't learn? :S
 
That's the easy part... The hard part is the "script" that you mentioned above... I don't know the functions to add speed, hp, mp, recovery hp, recovery mp, ml, skills...
 
That's the easy part... The hard part is the "script" that you mentioned above... I don't know the functions to add speed, hp, mp, recovery hp, recovery mp, ml, skills...

LUA:
doChangeSpeed(cid, delta) --change the creature speed
doCreatureAddHealth(cid, health) -- add player healths (to remove, use negative values)
doCreatureAddMana(cid, mana) --same as doCreatureAddHealth
doCreatureSetMaxHealth(cid, health) --set the creature max health
doCreatureSetMaxMana(cid, mana) --same as doCreatureSetMaxHealth
doPlayerAddSkill(cid, skill, value) --to add skill, check constant.lua to see the skill type.
 
Last edited:
I need the entire script :S

LUA:
function onLogin(cid)
	if getPlayerStorage (cid, value) ==  value then
		doChangeSpeed(cid, delta) --change the creature speed
		doCreatureSetMaxHealth(cid, health) --set the creature max health
		doCreatureSetMaxMana(cid, mana) --same as doCreatureSetMaxHealth
		doPlayerAddSkill(cid, skill, value2) --to add skill, check constant.lua to see the skill type.
		-- recovery hp/mp part
	end
end

LUA:
function onPrepareDeath(cid)
	local speed = getCreatureSpeed(cid) - value
	local hp = getCreatureMaxHealth(cid) - health
	local mp = getCreatureMaxMana(cid) - mana
	local skill1 = getPlayerSkillLevel(cid, skillid) - value2
	...
	
	if getPlayerStorage (cid, value) ==  value then
		doChangeSpeed(cid, speed) 
		doCreatureSetMaxHealth(cid, hp) 
		doCreatureSetMaxMana(cid, mp) 
		doPlayerAddSkill(cid, skillid, skill1) 	
	end
end
 
I bet using conditions instead of those functions dark suggested would work better and more efficient
 
speed
LUA:
local speed = createConditionObject(CONDITION_HASTE)
setConditionParam(speed, CONDITION_PARAM_TICKS, -1)
setConditionParam(speed, CONDITION_PARAM_SPEED, 10)

hp recovery
LUA:
local health = createConditionObject(CONDITION_REGENERATION)
setConditionParam(health, CONDITION_PARAM_TICKS, -1)
setConditionParam(health, CONDITION_PARAM_HEALTHGAIN, 20)
setConditionParam(health, CONDITION_PARAM_HEALTHTICKS, 2000)

mana recovery
LUA:
local mana = createConditionObject(CONDITION_REGENERATION)
setConditionParam(mana, CONDITION_PARAM_TICKS, -1)
setConditionParam(mana, CONDITION_PARAM_MANAGAIN, 20)
setConditionParam(mana, CONDITION_PARAM_MANTICKS, 2000)

ml
LUA:
local magic = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(magic, CONDITION_PARAM_TICKS, -1)
setConditionParam(magic, CONDITION_PARAM_STAT_MAGICLEVEL, 2)

skills
LUA:
local skill = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(skill, CONDITION_PARAM_TICKS, -1)
for i = 19, 26 do
    setConditionParam(skill, i, 3)
end
or
LUA:
local skill = createConditionObject(CONDITION_ATTRIBUTES)
setConditionParam(skill, CONDITION_PARAM_SKILL_MELEE, 3)
setConditionParam(skill, CONDITION_PARAM_SKILL_FIST, 3)
setConditionParam(skill, CONDITION_PARAM_SKILL_CLUB, 3)
setConditionParam(skill, CONDITION_PARAM_SKILL_SWORD, 3)
setConditionParam(skill, CONDITION_PARAM_SKILL_AXE, 3)
setConditionParam(skill, CONDITION_PARAM_SKILL_DISTANCE, 3)
setConditionParam(skill, CONDITION_PARAM_SKILL_SHIELD, 3)
setConditionParam(skill, CONDITION_PARAM_SKILL_FISHING, 3)

then use at login script
LUA:
doAddCondition(cid, condition)
 
Back
Top