Idea: Creating a marker on Map "Draqonlife" (gamemode play), which leads you to to another map.
In this case "DraqonDocks" (gamemode race).
known issues to be ignored: event triggers any marker
known issues to be fixed: after gamemode change, the map wont change.
Marker.lua :
>Creates a marker (works)
>Triggers player on entering and leaving any Marker (works)
>Starts gamemode race (works)
! Does not start Map !
!! No error when map does not start !!
!! ERROR: lobby/ChangeMode.lua:7: attempt to call global 'changeGamemodeMap' (a nil value) !!
resourceRoot = getResourceRootElement()
function onCurrentResourceStart(Draqonlife)
local resourceName = getResourceName(Draqonlife)
outputChatBox("Hello and welcome to " .. resourceName .. "!")
Marker = createMarker (2860, -2115, 10, "corona", 4.0, 0, 0, 255, 255) -- create Marker
end
addEventHandler("onResourceStart", resourceRoot, onCurrentResourceStart)
//Create Marker
function MarkerHit( hitElement, matchingDimension )
local elementType = getElementType( hitElement )
local resource = getResourceFromName ("race") -- | this works,
startResource( resource ) -- | really good tho
--local resource = getResourceFromName ("DraqonDocks")
--startResource( resource )
// If I try to start the map Resource directly after the race resource,
// the Map resource wont load up
end
addEventHandler( "onMarkerHit", root, MarkerHit)
//Should start gamemode race (and map)
function MarkerLeave( leaveElement,matchingDimension)
local elementType = getElementType( leaveElement )
local resource = getResourceFromName ("DraqonDocks") -- |Also not working, server ignores this line,
startResource( resource ) -- |as it Ignores this line too.
end
addEventHandler( "onMarkerLeave", root, MarkerLeave )
ChangeMode.lua
> My Idea to fix this problem
--Thats why i want to import the mapmanager (or the function changeGamemodeMap)
--Sadly I found no useful documentation for my case.
--adding <exports.mapmanager:changeGamemodeMap/> to the meta.xml of the scripts didnt work
function changeGamemodeMap()
changeGamemodeMap("DraqonDocks", "race") -- this doesnt work
end
addCommandHandler("420", changeGamemodeMap)
___________________________________________________________________________________________
It would be very kind if someone could enlight me and give me a short introduction to using mapmanagers functions properly. Sadly the Mapmanager post in wiki didnt help me too much.
If you find a fix for the existing (half working) Marker.lua, then I'd be really glad too
I would love to get feedback and already thank everyone