FinalFury's Mini-Guide to Startuplocations.cs

For any problems with Dawn of Light website or game server, please direct questions and problems here.

Moderator: Support Team

FinalFury's Mini-Guide to Startuplocations.cs

Postby DOLBot » Thu May 14, 2009 8:40 pm

<This guide is written assuming you have all programs from Supgee's Offical DOL HOWTO, and you have already gotten your server running>


The Significance of this Script

Startuplocations.cs is used to define where a specific baseclass and race will start in. For each starting class, it has a specific race. So, if you wanted to, you could make the starting zone different for a troll viking and a norsemen viking.

Finding your Startuplocations.cs

GameServerScripts - Game Events - Startuplocations.cs

Quick Editing

Quick Replace is your friend. It is very easy to change the locations of where each base-class will start. First, find an Albion base class, and highlight the gloc in the parathesis. Then, go to Edit at the top lefthand corner of your Visual C# program, and click 'Find and Replace'. From here you go to Quick Replace. The location that you have highlighted has been already put into the 'Find what' part of the Quick Replacer. Now, you enter in the location that you want it to change to. Once you have finished that, click 'Replace All'. Repeat this for the other 2 realms.<Edit> You also want to do this:
Code: Select all
else
{
// can't change region on char creation, that is hardcoded in the client
ch.Xpos = loc.X;
ch.Ypos = loc.Y;
ch.Zpos = loc.Z;
ch.Direction = loc.Heading;
ch.Region = 237;
}
Change the ch.Region = to the region you want characters to spawn in. Thx Isus I forgot :D

Walaa, you have succesfully edited your Startuplocations.cs script. Don't forget to press f6 to compile it!
Last edited by Anonymous on Fri May 15, 2009 3:50 pm, edited 2 times in total.
User avatar
DOLBot
DOL Bot
 
Posts: 1933
Joined: Sat Jan 08, 2011 1:23 pm

Re: FinalFurys Mini-Guide to Startuplocations.cs

Postby Graveen » Thu May 14, 2009 8:41 pm

Sticky !

thx !!
Image
* pm me to contribute in Dawn of Light: code, database *
User avatar
Graveen
Project Leader
 
Posts: 12660
Joined: Fri Oct 19, 2007 9:22 pm
Location: France

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby Dunnerholl » Thu May 14, 2009 11:23 pm


Quick Replace is your friend.
erm what does that do? i see just one place for each gloc for 1.80+
Code: Select all
MainTownStartingLocations[(int)eCharacterClass.Acolyte] = new StartLocation(562418, 512268, 2500, 2980);
MainTownStartingLocations[(int)eCharacterClass.AlbionRogue] = new StartLocation(561956, 512226, 2516, 2116);
MainTownStartingLocations[(int)eCharacterClass.Disciple] = new StartLocation(562334, 512160, 2500, 2252);
MainTownStartingLocations[(int)eCharacterClass.Elementalist] = new StartLocation(561952, 512651, 2500, 3936);
MainTownStartingLocations[(int)eCharacterClass.Fighter] = new StartLocation(562099, 512472, 2500, 3606);
MainTownStartingLocations[(int)eCharacterClass.Forester] = new StartLocation(348494, 492021, 5176, 3572);
MainTownStartingLocations[(int)eCharacterClass.Guardian] = new StartLocation(347279, 489681, 5200, 2332);
MainTownStartingLocations[(int)eCharacterClass.Mage] = new StartLocation(561750, 512694, 2500, 1058);
MainTownStartingLocations[(int)eCharacterClass.Magician] = new StartLocation(348457, 491103, 5270, 3174);
MainTownStartingLocations[(int)eCharacterClass.MidgardRogue] = new StartLocation(802825, 726238, 4703, 1194);
MainTownStartingLocations[(int)eCharacterClass.Mystic] = new StartLocation(802726, 726512, 4694, 1103);
MainTownStartingLocations[(int)eCharacterClass.Naturalist] = new StartLocation(348877, 490997, 5414, 2863);
MainTownStartingLocations[(int)eCharacterClass.Seer] = new StartLocation(802671, 726752, 4690, 944);
MainTownStartingLocations[(int)eCharacterClass.Stalker] = new StartLocation(349404, 489469, 5282, 3003);
MainTownStartingLocations[(int)eCharacterClass.Viking] = new StartLocation(802869, 726016, 4699, 1399);
Dunnerholl
Developer
 
