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

Eclipse Instancing (MapPacks Style)


Scott
 Share

Recommended Posts

I finished them last night, than passed out after here ya go sorry,

(This fixes npc spawn issues)

In sub InstancePlayerWarp find:

```
' send player's equipment to new map

SendMapEquipment Index

' send equipment of all people on new map

If GetTotalMapPlayers(NewMap) > 0 Then

For i = 1 To Player_HighIndex

If IsPlaying(i) Then

If GetPlayerMap(i) = NewMap Then

SendMapEquipmentTo i, Index

End If

End If

Next

End If
```

Under add:

```

' Now we check if there were any players left on the map the player just left, and if not stop processing npcs

If GetTotalMapPlayers(PlayerMap) = 0 Then

PlayersOnMap(PlayerMap) = NO

' Regenerate all NPCs' health

For i = 1 To MAX_MAP_NPCS

If MapNpc(PlayerMap).Npc(i).Num > 0 Then

MapNpc(PlayerMap).Npc(i).Vital(Vitals.HP) = GetNpcMaxVital(MapNpc(PlayerMap).Npc(i).Num, Vitals.HP)

End If

Next

End If

```

–-----------------------------------------------------------------------

(This fixes death issues)

In sub OnDeath find:

```
With Map(GetPlayerMap(Index))

' to the bootmap if it is set

If .BootMap > 0 Then

PlayerWarp Index, .BootMap, .BootX, .BootY

Else

Call PlayerWarp(Index, START_MAP, START_X, START_Y)

End If

End With
```

Replace with:

```

With Map(GetPlayerMap(Index))

If TempPlayer(Index).Is_In_Instance = False Then

'Non instance death

' to the bootmap if it is set

If .BootMap > 0 Then

PlayerWarp Index, .BootMap, .BootX, .BootY

Else

Call PlayerWarp(Index, START_MAP, START_X, START_Y)

End If

Else

'instance death

'Pull them out if they are in one already

'Make sure they are pulled out of the instance compleatly

Player(Index).In_Instance = False

TempPlayer(Index).Is_In_Instance = False

'Wipe temp data

TempPlayer(Index).CurrentInstanceMap = 0

TempPlayer(Index).MapPack = 0

TempPlayer(Index).MapsUsed = 0

'Return them to their pre-instance location

Call PlayerWarp(Index, Player(Index).ReturnMap, Player(Index).ReturnX, Player(Index).ReturnY)

'Wipe return values

Player(Index).ReturnMap = 0

Player(Index).ReturnX = 0

Player(Index).ReturnY = 0

Call PlayerMsg(Index, "You have left the instance!", Green)

End If

End With

```

Let me know if you have any issues with these, they are not included in the downloadable version yet I didn't upload it yet since it will include new features as well as the bug fixes.
Link to comment
Share on other sites

well the on death works, but the npc fix doesnt, they still spawn in the corner. but now, sometimes when i goto instance the npcs are unhittable, and they wont attack. its hard to duplicate, or it may be first one to connect to server after starting it? trying to narrow it down. but either way they spawn in the corner the first time, and then when you return it remembers their last locations.
Link to comment
Share on other sites

  • 2 weeks later...
Haha this is just for testing when I'm done I'll release it as a stand alone tutorial and not just a downloadable source. I got hired by an old client of mine to do some more work and got a little busy, but my attention is back on eclipse now that I'm done with that so let me go fix that npc bug lol.
Link to comment
Share on other sites

  • 2 weeks later...
Sorry for the delay, some other stuff took priority but i'm back to working on this for the time being. So as I'm sure you all have been waiting for the fix for the npc spawning bug!

(SERVER)

Find:

```

'Load new map

Call LoadSingleInstancedMap(MapToUse, TempPlayer(index).MapPack, TempPlayer(index).CurrentInstanceMap)

Map(MapToUse).Revision = HoldR

' Respawn

Call SpawnMapItems(GetPlayerMap(index))

' cache the map

Call MapCache_Create(MapToUse)

Call ClearTempTile(MapToUse)

Call CacheResources(MapToUse)

```

