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

Weapon script help

NilssoN

¯\(º o)/¯
Joined
Jun 15, 2007
Messages
1,464
Reaction score
4
Location
tjaa
Hey.
I'm using Tfs 0.2 tha 8.21 version and I got some scripts from my old ot that i want to use but they wont work..
PHP:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_PHYSICALDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_STUN)
setCombatFormula(combat, COMBAT_FORMULA_SKILL , 0, 0, 0, 0)

local condition = createConditionObject(CONDITION_PARALYZE)
setConditionParam(condition, CONDITION_PARAM_TICKS, 5000)
setConditionParam(condition, CONDITION_PARAM_SPEED, -250)
setCombatCondition(combat, condition)

function onUseWeapon(cid, var)
if getPlayerLevel(cid) >= 100 then
doCombat(cid, combat, var)
else
doPlayerSendCancel(cid, 'You need level 100 to use this weapon.')
end
end
The problem is that you poff every hit :S
 
Wrong Fare-Fray

setCombatFormula(combat, COMBAT_FORMULA_SKILL, MIN_VALUE, MIN_PLUS_VALUE, MAX_VALUE, MAX_PLUS_VALUE)

setCombatFormula(combat, COMBAT_FORMULA_SKILL, -50, 0, MAX_VALUE, -100)
This one above will always hit between 50 and 100.

setCombatFormula(combat, COMBAT_FORMULA_SKILL, -1.2, -30, -1.6, -50)
The 1.2 will be multiplied with certain values (like the players level, mag level etc) and the 1.6 as well, and then the values will be randomized plus that it will always damage a random value between 30 and 50 damage.
 
o.0 I've tested with default weapons functions, and with
PHP:
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0, 0, 1.0, 0)

combat.cpp

Code:
case FORMULA_SKILL:
				{
					Item* tool = player->getWeapon();
					const Weapon* weapon = g_weapons->getWeapon(tool);
					
					min = (int32_t)minb;

					if(weapon)
					{
						max = (int32_t)(weapon->getWeaponDamage(player, target, tool, true) * maxa + maxb);
						if(params.useCharges && tool->hasCharges())
						{
							int32_t newCharge = std::max(0, tool->getItemCharge() - 1);
							g_game.transformItem(tool, tool->getID(), newCharge);
						}
					}
					else
						max = (int32_t)maxb;

					return true;
					break;
				}

maxa used here like %, so if I use 1.0, it's = 100% of damage.

Maybe I've wrong, but I found this more earlier then opened combat.cpp ) I tested and it's looks accurate.
 
I actually looked wrong, but however I think you need to but 1 on both mina and maxa? Otherwise it does between 0 and 1 :p
 
Back
Top