Posts: 1229
Joined: Mon Sep 08, 2008 8:39 pm

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby DOLBot » Fri May 15, 2009 12:13 am

Quick Replace takes whatever you highlighted, and puts it in a nifty little box. From there, you can change what you want it to do, and it will replace all the locs that match that description.
User avatar
DOLBot
DOL Bot
 
Posts: 1933
Joined: Sat Jan 08, 2011 1:23 pm

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby Dunnerholl » Fri May 15, 2009 12:38 am

Quick Replace takes whatever you highlighted, and puts it in a nifty little box. From there, you can change what you want it to do, and it will replace all the locs that match that description.
thats what i mean, those glocs are there just once
Dunnerholl
Developer
 
Posts: 1229
Joined: Mon Sep 08, 2008 8:39 pm

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby DOLBot » Fri May 15, 2009 12:49 am

Not for me :D Long list to change :)
User avatar
DOLBot
DOL Bot
 
Posts: 1933
Joined: Sat Jan 08, 2011 1:23 pm

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby Belthazor » Fri May 15, 2009 5:24 am

Thanks for the guide :)

any chance you could share your startuplocations.cs becouse in the one i have all of those places to find and replace isnt there :P or atleast not set up in the same way.
Belthazor
DOL Novice
 
Posts: 60
Joined: Mon Nov 28, 2005 9:26 pm

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby DOLBot » Fri May 15, 2009 3:52 pm

Here ya go:


Code: Select all
/*
* DAWN OF LIGHT - The first free open source DAoC server emulator
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
*/
/*
* Author: code by Noret, locations by Avatarius
* Date: 19.07.2004
* This script should be put in /scripts/gameevents directory.
* This event script changes starting location of created characters
* based on region, class and race
*/

using System;
using System.Collections.Specialized;
using System.Reflection;
using DOL.Database;
using DOL.Events;
using log4net;

