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

Npc/player random hits?


nickyboy304
 Share

Recommended Posts

yea i was wondering how do i make npc's/player's hit randomly instead of the same number over and over again. so like

ex:

a guy with 3 str will hit 3 all the time, but if we have random hit's from 0-item max hit he could hit 0, 3, 2, 3, 3, 0, 0, 1, 1, 0, 3, something like that.

so i was wondering does anyone know how to do this?
Link to comment
Share on other sites

@nickyboy304:

> yea i was wondering how do i make npc's/player's hit randomly instead of the same number over and over again. so like
>
> ex:
>
> a guy with 3 str will hit 3 all the time, but if we have random hit's from 0-item max hit he could hit 0, 3, 2, 3, 3, 0, 0, 1, 1, 0, 3, something like that.
>
> so i was wondering does anyone know how to do this?

No, but I'm guessing this is a Source Edit.
Link to comment
Share on other sites

This is pretty simple to do. Find this in your Main.txt:

```
Sub OnAttack(Index, Damage)
        Dim Target
```
Right under it, add this:

```
Damage = Int(Rand(Damage + 4, Damage - 4))
```
Do the same with **Sub OnArrowHit(Index, Damage)**

Now, find this:

```
Sub PlayerHit(Index, NPCNum, Damage)
```
Add this right under it:

```
Damage = Int(Rand(Damage + 4, Damage - 4))
```
That should make it so that your range of damage is 9\. For example, let's say you'd normally hit a 5 on an enemy. After implementing this, you can hit from 1 - 9\. Of course, you can change the numbers to your liking.
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...