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

Copy & Paste NPCs


Xlithan
 Share

Recommended Posts

**COPY & PASTE NPC's**
**–** A tutorial by Xlithan –

Just thought I'd contribute this small piece of code to the community. It makes adding NPCs much easier with just a few clicks of a button.
Anybody who has made large maps with a lot of NPCs knows the frustration of going through each list item one by one.

This tutorial will work for any version of Eclipse Origins, and any source code that uses a similar map properties design (Which as far as I remember,
is pretty much every version dating back to Mirage Source).

**Open up your Map Properties form. You will need to create the following items:**
![](http://i.snag.gy/i2XSo.jpg)
cmdPaste (CommandButton)
cmdClear (CommandButton)
cmdClearAll (CommandButton)
2 Labels (Name doesn't matter)
txtStart (TextBox)
txtEnd (TextBox)
cmdBatchPaste (CommandButton)

cmdCopy (CommandButton)

**Place the items next to your NPC listbox like so:**
![](http://i.snag.gy/91HXU.jpg)

**Now you need to add the following code to each item (Code may vary for different sources. This was written for SkyWyre Primitive):**

**_At the very top of the form, add:_**
```
Private CopyIndex As Long
Private PasteIndex As Long
```

**_cmdPaste_**
```
Private Sub btnPaste_Click()
cmbNpc.ListIndex = CopyIndex
End Sub
```

**_cmdClear_**
```
Private Sub btnClear_Click()
cmbNpc.ListIndex = 0
End Sub
```

**_cmdClearAll_**
```
Private Sub btnClearAll_Click()
Dim I As Long
   For I = 0 To MAX_MAP_NPCS - 1
       lstNpcs.ListIndex = I
       cmbNpc.ListIndex = 0
   Next I
End Sub
```

**_cmdBatchPaste_**
```
Private Sub btnBatchPaste_Click()
Dim I As Long
Dim s As Long
Dim e As Long

   s = txtStart.text - 1
   e = txtEnd.text - 1

   For I = s To e
       lstNpcs.ListIndex = I
       cmbNpc.ListIndex = CopyIndex
   Next I
End Sub
```

**_cmdCopy_**
```
Private Sub btnCopy_Click()
   CopyIndex = cmbNpc.ListIndex
End Sub
```

**And that's all!**

![](http://i.snag.gy/DCfAb.jpg)
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...