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

[EO] Boss Npc's


Krumelz
 Share

Recommended Posts

This is a tutorial for Eclipse Origins v.1.1.0\. It will allow you to set NPC's to Bosses, after you defeat them it'll warp you to the set map and give you the dropped items, so stronger players cant just camp at the boss and wait for it to respawn, while the less strong player have to wait until the stronger player's bored of killing it.
Excuse my not perfect english, im german.

Client Side:

First you need to change the NpcRec, so Ctrl + F NpcRec and before
```
End Type
```
Add:
```

    Boss As Long
    BossMap As Integer
    BossX As Integer
    BossY As Integer

```
Do the same for the server's NpcRec!

Next you'll add a few things to the NpcEditor,  add:

Type        (Name)

1 checkbox (chkBoss) Caption: Boss
1 frame (frmBoss) Place the Frame above the one with the Npc's drop.

on the frame:

3 scrollbars (ScrlBossMap, ScrlBossX, ScrlBossY)
3 Labels (lblBossMap, lblBossx, lblBossY)
1 Button (cmdBoss)

here's a little example pic of what mine looks like:
![](http://www.freemmorpgmaker.com/files/imagehost/pics/f504fbd0f20e2903ed505298adaf65ed.JPG)

Now doubleclick chkBoss and add:
```
If chkBoss.Value = 1 Then
frmBoss.Visible = True
Else
frmBoss.Visible = False
End If
Npc(EditorIndex).Boss = chkBoss.Value
```
Doubleclick scrlBossMap and add:
```
If scrlBossMap.Value < 1 Then
scrlBossMap.Value = 1
End If
lblBossMap.Caption = "Map: " & scrlBossMap.Value
Npc(EditorIndex).BossMap = scrlBossMap.Value
```
Doubleclick ScrlBossX and add:
```
If scrlBossX.Value < 1 Then
scrlBossX.Value = 1
End If
lblBossX.Caption = "X: " & scrlBossX.Value
Npc(EditorIndex).BossX = scrlBossX.Value
```
Doubleclick ScrlBossY and add:
```
If scrlBossY.Value < 1 Then
scrlBossY.Value = 1
End If
lblBossY.Caption = "Y: " & scrlBossY.Value
Npc(EditorIndex).BossY = scrlBossY.Value
```
Doubleclick cmdBoss and add:
```
frmBoss.Visible = False
```
Ok, now search for
```
Public Sub NpcEditorInit()
```
and after
```
.txtEXP.text = Npc(EditorIndex).EXP
```
add
```
    .scrlBossMap.Value = Npc(EditorIndex).BossMap
    .scrlBossX.Value = Npc(EditorIndex).BossX
    .scrlBossY.Value = Npc(EditorIndex).BossY
    .chkBoss.Value = Npc(EditorIndex).Boss
```
Client side done.

Server Side

ok, I hope you've added the same code to the NpcRec as in the client.
Now find
```
Sub AttackNpc(ByVal Attacker As Long, ByVal MapNpcNum As Long, ByVal Damage As Long, Optional ByVal spellnum As Long)
```

and replace:
```
' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1

        If n = 1 Then
            Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum).Npc(MapNpcNum).x, MapNpc(MapNum).Npc(MapNpcNum).y)
        End If
```
with:
```
' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1

        If n = 1 Then
            If Npc(NpcNum).Boss = 1 Then

                Call PlayerWarp(Attacker, Npc(NpcNum).BossMap, Npc(NpcNum).BossX, Npc(NpcNum).BossY)

                If FindOpenInvSlot(Attacker, Npc(NpcNum).DropItem) = 0 Then
                    Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, Player(Attacker).X, Player(Attacker).Y)
                Else
                    Call GiveInvItem(Attacker, Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, True)
                End If

            Else
                Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y)
            End If
        End If
```
Edit

Remove:
```
If Npc(NpcNum).Boss = 1 Then
        Call PlayerWarp(Attacker, Npc(NpcNum).BossMap, Npc(NpcNum).BossX, Npc(NpcNum).BossY)
        End If
```
Change:
' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1

        If n = 1 Then
            If Npc(NpcNum).Boss = 1 Then
            GiveInvItem Attacker, Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, True
            Else
            Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y)
            End If
        End If