namespace DOL.GS.GameEvents
{
/// <summary>
/// Moves new created Characters to the starting location based on region, class and race
/// </summary>
public class StartupLocations
{
/// <summary>
/// Defines a logger for this class.
/// </summary>
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

protected static HybridDictionary[] ClassicLocations = null;
protected static HybridDictionary[] ShroudedIslesLocations = null;
public static HybridDictionary MainTownStartingLocations = null;

[ScriptLoadedEvent]
public static void OnScriptCompiled(DOLEvent e, object sender, EventArgs args)
{
bool result = InitLocationTables();
GameEventMgr.AddHandler(DatabaseEvent.CharacterCreated, new DOLEventHandler(CharacterCreation));
if (log.IsInfoEnabled)
if (log.IsInfoEnabled)
log.Info("StartupLocations initialized");
}


[ScriptUnloadedEvent]
public static void OnScriptUnloaded(DOLEvent e, object sender, EventArgs args)
{
GameEventMgr.RemoveHandler(DatabaseEvent.CharacterCreated, new DOLEventHandler(CharacterCreation));
ClassicLocations = null;
ShroudedIslesLocations = null;
}

/// <summary>
/// Change location on character creation
/// </summary>
public static void CharacterCreation(DOLEvent ev, object sender, EventArgs args)
{
CharacterEventArgs chArgs = args as CharacterEventArgs;
if (chArgs == null)
return;
Character ch = chArgs.Character;
try
{
StartLocation loc = null;
GameClient client = chArgs.GameClient;
if (ch.Region == 27) // tutorial all realms use the same region
{
switch (ch.Realm)
{
case 1: // alb
loc = new StartLocation(544078, 582691, 8288, 627);
break;
case 2: // mid
loc = new StartLocation(584826, 560274, 8288, 563);
break;
case 3: // hib
loc = new StartLocation(534922, 538055, 8288, 1008);
break;
}
}
else if ((int)client.Version >= (int)GameClient.eClientVersion.Version180)
{
loc = (StartLocation)MainTownStartingLocations[ch.Class];
}
else if (ch.Region == 1 || ch.Region == 50 || ch.Region == 100) // all classic regions
{
loc = (StartLocation) ClassicLocations[ch.Race][ch.Class];
}
else if (ch.Region == 51 || ch.Region == 151 || ch.Region == 181) // all SI regions
{
loc = (StartLocation) ShroudedIslesLocations[ch.Race][ch.Class];
}
else
{
log.DebugFormat("tried to create char in unknown region {0}", ch.Region);
switch (ch.Realm)
{
default: ch.Region = 163; break;
case 2: ch.Region = 163; break;
case 3: ch.Region = 163; break;
}
loc = (StartLocation)ClassicLocations[ch.Race][ch.Class];
}

if (loc == null)
{
log.Warn("startup location not found: account=" + ch.AccountName + "; char name=" + ch.Name + "; region=" + ch.Region + "; realm=" + ch.Realm + "; class=" + ch.Class + " (" + (eCharacterClass) ch.Class + "); race=" + ch.Race + " (" + (eRace)ch.Race + ")");
}
else
{
// can't change region on char creation, that is hardcoded in the client
ch.Xpos = loc.X;
ch.Ypos = loc.Y;
ch.Zpos = loc.Z;
ch.Direction = loc.Heading;
ch.Region = 237;
}

BindCharacter(ch);
}
catch (Exception e)
{
if (log.IsErrorEnabled)
log.Error("StartupLocations script: error changing location. account=" + ch.AccountName + "; char name=" + ch.Name + "; region=" + ch.Region + "; realm=" + ch.Realm + "; class=" + ch.Class + " (" + (eCharacterClass) ch.Class + "); race=" + ch.Race + " (" + (eRace)ch.Race + ")", e);
}
}

/// <summary>
/// Binds character to current location
/// </summary>
/// <param name="ch"></param>
protected static void BindCharacter(Character ch)
{
ch.BindRegion = ch.Region;
ch.BindHeading = ch.Direction;
ch.BindXpos = ch.Xpos;
ch.BindYpos = ch.Ypos;
ch.BindZpos = ch.Zpos;
}

/// <summary>
/// Converts direction given by /loc command to heading
/// </summary>
/// <param name="dir">/loc command direction</param>
/// <returns>heading (0 .. 4095)</returns>
protected static int LocDirectionToHeading(int dir)
{
return (int) ((dir + 180)%360*4096.0/360.0);
}

/// <summary>
/// Converts zone coordinate to region
/// </summary>
/// <param name="zone">zone coordinate</param>
/// <param name="zoneOff">zone offset in the region</param>
/// <returns>region coordinate</returns>
protected static int ZoneToRegion(int zone, int zoneOff)
{
return zone + zoneOff*8192;
}

/// <summary>
/// Initializes location tables
/// </summary>
/// <returns>true if no errors</returns>
protected static bool InitLocationTables()
{
try
{
int size = (int) eRace._Last + 1;

ClassicLocations = new HybridDictionary[size];
ShroudedIslesLocations = new HybridDictionary[size];

for (int i = 0; i < size; i++)
{
ClassicLocations[i] = new HybridDictionary();
ShroudedIslesLocations[i] = new HybridDictionary();
}

ClassicLocations[(int) eRace.Avalonian][(int) eCharacterClass.Acolyte] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Avalonian][(int) eCharacterClass.Elementalist] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Avalonian][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Avalonian][(int) eCharacterClass.Mage] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Briton][(int) eCharacterClass.Acolyte] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Briton][(int) eCharacterClass.AlbionRogue] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Briton][(int) eCharacterClass.Elementalist] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Briton][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Briton][(int) eCharacterClass.Mage] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Celt][(int) eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Celt][(int)eCharacterClass.Magician] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Celt][(int)eCharacterClass.Naturalist] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Celt][(int)eCharacterClass.Stalker] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Dwarf][(int)eCharacterClass.MidgardRogue] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Dwarf][(int)eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Dwarf][(int)eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Dwarf][(int)eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Elf][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Elf][(int)eCharacterClass.Magician] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Elf][(int)eCharacterClass.Stalker] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Firbolg][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Firbolg][(int)eCharacterClass.Naturalist] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.HiberniaMinotaur][(int)eCharacterClass.Naturalist] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.HiberniaMinotaur][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);

