Weather gfx Editor
» Siedler Map Source Forum » Siedler DEdK Script Forum » Weather gfx Editor
Seiten: 1
Riesenadler
|
#1 07.11.2018 16:13 Beiträge: 19 |
Weather gfx Editor
Ich bin mir sicher, dass es sowas schon tausendfach gibt, aber ich wollte einfach mal meine Version davon veröffentlichen:
-------------------------------------------------------------------------------- -- Weather Gfx Editor -- Author: Riesenadler -------------------------------------------------------------------------------- --[[ Benutzung: 1. Dieses Script (und nur dieses Script) in die Karte packen, in der es gut aussehen soll 2. Karte spielen und gfxe bearbeiten 3. gewollte gfxe ausgeben lassen und mit strg+V in function Setup<name>WeatherGfxSet() end schreiben, unnötige Zeilen von der Fehlermeldung löschen 4. In richtiges Script einfügen und in InitWeatherGfxSets aufrufen --]] Script.Load( Folders.MapTools.."Main.lua" ) IncludeGlobals("MapEditorTools") function InitDiplomacy() end function InitResources() AddGold(1) end function InitTechnologies() end function InitWeatherGfxSets() SetupNormalWeatherGfxSet()--<<< diesen Aufruf durch Setup<name>WeatherGfxSet() ersetzen end function InitWeather() AddPeriodicSummer(10) end function InitPlayerColorMapping() end function FirstMapAction() Camera.ZoomSetFactorMax(3) Camera.RotSetFlipBack(0) params = {} paranames = { {title = "FogParams","_flag", "_red" , "_green", "_blue", "_fogS", "_fogE"}, {title = "LightParams","_posX", "_posY", "_posZ", "_lanR", "_lanG", "_lanB", "_sunR", "_sunG", "_sunB"}, {title = "Downfall", "_rnef", "_snef", "_snow", "_skyBox"} } SetGfx(4) SetParam(1) SetWeather(1) buchstabens = {"Q","W","E","R","T","Z","U","I","O" } infotitle = "Steuerung" infotext = [[Q-O: Parameter erhoehen Alt + Q-O: Parameter verringern S,A: Gfx auswaehlen D: Nebelparameter F: Lichtparameter G: Niederschlag H: normales Wetter J: Regen K: Winter Y: Ganze Karte erkunden L: Code ausgeben (nur im debugscript Modus) ]] Input.KeyBindDown(Keys.Q, "Plus(1)", 2) Input.KeyBindDown(Keys.W, "Plus(2)", 2) Input.KeyBindDown(Keys.E, "Plus(3)", 2) Input.KeyBindDown(Keys.R, "Plus(4)", 2) Input.KeyBindDown(Keys.T, "Plus(5)", 2) Input.KeyBindDown(Keys.Z, "Plus(6)", 2) Input.KeyBindDown(Keys.U, "Plus(7)", 2) Input.KeyBindDown(Keys.I, "Plus(8)", 2) Input.KeyBindDown(Keys.O, "Plus(9)", 2) Input.KeyBindDown(Keys.ModifierAlt + Keys.Q, "Minus(1)", 2) Input.KeyBindDown(Keys.ModifierAlt + Keys.W, "Minus(2)", 2) Input.KeyBindDown(Keys.ModifierAlt + Keys.E, "Minus(3)", 2) Input.KeyBindDown(Keys.ModifierAlt + Keys.R, "Minus(4)", 2) Input.KeyBindDown(Keys.ModifierAlt + Keys.T, "Minus(5)", 2) Input.KeyBindDown(Keys.ModifierAlt + Keys.Z, "Minus(6)", 2) Input.KeyBindDown(Keys.ModifierAlt + Keys.U, "Minus(7)", 2) Input.KeyBindDown(Keys.ModifierAlt + Keys.I, "Minus(8)", 2) Input.KeyBindDown(Keys.ModifierAlt + Keys.O, "Minus(9)", 2) Input.KeyBindDown(Keys.S, "PlusGfx()", 2) Input.KeyBindDown(Keys.A, "MinusGfx()", 2) Input.KeyBindDown(Keys.D, "SetParam(1)", 2) Input.KeyBindDown(Keys.F, "SetParam(2)", 2) Input.KeyBindDown(Keys.G, "SetParam(3)", 2) Input.KeyBindDown(Keys.H, "SetWeather(1)", 2) Input.KeyBindDown(Keys.J, "SetWeather(2)", 2) Input.KeyBindDown(Keys.K, "SetWeather(3)", 2) Input.KeyBindDown(Keys.L, "Ausgabe()", 2) Input.KeyBindDown(Keys.X, "Info()", 2) Input.KeyBindDown(Keys.Y, "Tools.ExploreArea(-1,-1,900) Input.KeyBindDown(Keys.Y, '', 2)", 2) StartSimpleHiResJob("TheJob") end function Info() if infon then CloseMovieWindow() else MovieWindow(infotitle,infotext) end infon = not infon end function MovieWindow(_Title,_Text) XGUIEng.ShowWidget(XGUIEng.GetWidgetID("Movie"),1) XGUIEng.ShowWidget(XGUIEng.GetWidgetID("Cinematic_Text"),0) XGUIEng.ShowWidget(XGUIEng.GetWidgetID("MovieBarTop"),0) XGUIEng.ShowWidget(XGUIEng.GetWidgetID("MovieBarBottom"),0) XGUIEng.ShowWidget(XGUIEng.GetWidgetID("CreditsWindowLogo"),0) XGUIEng.ShowWidget(XGUIEng.GetWidgetID("MovieInvisibleClickCatcher"),0) XGUIEng.SetText(XGUIEng.GetWidgetID("CreditsWindowTextTitle"),_Title) XGUIEng.SetText(XGUIEng.GetWidgetID("CreditsWindowText"),_Text) end function CloseMovieWindow() XGUIEng.ShowWidget(XGUIEng.GetWidgetID("Movie"),0) end function SetWeather(_w) geaendert = true weather = _w Logic.AddWeatherElement(weather, 1000, 0, gfx, 1, 2) end function PlusGfx() local _gfx = gfx + 1 if _gfx >= 20 then _gfx = 1 end SetGfx(_gfx) end function MinusGfx() local _gfx = gfx - 1 if _gfx > 0 then SetGfx(_gfx) end end function SetGfx(_gfx) geaendert = true gfxgeaendert = true gfx = _gfx if not params[gfx] then params[gfx] = { {1, 152,172,182, 5000,22000}, {40, -15, -50, 120,130,110, 205,204,180}, {0, 0, 0, 7}, } end Logic.AddWeatherElement(weather, 1000, 0, gfx, 1, 2) --Logic.AddWeatherElement(_state,_duration,_periodic,_gfxset,_forerun,_transition) end function Ausgabe() local text = "\n\n Display.GfxSetSetFogParams( " .. gfx .. ", 0, 1" for i,v in ipairs(params[gfx][1]) do text = text .. ", " .. v end text = text .. " )\n Display.GfxSetSetLightParams( " .. gfx .. ", 0, 1" for i,v in ipairs(params[gfx][2]) do text = text .. ", " .. v end text = text .. " )\n Display.GfxSetSetRainEffectStatus( " .. gfx .. ", 0, 1, " .. params[gfx][3][1] .. " )\n Display.GfxSetSetSnowEffectStatus( " .. gfx .. ", 0, 1, " .. params[gfx][3][2] .. " )\n Display.GfxSetSetSnowStatus( " .. gfx .. ", 0, 1, " .. params[gfx][3][3] .. " )\n Display.GfxSetSetSkyBox( " .. gfx .. ", 0, 1, \"YSkyBox0" .. params[gfx][3][4] .. "\" )\n function AddPeriodic<name>(_dauer)\n Logic.AddWeatherElement( " .. weather .. ", _dauer, 1, " .. gfx .. ", 5, 15)\n end" .. "\n function Start<name>(_dauer)\n Logic.AddWeatherElement( " .. weather .. ", _dauer, 0, " .. gfx .. ", 5, 15)\n end \n" assert(false,text) end function SetParam(_param) geaendert = true param = _param end function TheJob() if geaendert then geaendert = false if gfxgeaendert then gfxgeaendert = false Display.GfxSetSetFogParams(gfx, 0, 1, unpack(params[gfx][1])) Display.GfxSetSetLightParams(gfx, 0, 1, unpack(params[gfx][2])) Display.GfxSetSetRainEffectStatus(gfx, 0, 1, params[gfx][3][1]) Display.GfxSetSetSnowEffectStatus(gfx, 0, 1, params[gfx][3][2]) Display.GfxSetSetSnowStatus(gfx, 0, 1, params[gfx][3][3]) Display.GfxSetSetSkyBox(gfx, 0, 1, "YSkyBox0" .. params[gfx][3][4]) elseif param == 1 then Display.GfxSetSetFogParams(gfx, 0, 1, unpack(params[gfx][1])) elseif param == 2 then Display.GfxSetSetLightParams(gfx, 0, 1, unpack(params[gfx][2])) elseif param == 3 then Display.GfxSetSetRainEffectStatus(gfx, 0, 1, params[gfx][3][1]) Display.GfxSetSetSnowEffectStatus(gfx, 0, 1, params[gfx][3][2]) Display.GfxSetSetSnowStatus(gfx, 0, 1, params[gfx][3][3]) Display.GfxSetSetSkyBox(gfx, 0, 1, "YSkyBox0" .. params[gfx][3][4]) end local paranam = paranames[param] local text = "AS Gfx: " .. gfx .. "\nHJK weather: " .. weather .. "\n\nDFG " .. paranam.title for i,v in ipairs(params[gfx][param]) do text = text .. "\n" .. buchstabens[i] .. " " .. paranam[i] .. ": " .. v end text = text .. "\n\nL Print\nY Explore\nX Manual" GUI.MiniMapDebug_SetText(text) end end function Plus(_num) geaendert = true if param == 1 then if _num == 1 then params[gfx][1][1] = 1 - params[gfx][1][1] elseif _num == 2 then params[gfx][1][2] = math.min(params[gfx][1][2] + 1, 255) elseif _num == 3 then params[gfx][1][3] = math.min(params[gfx][1][3] + 1, 255) elseif _num == 4 then params[gfx][1][4] = math.min(params[gfx][1][4] + 1, 255) elseif _num == 5 then params[gfx][1][5] = params[gfx][1][5] + 200 elseif _num == 6 then params[gfx][1][6] = params[gfx][1][6] + 200 end elseif param == 2 then if _num == 1 then params[gfx][2][1] = params[gfx][2][1] + 10 elseif _num == 2 then params[gfx][2][2] = params[gfx][2][2] + 10 elseif _num == 3 then params[gfx][2][3] = params[gfx][2][3] + 10 elseif _num == 4 then params[gfx][2][4] = math.min(params[gfx][2][4] + 1, 255) elseif _num == 5 then params[gfx][2][5] = math.min(params[gfx][2][5] + 1, 255) elseif _num == 6 then params[gfx][2][6] = math.min(params[gfx][2][6] + 1, 255) elseif _num == 7 then params[gfx][2][7] = math.min(params[gfx][2][7] + 1, 255) elseif _num == 8 then params[gfx][2][8] = math.min(params[gfx][2][8] + 1, 255) elseif _num == 9 then params[gfx][2][9] = math.min(params[gfx][2][9] + 1, 255) end elseif param == 3 then if _num == 1 then params[gfx][3][1] = 1 - params[gfx][3][1] elseif _num == 2 then params[gfx][3][2] = 1 - params[gfx][3][2] elseif _num == 3 then params[gfx][3][3] = 1 - params[gfx][3][3] elseif _num == 4 then params[gfx][3][4] = params[gfx][3][4] + 1 if params[gfx][3][4] >= 8 then params[gfx][3][4] = 1 end end end end function Minus(_num) geaendert = true if param == 1 then if _num == 1 then params[gfx][1][1] = 1 - params[gfx][1][1] elseif _num == 2 then params[gfx][1][2] = math.max(params[gfx][1][2] - 1, 0) elseif _num == 3 then params[gfx][1][3] = math.max(params[gfx][1][3] - 1, 0) elseif _num == 4 then params[gfx][1][4] = math.max(params[gfx][1][4] - 1, 0) elseif _num == 5 then params[gfx][1][5] = params[gfx][1][5] - 200 elseif _num == 6 then params[gfx][1][6] = params[gfx][1][6] - 200 end elseif param == 2 then if _num == 1 then params[gfx][2][1] = params[gfx][2][1] - 10 elseif _num == 2 then params[gfx][2][2] = params[gfx][2][2] - 10 elseif _num == 3 then params[gfx][2][3] = params[gfx][2][3] - 10 elseif _num == 4 then params[gfx][2][4] = math.max(params[gfx][2][4] - 1, 0) elseif _num == 5 then params[gfx][2][5] = math.max(params[gfx][2][5] - 1, 0) elseif _num == 6 then params[gfx][2][6] = math.max(params[gfx][2][6] - 1, 0) elseif _num == 7 then params[gfx][2][7] = math.max(params[gfx][2][7] - 1, 0) elseif _num == 8 then params[gfx][2][8] = math.max(params[gfx][2][8] - 1, 0) elseif _num == 9 then params[gfx][2][9] = math.max(params[gfx][2][9] - 1, 0) end elseif param == 3 then if _num == 1 then params[gfx][3][1] = 1 - params[gfx][3][1] elseif _num == 2 then params[gfx][3][2] = 1 - params[gfx][3][2] elseif _num == 3 then params[gfx][3][3] = 1 - params[gfx][3][3] elseif _num == 4 then params[gfx][3][4] = params[gfx][3][4] - 1 if params[gfx][3][4] <= 0 then params[gfx][3][4] = 7 end end end end
____________________
"Wer im Glashaus sitzt, sollte sich im Dunkeln ausziehen."
- Ein schlauer Mensch
mundn
|
#2 08.11.2018 13:39 Beiträge: 83 |
gleich mal ausprobieren
____________________
Scripten bei Master pewe in DEdK Script-Wiki gelernt ich habe.
Seiten: 1