to:
```
' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1

        If n = 1 Then
            If Npc(NpcNum).Boss = 1 Then

                Call PlayerWarp(Attacker, Npc(NpcNum).BossMap, Npc(NpcNum).BossX, Npc(NpcNum).BossY)

                If FindOpenInvSlot(Attacker, Npc(NpcNum).DropItem) = 0 Then
                    Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, Player(Attacker).X, Player(Attacker).Y)
                Else
                    Call GiveInvItem(Attacker, Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, True)
                End If

            Else
                Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y)
            End If
        End If

```
With this edit it spawns the item you would've got at your new loaction if your inventory is full.

Edit 2
There was a little bug, it only warped you when you got the item, just change

```
' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1

        If n = 1 Then
            If Npc(NpcNum).Boss = 1 Then

                Call PlayerWarp(Attacker, Npc(NpcNum).BossMap, Npc(NpcNum).BossX, Npc(NpcNum).BossY)

                If FindOpenInvSlot(Attacker, Npc(NpcNum).DropItem) = 0 Then
                    Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, Player(Attacker).X, Player(Attacker).Y)
                Else
                    Call GiveInvItem(Attacker, Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, True)
                End If

            Else
                Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y)
            End If
        End If

```
to:
```
' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1

        If Npc(NpcNum).Boss = 1 Then

        Call PlayerWarp(Attacker, Npc(NpcNum).BossMap, Npc(NpcNum).BossX, Npc(NpcNum).BossY)
            If n = 1 Then
                If FindOpenInvSlot(Attacker, Npc(NpcNum).DropItem) = 0 Then
                    Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, Player(Attacker).x, Player(Attacker).Y)
                Else
                    Call GiveInvItem(Attacker, Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, True)
                End If
            End If
        Else
                If n = 1 Then
                    Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum).Npc(MapNpcNum).x, MapNpc(MapNum).Npc(MapNpcNum).Y)
                End If
        End If
```
Now it should work without any bugs. ^^

Done, thats it.
Hope some people like it, if there are any bugs please report them. ^^
No credits needed.

~Krumelz
Link to comment
Share on other sites

@adr990:

> Woah, really impressive! :)
> Nice code, I like it.
>
> Works on EO (CE) 1.2.0 with just a little addition without problems here.
>
> I'll study this code, thanks for making this tutorial.
>
> Adr990

@Chuchoide:

> Nice, will add soon.

thanks, glad you like it. ^^
Link to comment
Share on other sites

@Taco:

> Hey, schönes Skript und ne gute Idee :)

danke ;D

There was a little bug, it only warped you when you got the item, just change
```
' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1

        If n = 1 Then
            If Npc(NpcNum).Boss = 1 Then

                Call PlayerWarp(Attacker, Npc(NpcNum).BossMap, Npc(NpcNum).BossX, Npc(NpcNum).BossY)

                If FindOpenInvSlot(Attacker, Npc(NpcNum).DropItem) = 0 Then
                    Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, Player(Attacker).X, Player(Attacker).Y)
                Else
                    Call GiveInvItem(Attacker, Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, True)
                End If

            Else
                Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum).Npc(MapNpcNum).X, MapNpc(MapNum).Npc(MapNpcNum).Y)
            End If
        End If
```
to:

```
' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1

        If Npc(NpcNum).Boss = 1 Then

        Call PlayerWarp(Attacker, Npc(NpcNum).BossMap, Npc(NpcNum).BossX, Npc(NpcNum).BossY)
            If n = 1 Then
                If FindOpenInvSlot(Attacker, Npc(NpcNum).DropItem) = 0 Then
                    Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, Player(Attacker).x, Player(Attacker).Y)
                Else
                    Call GiveInvItem(Attacker, Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, True)
                End If
            End If
        Else
                If n = 1 Then
                    Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum).Npc(MapNpcNum).x, MapNpc(MapNum).Npc(MapNpcNum).Y)
                End If
        End If
```
Now it should work without any bugs. ^^
Link to comment
Share on other sites

