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

ViperStar

richux

Tibera.org
Joined
Aug 18, 2008
Messages
3,666
Reaction score
26
Location
---------
I would like to set minimum and maximum damage in values for viper star and it should always hit the target. I tried lot of ways trough items.xml, even took examples from spell .lua files and tried to add them here, but I still don't understand how to make it work. Problem with this one is that it use too random, it doesn't hit the target lot of times, but than suddenly can hit 1k damage per hit:

Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1.5, 600, 2.3, 900)


local xCombat = createCombatObject()
setCombatParam(xCombat, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)

local condition = createConditionObject(CONDITION_POISON)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 4, 2000, -2)
addDamageCondition(condition, 6, 2000, -1)
setCombatCondition(xCombat, condition)

function onUseWeapon(cid, var)
	local ret = doCombat(cid, combat, var)
	if(ret == false) then
		return false
	end

	local target = variantToNumber(var)
	if(target ~= 0) then
		-- chance to poison the enemy
		local chance = math.random(0, 100)
		if(chance > 90) then
			ret = doCombat(cid, xCombat, var)
		end
	end
	return ret
end
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR)

function getDamage(cid, weaponSkill, weaponAttack)
	return -250, -1000
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getDamage")

local xCombat = createCombatObject()
setCombatParam(xCombat, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)

local condition = createConditionObject(CONDITION_POISON)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 4, 2000, -2)
addDamageCondition(condition, 6, 2000, -1)
setCombatCondition(xCombat, condition)

function onUseWeapon(cid, var)
	local ret = doCombat(cid, combat, var)
	if(ret == false) then
			return false
	end

	local target = variantToNumber(var)
	if(target ~= 0) then
			-- chance to poison the enemy
			local chance = math.random(0, 100)
			if(chance > 90) then
					ret = doCombat(cid, xCombat, var)
			end
	end
	return ret
end
:S
 
It don't hit when misses, and 1k hits are because of this 600(added to minimum) and 900(added to maximum)
you should use this scrpit
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)

local condition = createConditionObject(CONDITION_POISON)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 10, 2000, -1)
setCombatCondition(combat, condition)

function onUseWeapon(cid, var)
	return doCombat(cid, combat, var)
end
Hit chance in items is only MAXIMUM hit chance, depending on skill and how far target is.
Dmg is just like other weapons, it should hit the same as sword with same attack if skills are the same.
<attribute key="attack" value="33"/>
<attribute key="hitChance" value="80"/>

EDIT:when I started writing there was no reply ;f
 
Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_GREENSTAR)

function getDamage(cid, weaponSkill, weaponAttack)
	return -250, -1000
end

setCombatCallback(combat, CALLBACK_PARAM_SKILLVALUE, "getDamage")

local xCombat = createCombatObject()
setCombatParam(xCombat, COMBAT_PARAM_TYPE, COMBAT_EARTHDAMAGE)

local condition = createConditionObject(CONDITION_POISON)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 4, 2000, -2)
addDamageCondition(condition, 6, 2000, -1)
setCombatCondition(xCombat, condition)

function onUseWeapon(cid, var)
	local ret = doCombat(cid, combat, var)
	if(ret == false) then
			return false
	end

	local target = variantToNumber(var)
	if(target ~= 0) then
			-- chance to poison the enemy
			local chance = math.random(0, 100)
			if(chance > 90) then
					ret = doCombat(cid, xCombat, var)
			end
	end
	return ret
end
:S

Yes, it worked. How did you know it?




It don't hit when misses, and 1k hits are because of this 600(added to minimum) and 900(added to maximum)
you should use this scrpit
Lua:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_POISONDAMAGE)
setCombatParam(combat, COMBAT_PARAM_DISTANCEEFFECT, CONST_ANI_POISONARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)

local condition = createConditionObject(CONDITION_POISON)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 10, 2000, -1)
setCombatCondition(combat, condition)

function onUseWeapon(cid, var)
	return doCombat(cid, combat, var)
end
Hit chance in items is only MAXIMUM hit chance, depending on skill and how far target is.
Dmg is just like other weapons, it should hit the same as sword with same attack if skills are the same.
<attribute key="attack" value="33"/>
<attribute key="hitChance" value="80"/>

EDIT:when I started writing there was no reply ;f


Yeah, but I wanted to declare it with values, besides even with:

Code:
<attribute key="hitChance" value="100"/>

it missed lot of hits and:

Code:
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)

are multipliers, so it's not possible to declare exact damage I want.


ty guys, repped both of you.
 
Are any of the skills higher than what they should be for that vocation? My server used to crash because I had like m lvl 100 on a knight and I attacked.
 
@Topic,

First:
You have a really strong attack.
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1.5, 600, 2.3, 900)

Should be something like this.
Lua:
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1.4, 100, 1,8, 200)

Second:
The formula is really random.
local math.random(0, 100)

Maybe try:
Lua:
local math.random(1, 10)

I hope this helps some...
I don't know exactly how to assist you with this. :wub:
 
Back
Top