ClassicLocations[(int) eRace.Frostalf][(int) eCharacterClass.MidgardRogue] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Frostalf][(int)eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Frostalf][(int)eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Frostalf][(int)eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int) eRace.HalfOgre][(int) eCharacterClass.Elementalist] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.HalfOgre][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.HalfOgre][(int) eCharacterClass.Mage] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Highlander][(int) eCharacterClass.Acolyte] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Highlander][(int) eCharacterClass.AlbionRogue] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Highlander][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int)eRace.Kobold][(int)eCharacterClass.MidgardRogue] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Kobold][(int)eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Kobold][(int)eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Kobold][(int)eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int)eRace.Lurikeen][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Lurikeen][(int)eCharacterClass.Magician] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Lurikeen][(int)eCharacterClass.Stalker] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int) eRace.Norseman][(int) eCharacterClass.MidgardRogue] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int) eRace.Norseman][(int) eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int) eRace.Norseman][(int) eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int) eRace.Norseman][(int) eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int) eRace.MidgardMinotaur][(int) eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ClassicLocations[(int) eRace.MidgardMinotaur][(int) eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);

ClassicLocations[(int) eRace.Saracen][(int) eCharacterClass.AlbionRogue] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Saracen][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Saracen][(int) eCharacterClass.Mage] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.AlbionMinotaur][(int) eCharacterClass.Acolyte] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.AlbionMinotaur][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);

