tehl33tjim Posted March 25, 2013 Author Share Posted March 25, 2013 Hey guys, so I'm having a bit of trouble with the syntax of putting this code together. Or perhaps my logic is not the most efficient way of doing this.The concept is simple: Add a new attribute for weapons that would be considered an "element". Add those same attributes to NPCs. During combat, it would check to see if player(index).weapon.element.fire (or whatever) is true, then damage = damage x 2, else damage = damage.First off, I went Server Side:ModTypes - under ItemRec, below "ToolReq as Long" I added "Element as Long". From my understanding, this will store data as Item(index).Element, correct?-under NpcRec, below "Level as Long", I added "Element as Long" again.I repeated this in the Client's ModTypes as well.Now is where I'm lost with syntax. In FrmEditor_Item, I added a scrollbar (scrlElement), min=0, max=5 (for starters, maybe I'll add more elements later), I set up a label next to it so it will display the scrollbar value.I did the same thing in FrmEditor_NPC with a scrollbar and label.```Private Sub scrlElement_Change()' If debug mode, handle error then exit outIf Options.Debug = 1 Then On Error GoTo errorhandlerIf EditorIndex = 0 Or EditorIndex > MAX_ITEMS Then Exit SubIf scrlElement.Value = 0 ThenlblElement.Caption = "E: None"ElseIf scrlElement.Value = 1 ThenlblElement.Caption = "E: Fire"ElseIf scrlElement.Value = 2 ThenlblElement.Caption = "E: Ice"ElseIf scrlElement.Value = 3 ThenlblElement.Caption = "E: Bolt"ElseIf scrlElement.Value = 4 ThenlblElement.Caption = "E: Holy"ElseIf scrlElement.Value = 5 ThenlblElement.Caption = "E: Dark"End If' Error handlerExit Suberrorhandler:HandleError "scrlElement_Change", "frmEditor_Item", Err.Number, Err.Description, Err.Source, Err.HelpContextErr.ClearExit SubEnd Sub```From what I can tell, this doesn't change anything in the ItemRec's Element - so how can I do that? AND, what would be the proper syntax of calling that variable again ServerSide under the ModCombat module?Would it just be GetItem(index).Element? I think I'm going in the right direction, but a little foggy.I have added Item(EditorIndex).Element = scrlElement.Value - and it compiled with no errors. I'm still having trouble figuring out how exactly do I call that data in ModCombat.```GetPlayerEquipment(index, equipment).element = 3```I think that is correct - but I am having difficulty with grabbing the NPC(index).Element…do I need to add an Element long variable under the MapNpcRec as well? Link to comment Share on other sites More sharing options...
abhi2011 Posted March 25, 2013 Share Posted March 25, 2013 So till now what you did is correct. Now when the the editor is loaded up or a another item is selected you will have to change the data appropriately in the editor. So in modGameEditors in itemEditorInit and NPCEditorInit add this line of code. This might change to what you are using but the structure is the same.```frmEditor_item.scrlElement.value = .element' NPCEDITORINITfrmEditor_NPC.scrlElement.value = .element```VB will do the rest of changing the label.Now for the modCombat, in PlayerAttackNPC there should be a part that handles damage (or a call to a sub) When this sub is called the following arguments are needed. Player index number, npc index number and some other stuff. With these values you can easily create your syntax. Here is a basic example. Please do not copy paste this but actually understand and try this yourself.```select case item(player(index).equipment(equipment.weapon)).elementcase 1 ' firedamage = damage *2case n ' n should be a number.end case```This is a rough code structure. If you have further questions please do ask cause this was really interesting to type out. ![:D](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/biggrin.png) Link to comment Share on other sites More sharing options...
tehl33tjim Posted March 25, 2013 Author Share Posted March 25, 2013 For some reason when I go to compile the Client, after adding the frmEditor_item.scrlElement.value = .element to the ItemEditorInit, and adding the frmEditor_NPC.scrlElement.value = .element to the NPCEditorInit, VB highlights the .Element part of the NPCInit code, and gives me an "invalid or unqualified reference".I do have a scrlElement scrollbar present on frmEditor_NPC, so wtf?[Edit]SO, I got it to work. Client compiled![/edit]–In the PlayerAttackNpc Sub (in ModCombat) - how exactly am I supposed to pull the data from the attacking Npc?In the sub, from what I understand, is pulling the variables from MapNpc.On a side note, not important to what I want to do, but where does "attacker" get defined? Throughout this entire module, it is only ever referenced, never created.[Final Edit] Figured it out. Now to make a tutorial.[/Final Edit] Link to comment Share on other sites More sharing options...
abhi2011 Posted March 25, 2013 Share Posted March 25, 2013 If you figured it out plz set the tag of the topic to resolved. Link to comment Share on other sites More sharing options...
tehl33tjim Posted March 26, 2013 Author Share Posted March 26, 2013 ~~How, uh…do I do that?~~ Nevermind. Didn't realize I had to pop into full editor. 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