Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Adding a new stat Eo (2.0/3.0)


or3o
 Share

Recommended Posts

Ok so i had someone ask about adding a new stat in EO, this is pretty easy but you will need to erase items npcs and accounts to do it. I added it as a critical strike skill.

I made it so you cant level it up with stat points ( i did it the lazy way of just hiding the train stat label, and if you have a better suggestion please feel free to tell me.)

anyway this stat affects your critical strike chance although you could easily use it for other things.

first we are gonna start **Server Side**

**Moddatabase** Sub load classes find```
Class(i).stat(Stats.Willpower) = Val(GetVar(filename, "CLASS" & i, "Willpower"))
```

beneath that paste```
Class(i).stat(Stats.crit) = Val(GetVar(filename, "CLASS" & i, "Crit"))
```

now in sub SaveClasses under

```
Call PutVar(filename, "CLASS" & i, "Willpower", STR(Class(i).stat(Stats.Willpower)))
```
Paste```
Call PutVar(filename, "CLASS" & i, "Crit", STR(Class(i).stat(Stats.crit)))
```

**ModHandleData** Sub handleUseStatpoint

find```
Case Stats.Willpower

Call SetPlayerStat(Index, Stats.Willpower, GetPlayerRawStat(Index, Stats.Willpower) + 1)

sMes = "Willpower"
```

Underneath that paste```
Case Stats.crit

Call SetPlayerStat(Index, Stats.crit, GetPlayerRawStat(Index, Stats.crit) + 1)

sMes = "Crit"
```**In mine i replaced the +1 with a +0 to ensure no one could use stat points to train Crit chance but im leaving this as is in case you wanna have it be trainable or whatever.**

Moving on to **ModEnumerations**

in Public enum stats under

```
Willpower
```
paste```
crit
```
just above stat_count

**This is where i calculate if you can critical hit. if you are using this tutorial to make a different kind of skill such as defence you can ignore this part and start checking out the CanplayerBlock function.**

Ok in ModCombat sub CanplayerCrit replace the entire sub with this

```
Public Function CanPlayerCrit(ByVal Index As Long) As Boolean

Dim rate As Long

Dim rndNum As Long

CanPlayerCrit = False

rate = GetPlayerStat(Index, crit)

rndNum = rand(1, 100)

If rndNum <= rate Then

CanPlayerCrit = True

End If

End Function
```

In sub CanNpcCrit i edited it to look like this so i could give the npcs the ability to have a crit chance also its not required for the tutorial it was just preference

```

Dim rate As Long

Dim rndNum As Long

CanNpcCrit = False

rate = NPC(npcNum).stat(Stats.Crit)

rndNum = rand(1, 100)

If rndNum <= rate Then

CanNpcCrit = True

End If
```
In sub TryPlayerAttackNpc under

```
' * 1.5 if it's a crit!
```
you can change the value of the crit if you would like to.

That Should be it for Server Side! now we move on to the

**Client Side**

Ok so **ModEnumerations**

find```
Willpower
```in Public Enum Stats

under that before Stat_count paste

```
CRIT
```

**Form Work**

now in Frmeditor_npc in ScrlStat_Change under

```
Case 5

prefix = "Will: "
```

paste```
Case 6

prefix = "Crit: "
```

now in Frmeditor_item

in ScrlStatBonus under

```
Case 5

text = "+ Will: "
```

paste```
Case 6

text = "+ CRIT: "
```
now in ScrlStatReq under```
Case 5

text = "Will: "
```

paste```
Case 6

text = "+ CRIT: "
```

Ok now we start adding the scrl bars and labels. this parts really easy.

in FrmEditor_item in the requirements box right click on one of the scroll bars and copy it. now paste it in the same box paste it agian (**these boxes are in an array so when you copy them they automatically name themselves, the only problem is the first one you paste will have a (0) at the end, you need it to be a (6) so you copy it and then paste it twice. The second one you paste will have the (6) at the end just delete the first one you copied and your good to go.** **You need to do this will all the labels and scroll bars in this edit!!**

ok so copy scrlstatreq and paste it do the same with lbl statreq now do the same with scrlStatbonus and lblstatbonus (its also a good idea to change the caption on the labels to Crit:0)

Ok now your done with the item editor. now you move on to Frmeditor_Npc

Copy ScrlStat and LblStat doing the same thing you did with the item editor(copy twice and delete the first copy!) and now your done with the npc editor. time to finish this up.

Ok so open up Frmmain open PicCharacter (if you cant find it click on the dropdown button in the properties menu and find picCharacter and select it. a square should show up on your frm main, right click it and select move to front.)

ok now its time to copy lblCharStat (be sure to copy it twice and delete the first copy.)

now do the same with lblTrainStat. **If you plan on making this non trainable i would suggest moving the trainstat label offscreen so it isnt visible ingame.** anyway thats all for this tutorial i hope this helps at least someone out. No credit needed.
Link to comment
Share on other sites

Thank you for posting this upon my request. I actually did most of this when I tried to do it myself, so having this will be a nice reference. I'll tell you if it works for me! Thanks a lot ![^_^](http://www.touchofdeathforums.com/community/public/style_emoticons/<#EMO_DIR#>/happy.png)
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...