ClassicLocations[(int)eRace.Shar][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Shar][(int)eCharacterClass.Magician] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int)eRace.Shar][(int)eCharacterClass.Stalker] = new StartLocation(534922, 538055, 8288, 1008);
ClassicLocations[(int) eRace.Troll][(int) eCharacterClass.Mystic] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Troll][(int) eCharacterClass.Seer] = new StartLocation(544078, 582691, 8288, 627);
ClassicLocations[(int) eRace.Troll][(int) eCharacterClass.Viking] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Avalonian][(int) eCharacterClass.Acolyte] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Avalonian][(int) eCharacterClass.Elementalist] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Avalonian][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Avalonian][(int) eCharacterClass.Mage] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Briton][(int) eCharacterClass.Acolyte] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Briton][(int) eCharacterClass.AlbionRogue] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Briton][(int) eCharacterClass.Disciple] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Briton][(int) eCharacterClass.Elementalist] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Briton][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Briton][(int) eCharacterClass.Mage] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int)eRace.Celt][(int)eCharacterClass.Forester] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Celt][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Celt][(int)eCharacterClass.Magician] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Celt][(int)eCharacterClass.Naturalist] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Celt][(int)eCharacterClass.Stalker] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int) eRace.Dwarf][(int) eCharacterClass.MidgardRogue] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Dwarf][(int) eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Dwarf][(int) eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Dwarf][(int) eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int)eRace.Elf][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Elf][(int)eCharacterClass.Magician] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Elf][(int)eCharacterClass.Stalker] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Firbolg][(int)eCharacterClass.Forester] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Firbolg][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Firbolg][(int)eCharacterClass.Naturalist] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int) eRace.Frostalf][(int) eCharacterClass.MidgardRogue] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Frostalf][(int) eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Frostalf][(int) eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Frostalf][(int) eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.HalfOgre][(int) eCharacterClass.Elementalist] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.HalfOgre][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.HalfOgre][(int) eCharacterClass.Mage] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Highlander][(int) eCharacterClass.Acolyte] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Highlander][(int) eCharacterClass.AlbionRogue] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Highlander][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Inconnu][(int) eCharacterClass.AlbionRogue] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Inconnu][(int) eCharacterClass.Disciple] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Inconnu][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Inconnu][(int) eCharacterClass.Mage] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Kobold][(int) eCharacterClass.MidgardRogue] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Kobold][(int) eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Kobold][(int) eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Kobold][(int) eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int)eRace.Lurikeen][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Lurikeen][(int)eCharacterClass.Magician] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Lurikeen][(int)eCharacterClass.Stalker] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int) eRace.Norseman][(int) eCharacterClass.MidgardRogue] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Norseman][(int) eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Norseman][(int) eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Norseman][(int) eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Saracen][(int) eCharacterClass.AlbionRogue] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Saracen][(int) eCharacterClass.Disciple] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Saracen][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.Saracen][(int) eCharacterClass.Mage] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int)eRace.Shar][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Shar][(int)eCharacterClass.Magician] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Shar][(int)eCharacterClass.Stalker] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Sylvan][(int)eCharacterClass.Forester] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Sylvan][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.Sylvan][(int)eCharacterClass.Naturalist] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int) eRace.Troll][(int) eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Troll][(int) eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Troll][(int) eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Valkyn][(int) eCharacterClass.MidgardRogue] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Valkyn][(int) eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.Valkyn][(int) eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.MidgardMinotaur][(int) eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.MidgardMinotaur][(int) eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
ShroudedIslesLocations[(int) eRace.AlbionMinotaur][(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int) eRace.AlbionMinotaur][(int) eCharacterClass.Acolyte] = new StartLocation(544078, 582691, 8288, 627);
ShroudedIslesLocations[(int)eRace.HiberniaMinotaur][(int)eCharacterClass.Naturalist] = new StartLocation(534922, 538055, 8288, 1008);
ShroudedIslesLocations[(int)eRace.HiberniaMinotaur][(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);


//1.82

MainTownStartingLocations = new HybridDictionary();
#region v1.82 Dictionary Alb
MainTownStartingLocations[(int) eCharacterClass.Acolyte] = new StartLocation(544078, 582691, 8288, 627);
MainTownStartingLocations[(int) eCharacterClass.AlbionRogue] = new StartLocation(544078, 582691, 8288, 627);
MainTownStartingLocations[(int) eCharacterClass.Disciple] = new StartLocation(544078, 582691, 8288, 627);
MainTownStartingLocations[(int) eCharacterClass.Elementalist] = new StartLocation(544078, 582691, 8288, 627);
MainTownStartingLocations[(int) eCharacterClass.Fighter] = new StartLocation(544078, 582691, 8288, 627);
MainTownStartingLocations[(int)eCharacterClass.Mage] = new StartLocation(544078, 582691, 8288, 627);
#endregion v1.82 Dictionary Alb
#region v1.82 Dictionary Hib
MainTownStartingLocations[(int)eCharacterClass.Forester] = new StartLocation(534922, 538055, 8288, 1008);
MainTownStartingLocations[(int)eCharacterClass.Guardian] = new StartLocation(534922, 538055, 8288, 1008);
MainTownStartingLocations[(int)eCharacterClass.Magician] = new StartLocation(534922, 538055, 8288, 1008);
MainTownStartingLocations[(int)eCharacterClass.Naturalist] = new StartLocation(534922, 538055, 8288, 1008);
MainTownStartingLocations[(int)eCharacterClass.Stalker] = new StartLocation(534922, 538055, 8288, 1008);
#endregion v1.82 Dictionary Hib
#region new HybridDictionary Mid
MainTownStartingLocations[(int) eCharacterClass.MidgardRogue] = new StartLocation(584826, 560274, 8288, 563);
MainTownStartingLocations[(int) eCharacterClass.Mystic] = new StartLocation(584826, 560274, 8288, 563);
MainTownStartingLocations[(int) eCharacterClass.Seer] = new StartLocation(584826, 560274, 8288, 563);
MainTownStartingLocations[(int) eCharacterClass.Viking] = new StartLocation(584826, 560274, 8288, 563);
#endregion new HybridDictionary Mid


}
catch (Exception e)
{
if (log.IsErrorEnabled)
log.Error("InitLocationTables", e);
return false;
}

return true;
}

