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

Attack Damage/Attack Speed on Bow/Crossbow

Advent

Custom RPG Maker
Joined
Oct 3, 2009
Messages
306
Reaction score
7
Hello, I made script which changes attack speed on item upgrade and stuff but it does not work on bow type weapon. I want to somehow make bow change attackspeed as well. It can be other weapon or wrote in other style but it shall take ammunition and require ammunition to shoot. How is it possible ?

Lets say that I am using /attr set attackspeed 500 on Sword and its attacking really fast but after I use it on bow, nothing happens. Please help, show me way to do this. I am going to keep on researching and looking for solution but if you know how I can do it then please tell me in this thread.

I thought about something like creating script for this weapon but treating it as normal weapon (assassin star without stacks ?) which is going to make animation of shooting arrows and keeps on taking arrows from backpack/arrow place and if you do not have arrows, it doesnt shot. Can you help ?
 
the attackspeed of the bow depends on the arrows. since it takes the damage from the arrows, it also takes the attackspeed from the arrows.
A way you can do is by using "onEquip" with the arrows, and automatically set thier attackspeed to what the bow has.
 
I thought about something like creating script for this weapon but treating it as normal weapon (assassin star without stacks ?) which is going to make animation of shooting arrows and keeps on taking arrows from backpack/arrow place and if you do not have arrows, it doesnt shot. Can you help ? I changed some things that it doesnt take arrows and attack speed works but damage is same, is there something to edit or I have to create new item ID to make it work ?
 
AttackSpeed will not affect distance weapons what require ammunition!
But you may change attack speed of arrows/bolt.
 
I don't want to make it use ammunition in items.xml

I want to make it way that its normal weapons but distance (this way attack speed works) which shoot with arrows (only normal ones) but which shoots only if you have arrows and if it shoot, it takes arrows but it doesnt take attack or attack speed from arrows. Also when I am changing with /attr set attack then attack for this weapon changes but ... damage is not changing zzz

Any idea ?
 
Because I am using Upgrade System and I want to make it even for every player for every weapon type. If you know what I mean my friend.
 
Just change 2544 to your ammunition id.

Lua:
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_DISTANCEEFFECT, CONST_ANI_ARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)

function onUseWeapon(cid, var)
	if getPlayerSlotItem(cid, 10).itemid == 2544 then
		doRemoveItem(getPlayerSlotItem(cid, 10).uid, 1)
		doCombat(cid, combat, var)
	else
		doPlayerSendCancel(cid, 'You need arrows to use this weapon.')
	end
end
 
Thank you very much ! Do you know anything I can do with Attack Damage on Bow ? I would be really happy to get feedback about it as well. If its in C++ then if you can show where I have to edit it then its not a problem as well.
 
Thank you very much ! Do you know anything I can do with Attack Damage on Bow ? I would be really happy to get feedback about it as well. If its in C++ then if you can show where I have to edit it then its not a problem as well.

You don't really need Source Edit for that, just add the damage to the actual weapon on items.xml.

XML:
<item id="XXXX" article="a" name="name bow">
		<attribute key="weight" value="3100"/>
		<attribute key="range" value="5"/>
		<attribute key="attack" value="70"/>
          	<attribute key="attackspeed" value="1000"/>
		<attribute key="weaponType" value="distance"/>
		<attribute key="hitChance" value="100"/>
</item>
 
Last edited:
It doesn't work. If it would be easy like this then I wouldn't even ask about help. Thing is that yes, attack can be set in items.xml but when i change it by command /attr set attack 999999 it does change attack of weapon but damage is same. Can someone give any idea how to change it ? I really need help in this. I will try later to do something about it but I don't really know where start except looking into item attribute sequence in source.

- - - Updated - - -

91809119387273963276.png
 

Attachments

  • 91809119387273963276.jpg
    91809119387273963276.jpg
    10.9 KB · Views: 44 · VirusTotal
Last edited:
It doesn't work. If it would be easy like this then I wouldn't even ask about help. Thing is that yes, attack can be set in items.xml but when i change it by command /attr set attack 999999 it does change attack of weapon but damage is same. Can someone give any idea how to change it ? I really need help in this. I will try later to do something about it but I don't really know where start except looking into item attribute sequence in source.

- - - Updated - - -

91809119387273963276.png

But thats the edited bow? or the default one?
Post your piece of code of items.xml (just for the bow)
 
items.xml

XML:
<item id="2456" article="a" name="bow">
		<attribute key="weight" value="3100"/>
		<attribute key="range" value="6"/>
		<attribute key="attack" value="20"/>
        <attribute key="attackspeed" value="4000"/>
		<attribute key="weaponType" value="distance"/>
		<attribute key="hitChance" value="30"/>
	</item>

weapons.xml

XML:
<distance id="2456" event="script" value="bow.lua"/>

bow.lua

Lua:
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_DISTANCEEFFECT, CONST_ANI_ARROW)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 1, 0, 1, 0)
 
function onUseWeapon(cid, var)
	if getPlayerSlotItem(cid, 10).itemid == 2544 then
		doRemoveItem(getPlayerSlotItem(cid, 10).uid, 1)
		doCombat(cid, combat, var)
	else
		doPlayerSendCancel(cid, 'You need arrows to use this weapon.')
	end
end

Here you are.
 
So, I tried to add more DMG to the edited bow and isn't working... Why? Because don't have the ammoType attribute...

Add this on the items.xml
XML:
<attribute key="ammoType" value="arrow"/>
Is working on TFS 0.3.7 at least...

@EDIT: The script is not even needed... lol
 
Last edited:
Back
Top