Boynaar44 Posted November 18, 2012 Author Share Posted November 18, 2012 Hello guys,This is requested by Zzbrandon, very nicely so I couldn't say no ![;)](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/wink.png)As the title says, you will be able to customize the attack speed of the NPC after this tutorial.At least, there is still the random and protection system running, so don't expect to get an attack 10 times each second.I have seen a tutorial for custom NPC movement speed by Growlith1223 where he used the variable name "Speed", so we will be using "AttackSpeed" in case you have both.We start adding a Scrollbar and a Label in the frmEditor_NPC.Name them as following._Label –>_ **lblAttackSpeed**_Scrollbar_ –> **scrlAttackSpeed**Change the following values of the property variables for **scrlAttackSpeed** to the values next to them._Max_ –> **30000**_Min_ –> **100**_LargeChange_ –> **100**Now add the following variable to the **Type NpcRec** inside the **modTypes**, **Server and Client side.**```AttackSpeed As Integer```Go back to the Client.Double click the **scrlAttackSpeed** and you should end up on the sub **scrlAttackSpeed_Change**.There add the following code.```Dim intSpeed As IntegerDim dblValue As Double' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerintSpeed = scrlAttackSpeed.ValueNpc(EditorIndex).AttackSpeed = intSpeedIf intSpeed >= 100 And intSpeed <= 1000 ThendblValue = Round(1000 / intSpeed, 3)lblAttackSpeed.Caption = "Attack speed: " & dblValue & " attack(s) per 1 second."ElseIf intSpeed > 1000 ThendblValue = intSpeed / 1000lblAttackSpeed.Caption = "Attack speed: 1 attack per " & dblValue & " second(s)."Else' lblAttackSpeed.Caption = "Attack speed: " & intSpeedEnd If' Error handlerExit Suberrorhandler:HandleError "scrlAttackSpeed_Change", "frmEditor_NPC", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit Sub```Go to the sub **NpcEditorInit** inside **modGameEditors**.**Add** there **inside** the **with-statement** the following line.```If Npc(EditorIndex).AttackSpeed >= .scrlAttackSpeed.Min And Npc(EditorIndex).AttackSpeed <= .scrlAttackSpeed.Max Then.scrlAttackSpeed.Value = Npc(EditorIndex).AttackSpeedEnd if```Now the easier part.Find and **remove** the following line from the sub **BltNpc** inside your **modDirectDraw7**.```AttackSpeed = 1000```Place instead of it the following.```If Npc(MapNpc(MapNpcNum).num).AttackSpeed > 0 ThenAttackSpeed = Npc(MapNpc(MapNpcNum).num).AttackSpeedElseAttackSpeed = 1000End If```Now we go **Server side**.Find the following if-statement and **remove** it from your **CanNpcAttackPlayer** sub inside **modCombat**.```' Make sure npcs dont attack more then once a secondIf GetTickCount < MapNpc(mapNum).Npc(mapNpcNum).AttackTimer + 1000 Then Exit FunctionEnd If```Now place instead of it the following.```If Npc(MapNpc(mapNum).Npc(mapNpcNum).Num).AttackSpeed > 0 ThenIf GetTickCount < MapNpc(mapNum).Npc(mapNpcNum).AttackTimer + Npc(MapNpc(mapNum).Npc(mapNpcNum).Num).AttackSpeed Then Exit FunctionEnd IfElseIf GetTickCount < MapNpc(mapNum).Npc(mapNpcNum).AttackTimer + 1000 Then Exit FunctionEnd IfEnd If```That's all I believe…[edit]I am sorry the code is not oriented, that's because of too many edits..[/edit] Link to comment Share on other sites More sharing options...
Greendude120 Posted November 18, 2012 Share Posted November 18, 2012 Great one. Ill be trying this soon. Link to comment Share on other sites More sharing options...
Zzbrandon Posted November 18, 2012 Share Posted November 18, 2012 this works with dragon eclipse also woot Link to comment Share on other sites More sharing options...
lel Posted November 19, 2012 Share Posted November 19, 2012 I have a system set up where NPC's attack multiple times in a row, so I wonder if this will work with mine o.oIf only I had the time to play with it…. tsssss heehee ... Link to comment Share on other sites More sharing options...
Wortel Angels Posted December 16, 2012 Share Posted December 16, 2012 Nice Tutorial works better than the one from Growlith1223 ;-)But your timing is not exact…If you set the attack speed to the first thing whats possible 30 Attacks in 1 secondAnd the truth is-> 2 1/2 attack / second Link to comment Share on other sites More sharing options...
Ganjika Posted December 20, 2012 Share Posted December 20, 2012 What do i put in a Dx8 version where the tutorial says:> Now the easier part.> > Find and **remove** the following line from the sub **BltNpc** inside your **modDirectDraw7**.> > AttackSpeed = 1000> > Place instead of it the following.> > If Npc(MapNpc(MapNpcNum).num).AttackSpeed > 0 Then> > AttackSpeed = Npc(MapNpc(MapNpcNum).num).AttackSpeed> > Else> > AttackSpeed = 1000> > End If Link to comment Share on other sites More sharing options...
Wortel Angels Posted December 20, 2012 Share Posted December 20, 2012 the same its just not bltnpcits drawnpc Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now