protected class StartLocation
{
protected int m_x;
protected int m_y;
protected int m_z;
protected int m_heading;

public int X
{
get { return m_x; }
}

public int Y
{
get { return m_y; }
}

public int Z
{
get { return m_z; }
}

public int Heading
{
get { return m_heading; }
}

public StartLocation(int x, int y, int z, int heading)
{
m_x = x;
m_y = y;
m_z = z;
m_heading = heading;
}
}
}
}
User avatar
DOLBot
DOL Bot
 
Posts: 1933
Joined: Sat Jan 08, 2011 1:23 pm

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby Belthazor » Fri May 15, 2009 4:08 pm

Thanks alot
Belthazor
DOL Novice
 
Posts: 60
Joined: Mon Nov 28, 2005 9:26 pm

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby Elycian » Tue May 19, 2009 5:42 am

No matter what I do I cannot change the start up location of my characters. I've been at this for hours, they will always go to Black Mountains South. I even tried to copy paste the startup code you posted into my own and I got errors when recompiling - which linked me back to the tutorialjumppointhandler.cs file.

Error 1 'DOL.GS.GameEvents.StartupLocations.StartLocation' is inaccessible due to its protection level C:\Users\***\DAOC\Source\GameServerScripts\gameevents\TutorialJumpPointHandler.cs 42 21 GameServerScripts
Error 2 'DOL.GS.GameEvents.StartupLocations.StartLocation' is inaccessible due to its protection level C:\Users\Elycian\DAOC\Source\GameServerScripts\gameevents\TutorialJumpPointHandler.cs 42 130 GameServerScripts

and a few more very similar errors related to the tutorial jump point handler file.

I'd really like to send my characters to a whole different zone, but right now I can't even change the simple location they spawn on creation, any help would be appreciated.

Thanks :D

EDIT

I decided to delete the tutorialjumppointhandler.cs file altogether and see what happened and it looks like that solved all my problems. I still don't know how the slight changes in your startup file worked so much better than mine, but I'm studying it and learning. Thanks for posting this guide!
Elycian
DOL Initiate
 
Posts: 23
Joined: Tue Jan 22, 2008 2:41 am

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby $DUKE$ » Tue May 19, 2009 9:09 pm

Delete the tutorialjumppointhandler. It will fix it.
$DUKE$
DOL Guest
 
Posts: 4
Joined: Sat May 16, 2009 10:34 pm

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby DOLBot » Wed May 20, 2009 2:15 pm

Yes, /del the tutorial jumpoint handler. You can still use the DOLServer port box without having it. You may have to do this after every compile, unless you delete it from your visual c# viewer.
User avatar
DOLBot
DOL Bot
 
Posts: 1933
Joined: Sat Jan 08, 2011 1:23 pm

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby bluraven » Tue Jun 09, 2009 4:18 pm

nice guide! I edited "Supgee's Offical DOL HOWTO" to actually link to that post.
Image
bluraven
Support Team
 
Posts: 1484
Joined: Mon Mar 19, 2007 8:18 am
Location: Las Vegas, NV

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby -Shawn- » Tue Dec 08, 2009 11:31 pm

Hi,
Code: Select all
using System;
using System.Collections.Specialized;
using System.Reflection;
using DOL.Database;
using DOL.Events;
using log4net;

