Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

[Python] FM Market Script

Skilled Illusionist
Joined
Feb 18, 2010
Messages
320
Reaction score
112
uhhh so instead of having dozens of fm scripts for each town portal u can just have one like this:

Code:
FM_QR_CODE = 7600 # not used by client, do not broadcast changes to this

FM_MAP = 910000000

DEFAULT_RETURN_MAP = 100000000 # henesauce

FM_INSIDE_PORTAL = 'out00'
FM_TOWN_GATE_NAME = 'market00'

if ctx.PlayerMapId == FM_MAP: # exiting fm
	targetmap = ctx.GetQuestRecord(FM_QR_CODE, str(DEFAULT_RETURN_MAP))
	ctx.Warp(int(targetmap), FM_TOWN_GATE_NAME)
else: # entering fm
	ctx.UpdateQuestRecordInternal(FM_QR_CODE, str(ctx.PlayerMapId)) # save previous field ID as quest record
	ctx.Warp(FM_MAP, FM_INSIDE_PORTAL)

name the file market.py (or js if u enjoy the pain) and stick it in your portal script folder

this is version independent and will always tp your char to the correct portal id so no need to go portal hunting
depending on what garbasauce you use you may need to translate this to javascrapt and add some functions like getting a portal id from portal name and deleting your sys32 folder then another func to insert a screwdriver through your eye socket

also in your portal script handler or maybe in the function that fetches the script contents youre gonna need to add a check to grab the new combined market script instead of the actual name of the script that the client is requesting (like market00 or market01)

something like this:
Code:
public PortalScript GetPortalScript(string sPortalScriptName, WvsGameClient c)
{
	var subname = sPortalScriptName;
	if (sPortalScriptName.StartsWith("market")) // todo maybe clean this up or move the handling somewhere else
	{
		subname = "market";
	}

	var script = GetScript(ScriptType.Portal, $"{subname}", c);

	return new PortalScript(sPortalScriptName, script, c);
}
 
Back
Top