|
-
Zitat von Frank-95
In the original zens there are some vobtrees (like torches or candles) which I would like to replace with my owns. The mesh is the same but I changed lights/sounds/things. Replacing one by one in the spacer would be suicidal. Via zSlang it would be pretty easier, but it's not impossible via python either (much longer though).
Well, it is the function itself that makes zSpy crash
Code:
#include<stdlib.zsl>
func void main()
{
WLD_LoadWithoutMesh("C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\NewWorld\NewWorld_Part_Farm_01.zen");
//WLD_Save("C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\NewWorld\NewWorld_Part_Farm_02.zen");
}
Windows box opens up saying "zSpyInterpreter.exe has stopped working"
I might not have time to look into this in the upcoming two weeks. You could write another post here in two weeks if you're still looking for an answer.
Some ideas right away:
1) I think you could just change (overwrite) the .zen of the vobtree that you want to replace. If I remember correctly, even in the game, the objects of the vobtree are loaded from the separate .zen file and are NOT directly in the world itself. At least we had some issues with changed light-vobtrees that were triggered at night (Wld_SetVobRoutine or whatever it's called).
2) The spacer has an option to save a .zen uncompiled. This seems to be exactly what you want?
3) Your crash problem might be due to the path of the .zen file. Maybe you can try a path without spaces, deal with the backslash differently (maybe it's escaping characters?), and put your .zen file outside the Program Files directory. In the zSlang .ini there is a setting that you can use to say where it should look for .zen files.
4) Alternatively, first load and empty .zen and then use Wld_Merge. I have definitely frequently used that function, so it should, in principle, work properly.
Geändert von Milky-Way (21.06.2017 um 16:44 Uhr)
-
Zitat von Varus91
Hallo (:
Könnte mir einer der technisch begabten evtl. sagen, ob es per zlang möglich ist, sämtliche Items aus einer .zen zu löschen? Gegebenenfalls sogar den Script geben?
Scripten ist leider nicht so mein Ding o.o
Danke, falls sich jemand die Mühe macht.
Ja, das ist recht einfach, siehe Skript:
Code:
#include <stdlib.zsl>
func void main(){
Warn("Hello ZSpy");
Info("Welt laden.");
WLD_Load("World.ZEN");
Info("alle Items selektieren.");
var selection sel = WLD_GetVobsOfClass("oCItem");
Info("durch alle Items durchgehen und sie entfernen.");
foreach it in sel
{
// Item entfernen
WLD_DeleteGentle(it);
}
Info("Welt speichern.")
WLD_Save("World.ZEN");
}
So in etwa sollte es wohl aussehen. Ich habe es nicht getestet, könnte also noch kleinere Schwierigkeiten geben.
Items aus Truhen werde so NICHT entfernt.
Lies dir bitte die zSlang Doku durch, um zu verstehen, wie du so ein Skript ausführen kannst und wo du die Welt vorher speichern musst und wo sie nachher hin soll.
-
Neuling
Hat leider nicht geklappt ):
Code:
00:00 ++++++++++++++ Start by ++++++++++++++
00:00 Info: Hello, this is zSlangInterpreter 1.0, compiled on Sep 4 2012, 16:20:17.
00:00 Info: Running script C:\Games\Gothic 2 Gold\System\items löschen.zsl...
00:00 Info: Calling preprocessor via: .\_intern\mcpp.exe -P -I "C:\Game\Gothic 2 Gold\System\include" -I "C:\Modding\Gothic 2 Gold\System" "C:\Games\Gothic 2 Gold\System\items löschen.zsl" -Q -o "C:\Modding\Gothic 2 Gold\System\_intern\preprocessorOutput.zsl"
00:00 Warn: There where the following warnings during preprocessing:
00:00 Warn: C:/Games/Gothic 2 Gold/System/items löschen.zsl:17: warning: End of input with no newline, supplemented newline
00:00 Warn: }
00:00 Warn: [end of preprocessor messages.]
00:00 Info: Preprocessor finished successfully.
00:00 Info: ScriptParser compiled on Sep 3 2012, 12:10:22.
00:00 Info: Reading file: "C:\Games\Gothic 2 Gold\System\_intern\preprocessorOutput.zsl"...
00:00 Info: DONE. Parsing...
00:01 Fault: Expecting ";" while parsing <statement>, while parsing <statement-block>, while parsing <function declaration>
-
War hier ein recht kleiner Fehler, hier die korrigierte Version:
Code:
#include <stdlib.zsl>
func void main(){
Warn("Hello ZSpy");
Info("Welt laden.");
WLD_Load("World.ZEN");
Info("alle Items selektieren.");
var selection sel = WLD_GetVobsOfClass("oCItem");
Info("durch alle Items durchgehen und sie entfernen.");
foreach it in sel
{
// Item entfernen
WLD_DeleteGentle(it);
}
Info("Welt speichern.");
WLD_Save("World.ZEN");
}
-
Ich hol den Thread mal wieder raus
Vielleicht überseh ich es einfach nur, aber ich finde so direkt keine Lösung für mein Problem: Gibt es in zSlang eigentlich eine Möglichkeit, Zufallszahlen zu generieren?
Problem ist folgendes: Ich habe in einer ZEN mehrere hundert Kerzen-Vobtrees, die natürlich alle das entsprechende Kerzenflammen-Textur-Vob haben. Damit das etwas "natürlicher" aussieht, wollte ich die AniFPS anpassen. Nur, jetzt jedes einzelne Vob auswählen und anpassen... Bääh. Deswegen dachte ich, per zSlang sollte das ja relativ einfach zu lösen sein.
Kennt vielleicht jemand eine solche Möglichkeit?
-
Wie groß soll der Zahlenraum denn sein?
Am einfachsten kannst du dir selber einen PRNG bauen (brauchst ja sicherlich keinen echten Zufall dafür). Lineare Kongruenzgeneratoren sind sehr simpel zu implementieren und sollten für deine Zwecke ausreichen. Ich mach's mal in Daedalus-Syntax, das dürfte aber recht einfach übertragbar sein:
Code:
const int m = 1 << 31; // Werte 0-(INT_MAX-1)
const int a = 1103515245;
const int b = 12345;
var int state;
func int rand() {
state = (a * state + b) % m;
return state;
};
func void seed(var int sd) {
state = sd;
};
Die Werte für m, a und b sind aus BSD entnommen und sorgen für eine maximale Periode (d.h. die Werte sind gleichverteilt). Ein Wert wird sich erst wiederholen, wenn alle anderen Werte gewählt worden sind.
Und während ich das so zusammengesucht habe fällt mir auf, dass es das Script in LeGo sowieso schon gibt:
Code:
/***********************************\
RANDOM
\***********************************/
//========================================
// Zufallsvariablen
//========================================
const int r_val = 0;
//========================================
// Zufallszahl holen
//========================================
func int r_Next() {
r_val = (1103515245 * r_val) + 12345;
if(r_val < 0) {
r_val += 2147483647;
};
return r_val;
};
func int r_Max(var int max) {
return r_Next()%(max+1);
};
func int r_MinMax(var int min, var int max) {
return r_Max(max - min) + min;
};
//========================================
// Zufall initialisieren
//========================================
func void r_Init(var int seed) {
r_val = seed;
r_val = r_Next();
r_val = r_Next();
r_val = r_Next();
};
func void r_DefaultInit() {
CALL__cdecl(sysGetTimePtr);
r_Init(CALL_RetValAsInt());
};
Allerdings mit dem Unterschied, dass der State niemals negativ sein kann. Das könnte (könnte!) dazu führen, dass einige/viele Werte gar nicht getroffen werden. Besser wäre es vermutlich, sich da genau an BSD zu halten und
Code:
const int mod_and = (1 << 31) - 1;
func int r_Next() {
r_val = ((1103515245 * r_val) + 12345) & mod_and;
if(r_val < 0) {
r_val += 2147483647;
};
return r_val;
};
zu benutzen (Modulo von 231 implementiert per x & (231-1), falls Daedalus irgendwas komisches mit Modulo und negativen Zahlen anstellt).
-
-
Benutz einfach die Funktion r_MinMax(min, max), da siehst du ja wie man den Zahlenbereich beschränkt. Ansonsten könntest du dir auch einfach ein paar 100 Zufallszahlen außerhalb von zSlang generieren lassen und einfach hardcoden. Du willst ja nur eine Streuung, keinen wirklichen Zufall.
-
-
Eigentlich passt das ja nicht ganz zum Gothic-Modding, aber ich packs trotzdem mal hier rein.
Mein Problem mit den mehreren hundert Kerzen (um genau zu sein sind es zum jetzigen Zeitpunkt 1237 Kerzen ) bestand immer noch. Da ich mit zSlang nicht auf die Eigenschaft zugreifen konnte, habe ich mir einen anderen Lösungsweg gesucht. Das Stichwort ist hierbei: PowerShell.
Ja, PowerShell. Hätte nicht gedacht, dass ich diese Abart von Bash mal nützlich finden könnte, aber es ist tatsächlich passiert. Folgendermaßen bin ich vorgegangen:
Die ZEN habe ich als uncompiled ascii abgespeichert. Nun hat jede Kerzenflamme den Standardwert 9.00000381 als decalDimBlaBla (sorry, hab die genaue Bezeichnung grad nicht im Kopp). Folgendes Script setzt diesen Wert nun auf Zufallszahlen:
Code:
$fileName = "C:\Users\danie\SCREENASCII.ZEN"
$impZen = Get-Content $fileName
$newZen = $impZen |
ForEach-Object {
$_ -creplace "9.00000381",(Get-Random -Minimum 8 -Maximum 13)
}
$newZen | Set-Content C:\Users\danie\SCREENRAND.ZEN
Die sieben Zeilen Code könnte man bestimmt noch kürzen, aber so funktioniert es wunderbar.
Heraus kommt dabei (in meinem Fall) die Datei SCREENRAND.ZEN, welche widerum mit dem Spacer geöffnet, kompiliert und normal abgespeichert werden kann.
Die Lösung ist vielleicht nicht optimal, aber insgesamt angenehmer, als 1237 Werte von Hand zu setzen.
Wer weiß, vielleicht kann so ein Script für den ein oder anderen nochmal nützlich sein.
-
Zitat von Dada
Das Stichwort ist hierbei: PowerShell.
Ja, PowerShell. Hätte nicht gedacht, dass ich diese Abart von Bash mal nützlich finden könnte, aber es ist tatsächlich passiert.
Rein aus Interesse: wenn du PowerShell nicht magst, wieso hast du dann nicht was anderes genommen?
Aber danke fürs Teilen deiner Lösung!
-
Öhm.. Weil ich bisher nicht damit umgehen konnte. Dachte immer, das wär' nur ne minimal aufgebohrte CMD.
Jetzt durfte ich durch die Ausbildung mal 'ne Woche in die richtige PowerShell-Benutzung reinschnuppern und hab gemerkt, dass es sich tatsächlich lohnen kann, damit auseinanderzusetzen.
Natürlich könnte man das auch mit anderen Mitteln lösen. Ich dachte nur, falls jemand mal ein ähnliches Problem hat, mag er vielleicht auf Windows-Bordmittel zurückgreifen und nicht noch irgendwelche zusätzlichen Compiler anwerfen
-
Hello! I wrote a code to replace certain vobs with predefined vobtrees, but it freezes after a while and I don't know why:
Code:
#include<stdlib.zsl>
func void main()
{
WLD_Load("C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\NewWorld\NewWorld_Part_GreatPeasant_01.zen");
var selection vobs = WLD_GetVobs();
foreach vob in vobs
{
if(vob)
{
var object x = vob.parent;
if (x)
{
if (vob.className == "zCVobSound")
{
if (x.className == "zCVobLevelCompo") && (vob.sndName == "TORCH_BURN")
{
WLD_DeleteGentle(vob);
}
else
{
vob.name = vob.sndName;
}
}
else if (x.className == "zCVobLevelCompo") && ((vob.visual == "ZFLARE6.TGA") || (vob.visual == "FIRE_COMPLETE_A0.TGA"))
{
WLD_DeleteGentle(vob);
}
}
}
}
foreach vob in vobs
{
if(vob)
{
if (vob.visual == "DT_LIGHTER_PENTAGRAMM.3DS")
{
WLD_ReplaceWithVobtree(vob,"C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_CANDELABRUM.ZEN");
}
else if (vob.visual == "NW_CITY_CANDLE_01.3DS")
{
WLD_ReplaceWithVobtree(vob,"C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_CANDLE.ZEN");
}
else if (vob.visual == "NW_CITY_CANDLELANTERN_01.3DS")
{
WLD_ReplaceWithVobtree(vob,"C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_DOUBLECANDLE.ZEN");
}
else if (vob.visual == "CAMPFIRE_NORMAL.ASC")
{
WLD_ReplaceWithVobtree(vob,"C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_DYNAMICCAMPFIRE.ZEN");
}
else if (vob.visual == "NW_CITY_CANDLELANTERN_03.3DS")
{
WLD_ReplaceWithVobtree(vob,"C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_HANGINGCANDLE.ZEN");
}
else if (vob.visual == "NW_CITY_OILLAMP_01.3DS")
{
WLD_ReplaceWithVobtree(vob,"C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_OILLAMP.ZEN");
}
else if (vob.visual == "NW_MISC_FIREPLACE_01.3DS")
{
WLD_ReplaceWithVobtree(vob,"C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_STATICCAMPFIRE.ZEN");
}
else if (vob.visual == "NW_CITY_CANDLELANTERN_02.3DS")
{
Info("CAREFUL!!");
Info("CAREFUL!!");
Info("CAREFUL!!");
WLD_ReplaceWithVobtree(vob,"C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_WALLCANDLE.ZEN");
}
else if (vob.visual == "OW_MISC_WALL_TORCH_01.3DS")
{
WLD_ReplaceWithVobtree(vob,"C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_WALLTORCH.ZEN");
}
else if (vob.className != "zCVobLevelCompo")
{
WLD_FlattenVobtreeAt(vob);
}
}
}
Info("got heeeeeere");
WLD_Save("C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\NewWorld\NewWorld_Part_GreatPeasant_02.zen");
}
The last output lines are these:
Code:
[w] 00:08 Warn: POS_SetRotMat: The given matrix has slight errors (Error = 0.0104397818). This may be due to rounding errors and probably no problem. Use ALG_NormalizeMat to resolve the problem.
[w] 00:08 Warn: POS_SetRotMat: The given matrix has slight errors (Error = 0.000136347543). This may be due to rounding errors and probably no problem. Use ALG_NormalizeMat to resolve the problem.
[w] 00:08 Warn: POS_SetRotMat: The given matrix has slight errors (Error = 0.00111933848). This may be due to rounding errors and probably no problem. Use ALG_NormalizeMat to resolve the problem.
[w] 00:08 Warn: POS_SetRotMat: The given matrix has slight errors (Error = 0.000136347543). This may be due to rounding errors and probably no problem. Use ALG_NormalizeMat to resolve the problem.
[w] 00:08 Warn: POS_SetRotMat: The given matrix has slight errors (Error = 0.000146596439). This may be due to rounding errors and probably no problem. Use ALG_NormalizeMat to resolve the problem.
[i] 00:08 Info: Merging World "C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_STATICCAMPFIRE.ZEN".
[i] 00:08 Info: Unarchiving zen file...
[i] 00:08 Info: Unarchiving header...
[i] 00:08 Info: Done. Reading world data...
[i] 00:08 Info: Reading vobtree chunk...
[i] 00:08 Info: Done.
[i] 00:08 Info: Done.
[i] 00:08 Info: Vobtree found.
[i] 00:08 Info: No waynet found.
[i] 00:08 Info: World loaded. 11 numbered chunks read.
[i] 00:08 Info: Merging World "C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_STATICCAMPFIRE.ZEN".
[i] 00:08 Info: Unarchiving zen file...
[i] 00:08 Info: Unarchiving header...
[i] 00:08 Info: Done. Reading world data...
[i] 00:08 Info: Reading vobtree chunk...
[i] 00:08 Info: Done.
[i] 00:08 Info: Done.
[i] 00:08 Info: Vobtree found.
[i] 00:09 Info: No waynet found.
[i] 00:09 Info: World loaded. 11 numbered chunks read.
[i] 00:09 Info: Merging World "C:\Program Files (x86)\Gothic 2 Gold\_work\data\Worlds\VOBTREE_OILLAMP.ZEN".
[i] 00:09 Info: Unarchiving zen file...
[i] 00:09 Info: Unarchiving header...
[i] 00:09 Info: Done. Reading world data...
[i] 00:09 Info: Reading vobtree chunk...
[i] 00:09 Info: Done.
[i] 00:09 Info: Done.
[i] 00:09 Info: Vobtree found.
[i] 00:09 Info: No waynet found.
[i] 00:09 Info: World loaded. 4 numbered chunks read.
Moreover I'm sure that I already used this script months ago, but I don't recall if I did some changes to it.
It looks strange to me :/
-
It's possible to create Zen Converter with this program? I tried but program convert only waypoints and light vobs :/
-
Zitat von Siemekk
It's possible to create Zen Converter with this program? I tried but program convert only waypoints and light vobs :/
Your plan is to convert a G1 .zen into a G2 .zen (or the other way around)?
I don't think that will work. There are small differences in how the world mesh is stored in G1 and G2 .zen files (based on the Kerrax Importer for Blender causing issues for G1 .zen -- I'd expect the people of the ReGoth project to know more about this), and zSlang does not modify the world mesh at all (beyond discarding it / replacing it with a different world mesh).
-
Hallo,
ich möchte per zSlang die Positionen von allen Truhen (oCMobContainer) in eine Textdatei schreiben lassen, die keine Items enthalten. Nach einer längeren Suche habe ich das hier von Lehona gefunden und das Beispiel etwas angepasst. Problem ist, dass es bei mir irgendwie nicht funktionieren will. Die Output.txt bleibt leer...
In der zSpyOutput.ze-Datei steht:
Code:
00:00 ++++++++++++++ Start by ++++++++++++++00:00 Info: Hello, this is zSlangInterpreter 1.0, compiled on Sep 4 2012, 16:20:17.
00:00 Info: Running script F:\Gothic - Modzeug\Tools\zSlang\zSpyOutput.ze...
00:00 Info: Calling preprocessor via: .\_intern\mcpp.exe -P -I "F:\Gothic - Modzeug\Tools\zSlang\include" -I "F:\Gothic - Modzeug\Tools\zSlang" "F:\Gothic - Modzeug\Tools\zSlang\zSpyOutput.ze" -Q -o "F:\Gothic - Modzeug\Tools\zSlang\_intern\preprocessorOutput.zsl"
00:00 Info: Preprocessor finished successfully.
00:00 Info: ScriptParser compiled on Sep 3 2012, 12:10:22.
00:00 Info: Reading file: "F:\Gothic - Modzeug\Tools\zSlang\_intern\preprocessorOutput.zsl"...
00:00 Info: DONE. Parsing...
00:00 Fault: Unrecognized input:
00:00 Fault: -4- 00:00 ++++++++++++++ Start by ++++++++++++++
00:00 Fault: There have been parsing errors.
So sieht das Skript aus:
Code:
#include<stdlib.zsl>
#include<zslExport.zsl>
func void main()
{
Warn("zSpy");
WLD_Load("F:\Gothic - Modzeug\Gothic 2 - Velen\Gothic 2 - Velen (Moddingordner)\_work\data\Worlds\Velen\DIV_VELEN_01.ZEN");
var selection containers; containers = WLD_GetVobsOfClass("oCMobContainer");
Warn(containers.size);
Exp_Open("F:\Gothic - Modzeug\Tools\zSlang\Output.txt");
foreach vob in containers
{
Exp_WriteLine(""+vob.pos[0]+" "+vob.pos[1]+" "+vob.pos[2]);
}
Exp_Close();
}
-
Ich hab's gerade nochmal runtergeladen und ausprobiert und es funktioniert problemlos bei mir. Führst du die .zse-Datei auch mit der zslExport.bat aus?
Wobei das eher auf einen Fehler mit zSlang selber (bzw. deinem Code) hinweist. Schau doch mal in die preprocessorOutput.zsl, was da drin steht, denn da scheint der erste Fehler aufgetreten zu sein.
-
Zitat von Lehona
Ich hab's gerade nochmal runtergeladen und ausprobiert und es funktioniert problemlos bei mir. Führst du die .zse-Datei auch mit der zslExport.bat aus?
Wobei das eher auf einen Fehler mit zSlang selber (bzw. deinem Code) hinweist. Schau doch mal in die preprocessorOutput.zsl, was da drin steht, denn da scheint der erste Fehler aufgetreten zu sein.
Habe das gerade auch nochmal erneut heruntergeladen und die vorherigen Dateien durch diese ersetzt, leider wieder das gleiche...
In der preprocessorOutput.zsl steht nur das hier:
Code:
-4- 00:00 ++++++++++++++ Start by ++++++++++++++-4- 00:00 Info: Hello, this is zSlangInterpreter 1.0, compiled on Sep 4 2012, 16:20:17.
-4- 00:00 Info: Running script F:\Gothic - Modzeug\Tools\zSlang\examples\zSpyOutput.ze...
-4- 00:00 Info: Calling preprocessor via: .\_intern\mcpp.exe -P -I "F:\Gothic - Modzeug\Tools\zSlang\include" -I "F:\Gothic - Modzeug\Tools\zSlang\examples" "F:\Gothic - Modzeug\Tools\zSlang\examples\zSpyOutput.ze" -Q -o "F:\Gothic - Modzeug\Tools\zSlang\_intern\preprocessorOutput.zsl"
-
EDIT: Ich habe das Skript nun einfach so umgeschrieben, dass es mir die Positionen direkt in zSpy anzeigt. Falls es jemand braucht:
Code:
#include<stdlib.zsl>
func void main()
{
Warn("zSpy");
WLD_Load("F:\Gothic - Modzeug\Gothic 2 - Velen\Gothic 2 - Velen (Moddingordner) - Mit alternativem Ende\_work\data\Worlds\Velen\DIV_VELEN_01.ZEN");
var selection containers; containers = WLD_GetVobsOfClass("oCMobContainer");
Warn(containers.size);
foreach vob in containers
{
Warn(""+vob.pos[0]+" "+vob.pos[1]+" "+vob.pos[2]);
}
}
Geändert von Bloodfly91 (04.05.2019 um 04:52 Uhr)
-
08.05.2019 16:59
#80
Kann man mit dem Tool bestehenden Inhalt von Truhen bearbeiten bzw. items hinzufügen?
Habe versucht etwas zu finden ohne die *.Zen im Spacer öffnen zu müssen, weil ich mir nicht die Mod durch den re-compile prozess zerstören möchte.
Berechtigungen
- Neue Themen erstellen: Nein
- Themen beantworten: Nein
- Anhänge hochladen: Nein
- Beiträge bearbeiten: Nein
|
|