namespace DOL.GS.GameEvents
{
/// <summary>
/// Moves new created Characters to the starting location based on region, class and race
/// </summary>
public class StartupLocations
{
/// <summary>
/// Defines a logger for this class.
/// </summary>
private static readonly ILog log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);

protected static HybridDictionary[] ClassicLocations = null;
protected static HybridDictionary[] ShroudedIslesLocations = null;
public static HybridDictionary MainTownStartingLocations = null;

[ScriptLoadedEvent]
public static void OnScriptCompiled(DOLEvent e, object sender, EventArgs args)
{
GameEventMgr.AddHandler(DatabaseEvent.CharacterCreated, new DOLEventHandler(CharacterCreation));
if (log.IsInfoEnabled)
if (log.IsInfoEnabled)
log.Info("StartupLocations initialized");
}


[ScriptUnloadedEvent]
public static void OnScriptUnloaded(DOLEvent e, object sender, EventArgs args)
{
GameEventMgr.RemoveHandler(DatabaseEvent.CharacterCreated, new DOLEventHandler(CharacterCreation));
ClassicLocations = null;
ShroudedIslesLocations = null;
}

/// <summary>
/// Change location on character creation
/// </summary>
public static void CharacterCreation(DOLEvent ev, object sender, EventArgs args)
{
CharacterEventArgs chArgs = args as CharacterEventArgs;
if (chArgs == null)
return;
Character player = chArgs.Character;
Character ch = chArgs.Character;
StartLocation loc;
try
{

GameClient client = chArgs.GameClient;

if (player.Realm == 1)
{
player.Xpos = 32009;
player.Ypos = 13207;
player.Zpos = 17413;
player.Direction = 2077;
player.Region = 79;

BindCharacter(player);
}
if (player.Realm == 3)
{
player.Xpos = 32009;
player.Ypos = 13207;
player.Zpos = 17413;
player.Direction = 2077;
player.Region = 79;

BindCharacter(player);
}
if (player.Realm == 2)
{
player.Xpos = 32009;
player.Ypos = 13207;
player.Zpos = 17413;
player.Direction = 2077;
player.Region = 79;

BindCharacter(player);
}
BindCharacter(player);

return;




}
catch (Exception e)
{
if (log.IsErrorEnabled)
log.Error("StartupLocations script: error changing location. account=" + ch.AccountName + "; char name=" + ch.Name + "; region=" + ch.Region + "; realm=" + ch.Realm + "; class=" + ch.Class + " (" + (eCharacterClass)ch.Class + "); race=" + ch.Race + " (" + (eRace)ch.Race + ")", e);
}
}

/// <summary>
/// Binds character to current location
/// </summary>
/// <param name="ch"></param>
protected static void BindCharacter(Character ch)
{
ch.BindRegion = ch.Region;
ch.BindHeading = ch.Direction;
ch.BindXpos = ch.Xpos;
ch.BindYpos = ch.Ypos;
ch.BindZpos = ch.Zpos;
}

/// <summary>
/// Converts direction given by /loc command to heading
/// </summary>
/// <param name="dir">/loc command direction</param>
/// <returns>heading (0 .. 4095)</returns>
protected static int LocDirectionToHeading(int dir)
{
return (int)((dir + 180) % 360 * 4096.0 / 360.0);
}

/// <summary>
/// Converts zone coordinate to region
/// </summary>
/// <param name="zone">zone coordinate</param>
/// <param name="zoneOff">zone offset in the region</param>
/// <returns>region coordinate</returns>
protected static int ZoneToRegion(int zone, int zoneOff)
{
return zone + zoneOff * 8191;
}

/// <summary>
/// Initializes location tables
/// </summary>
/// <returns>true if no errors</returns>

public class StartLocation
{
protected int m_x;
protected int m_y;
protected int m_z;
protected int m_heading;

public int X
{
get { return m_x; }
}

public int Y
{
get { return m_y; }
}

public int Z
{
get { return m_z; }
}

public int Heading
{
get { return m_heading; }
}

public StartLocation(int x, int y, int z, int heading)
{
m_x = x;
m_y = y;
m_z = z;
m_heading = heading;
}
}
}
}
Code: Select all
player.Xpos = 32009;
player.Ypos = 13207;
player.Zpos = 17413;
player.Direction = 2077;
player.Region = 79;
c/p = friend !!!!!!!!!!!

= 0 ?
-Shawn-
DOL Devotee
 
Posts: 305
Joined: Tue Nov 24, 2009 1:47 am
Location: New York

Re: FinalFury's Mini-Guide to Startuplocations.cs

Postby DOLBot » Wed Dec 09, 2009 12:15 am

Was created a while back. If you want to post your guide for this Shawn, I'll edit it, since this is already stickied, and it will need a wiki update.
User avatar
DOLBot
DOL Bot
 
Posts: 1933
Joined: Sat Jan 08, 2011 1:23 pm


Return to “%s” Support

Who is online

Users browsing this forum: No registered users and 0 guests