• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Lua Custom Server

  • Thread starter Thread starter varhlak
  • Start date Start date
V

varhlak

Guest
Hey, i wanted to make a totally custom server, and I'm just wondering..

Is there a way to make a weapon hit SPECIFIC ?

Lets say, 1700 - 1900 WITHOUT making a specific script for this weapon?
I know about 90% about scripting, but haven't really moved to 8.6 that much.
So, is there a way to set up a weapons damage to specific amount, without making a script for it (I know it works for staffs, not sure about meele and distance) ... ?

Thanks.

(asking only because I'd have to make around 45 scripts in total ... )
 
Staffs value are set up in data/xml/weapons.xml. Their stats are in Items.xml I believe. Everything must be scripted, otherwise it would have no effect...

You might want to learn more about... percentages :)

Have fun!
 
I dont think you got me right there. What i mean is, I just wanted to know if theres a different way to get a meele/distance weapon to hit with SPECIFIC damage (lets say 1700-1900) and nothing else WITHOUT making a proper script.

(something like wands)

<wand id="2185" level="19" mana="5" min="27" max="33" type="death" event="function" value="default">

BUT

<melee id="7407" level="30" min="1700" max="1900" unproperly="1" event="function" value="default"> <---- is it possible to do something like this?
 
It can't be done in pure xml. Why? Wands are specific weapons, therefore they can only make use from "min" & "max" parameters. So, the only way to ignore calculations that are by default performed in sources for weapons is to create a custom lua script for that purpose. There's no other option.

Hope I answered your question.

@edit
Obviously there is no thing that can't be done in sources :P Was just referring to the OP question.
 
Last edited:
It can't be done in pure xml. Why? Wands are specific weapons, therefore they can only make use from "min" & "max" parameters. So, the only way to ignore calculations that are by default performed in sources for weapons is to create a custom lua script for that purpose. There's no other option.

Hope I answered your question.

I think it can be changed in sources too, im right? ;p, But needs a good programmer ;o
 
well the function you mentioned should work well
LUA:
doTargetCombatHealth(0,target,COMBAT_PHYSICALDAMAGE,-100,-500,CONST_ME_DRAWBLOOD)
 
but wait...

so how would the script look in this situation ? :

LUA:
function onUseWeapon(cid, var, item)
doCombat(cid, combat, var)
doCombat(cid, combat, var)
return doCombat(cid, combat, var)
end

LUA:
function onUseWeapon(cid, var, item)
doTargetCombatHealth(0,target,COMBAT_PHYSICALDAMAGE,-100,-500,CONST_ME_DRAWBLOOD)
doCombat(cid, combat, var)
doCombat(cid, combat, var)
return doCombat(cid, combat, var)
end

Or... like this :

LUA:
function onUseWeapon(cid, var, item)
doTargetCombatHealth(0,target,COMBAT_PHYSICALDAMAGE,-1700,-1900,CONST_ME_DRAWBLOOD)
doTargetCombatHealth(cid, target, type, min, max, effect)
doTargetCombatHealth(cid, target, type, min, max, effect)
return doTargetCombatHealth(cid, target, type, min, max, effect)
end

just added my damage and actually thought for a second :P
 
Hey,

if you are using a 0.4 TFS, there is actually a way to do it in XML. Not purely, but with scripting buffer.
As an example I will take.. your example :)

Code:
<melee id="7407" level="30" unproperly="1" event="buffer"><![CDATA[
	if(var.type == 1) then
		_result = doTargetCombatHealth(cid, var.number, COMBAT_PHYSICALDAMAGE, -1700, -1900, CONST_ME_DRAWBLOOD)
	end
]]></melee>

Enjoy! You can use it for any weapon, even distance.
 
Yes, works! But.. with limitations. Works flawless with melee weapons, ALTHOUGH ...

You can use it for any weapon, even distance.

Not really, when you do it as

LUA:
<distance id ="xxxx" level="xxx" unproperly="x">

It yea, attacks from distance, as nothing, you basically dont throw/attack, the monster just gets hit, by nothing <_<

Is there a change in the script to do it like theres a flying spear or something?
 
Last edited by a moderator:
doSendDistanceShoot perhaps?

LUA:
<melee id="7407" level="30" unproperly="1" event="buffer"><![CDATA[
	if(var.type == 1) then
		_result = doTargetCombatHealth(cid, var.number, COMBAT_PHYSICALDAMAGE, -1700, -1900, CONST_ME_DRAWBLOOD)
	end
]]></melee>

for this script? I just want it to attack with spears/arrows, not physical. Well physical, but with a different 'flying' effect.
 
Back
Top