Under add:

```
' Respawn NPCS

For i = 1 To MAX_MAP_NPCS

Call SpawnNpc(i, GetPlayerMap(index))

Next

```

–-----------------------------------------------------------------------------

Find in **Sub InstancePlayerWarp** (Make sure you only do this inside InstancePlayerWarp this appears else where):

```
Call SetPlayerMap(index, NewMap)

Call SetPlayerX(index, NewX)

Call SetPlayerY(index, NewY)

```

Delete and move it under:

```
If MapToUse > TempPlayer(index).MapsUsed Then

Call PlayerMsg(index, "This instance does now currently have this many maps, the max is " & TempPlayer(index).MapsUsed & " for this instance.", Red)

Exit Sub

End If

```

So it should look like this in the end:

```

If MapToUse > TempPlayer(index).MapsUsed Then

Call PlayerMsg(index, "This instance does now currently have this many maps, the max is " & TempPlayer(index).MapsUsed & " for this instance.", Red)

Exit Sub

End If

Call SetPlayerMap(index, NewMap)

Call SetPlayerX(index, NewX)

Call SetPlayerY(index, NewY)

```
Link to comment
Share on other sites

ill be testing it out a bit later tonight when i get home.

EDIT****

works great. npcs spawn in proper locations, no other bugs that i can think of at the moment.

the only thing i feel its missing is support for the event system on these instanced maps.
Link to comment
Share on other sites

If they are in a party they will join one together, if not they will each have a seperate copy to use. So really all this does is gives each player 1 map slot they can use alone, it will load the old map from under them and load a new map on the same map to make it look like a transition, except when your in a party it will do a check to see if anyone else in your party is in this part of the dungeon and just take you to their map if so.
Link to comment
Share on other sites

> If they are in a party they will join one together, if not they will each have a seperate copy to use. So really all this does is gives each player 1 map slot they can use alone, it will load the old map from under them and load a new map on the same map to make it look like a transition, except when your in a party it will do a check to see if anyone else in your party is in this part of the dungeon and just take you to their map if so.

but why make so many slots? 1 instanced when person has entered ppl can enter the same instanced map. if no player on map after time end instance. that would make a lil bit more sense. o-o but just my input ,
Link to comment
Share on other sites

The slots are just maps, it just places you on a normal map, flags that as an instance map and you would never leave that single map(you would look like you where) but your really confined to 1 map as a single player. Now if your in a party and you try to move maps, it will first look to see if anyone else in your party is on that section of the dungeon, if they are it will move you to there map so you both are on the same instanced map, now say a player leaves this map it will notice there is a player still on the current map and assign them a new map so the first player can keep exploring this section even though it may not have been his orignal map and he joined it while another player was on. So really there is no "End Instance" each player kinda has there own that can co-mingle if there in a group. It only uses 1 map slot per player at max, and less as you group up on the same maps together if you have a better idea please be more detailed wasen't following you well.
Link to comment
Share on other sites

  • 5 months later...
New Update to this for those interested.

This version adds persistent items to instancing, when you leave an instanced map instead of deleting the items they are added to a temp list of instanced items. Limit is 1 maps worth of max items(225?) per instance, can be changed.

(Updated to fix 2 bugs in first download)

https://mega.co.nz/#!n8gCmAwY!GP2i3iSk7wL0OWvbjwbl5QIh_wNuKQ9S5-x3OYWrVW8

Last up on my list to do is the same thing for npc health/spawn timers than I will turn this into a tutorial of some kind. If you have any suggestions to something you would like added please feel free to post them.
Link to comment
Share on other sites

(Updated to fix 2 bugs in first download)

[https://mega.co.nz/#…KQ9S5-x3OYWrVW8](https://mega.co.nz/#!n8gCmAwY!GP2i3iSk7wL0OWvbjwbl5QIh_wNuKQ9S5-x3OYWrVW8)

(Edit 2 Removed old backup I left in the download)
Link to comment
Share on other sites

  • 1 month 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...