I just saw that I put it on MapNpcRec, must have pressed f3 several times.

But I get the an error on
Private Sub ScrlBossMap_Change(Index As Integer)
If ScrlBossMap.Value < 1 Then
ScrlBossMap.Value = 1
End If
lblBossMap.Caption = "Map: " & ScrlBossMap.Value
Npc(EditorIndex).BossMap = ScrlBossMap.Value
End Sub

.Value Highlighted on the second line
Link to comment
Share on other sites

Will this work with parties?

As in if there is a group of players in a party and fighting a boss what will happen when boss is killed? Will it warp all players in party to set location? And if so what will happen to the drops, as in will they get shared about the party members or put only in the player who killed the boss?

Cheers and good tut btw :)
Link to comment
Share on other sites

  • 2 weeks later...
@Thor7:

> Will this work with parties?
>
> As in if there is a group of players in a party and fighting a boss what will happen when boss is killed? Will it warp all players in party to set location? And if so what will happen to the drops, as in will they get shared about the party members or put only in the player who killed the boss?
>
> Cheers and good tut btw :)

Didn't thought about that yet, but i'll try to add something like that.
Thanks for the Question/Suggestion. ^^
~Krumelz
Link to comment
Share on other sites

I have a small problem with this.  When I go to load the NPC's it crashes saying someting about an "Invalid Property Value".  I have looked through and everything I have is exactly as you have it.  Not sure what could be causing it but it exists and I cannot find a way to fix it.  Any help would be highly appreciated.

~Ecclestio
Link to comment
Share on other sites

@Ecclestio:

> I have a small problem with this.  When I go to load the NPC's it crashes saying someting about an "Invalid Property Value".  I have looked through and everything I have is exactly as you have it.  Not sure what could be causing it but it exists and I cannot find a way to fix it.  Any help would be highly appreciated.
>
> ~Ecclestio

hmm .. you may have to delete your npc's in order to get this to work.
if that doesnt work run your server in debugging mode and tell me what line is highlighted.

@thezeus:

> This is not compatible with 1.3.1 correct?

nope, its not, unfortunately. Im going to rewrite it for 1.3 tho.

~Krumelz
Link to comment
Share on other sites

@thezeus:

> I triple doggy dare you to do it today, lol.

Got your request done and rewrote it in 1.3.1
the problem simply was that theres no Npc Drops included in 1.3.1,
ateast i didnt find it ..
well, to get it to work simply go to Sub PlayerAttackNpc, find:
```
' Now set HP to 0 so we know to actually kill them in the server loop (this prevents subscript out of range)
```and BEFORE that add:
```
' Drop the goods if they get it
        n = Int(Rnd * Npc(NpcNum).DropChance) + 1

        If Npc(NpcNum).Boss = 1 Then

        Call PlayerWarp(Attacker, Npc(NpcNum).BossMap, Npc(NpcNum).BossX, Npc(NpcNum).BossY)
            If n = 1 Then
                If FindOpenInvSlot(Attacker, Npc(NpcNum).DropItem) = 0 Then
                    Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, Player(Attacker).x, Player(Attacker).Y)
                Else
                    Call GiveInvItem(Attacker, Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, True)
                End If
            End If
        Else
                If n = 1 Then
                    Call SpawnItem(Npc(NpcNum).DropItem, Npc(NpcNum).DropItemValue, MapNum, MapNpc(MapNum).Npc(MapNpcNum).x, MapNpc(MapNum).Npc(MapNpcNum).Y)
                End If
        End If
```
This should 1) include Npc drops to 1.3.1 and 2) make the Boss npc's work.
Hope it helps. ^^

~Krumelz
Link to comment
Share on other sites

  • 3 months later...

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...