Satelliten Mod Beta

Hier ist der ideale Ort um über Scripts und Mods für X²: Die Bedrohung zu diskutieren.

Moderators: Moderatoren für Deutsches X-Forum, Scripting / Modding Moderators

Post Reply
lutschkuchen
Posts: 17
Joined: Thu, 1. Nov 07, 14:50
x4

Satelliten Mod Beta

Post by lutschkuchen » Thu, 6. Dec 07, 23:47

Hallo erst einmal, an alle X2 Liebhaber.

Ich habe mir ein eigenes Mod geschrieben, welches noch nicht perfekt ist.
Da ich das Spiel und den Scribt Editor erst vor 2 Monaten kennen gelernt habe, bräuchte ich Eure Hilfe.
Bitte schaut Euch das Mod mal an.

Mir ist aufgefallen wenn, ich das Scribt starte und die Zeit nicht abwarte und sofort einen anderen Satellit bestelle, wird nur der letzte aufgestellt.

Die neue Software '' Satelliten Software LK1 '' zu finden in allen Sonder Stationen wie Teracorp Haubt.
In der Schiffs Kommando Konsole unter Spezial sind dann zwei neue Einträge um einen Nav.- bzw. Erw.- Satellit zu bestellen

http://lutschkuchen.dyndns.org/x2_mod/x2_sat.zip

Mit freundlichen Gruß
Tommy

UniTrader
Moderator (Script&Mod)
Moderator (Script&Mod)
Posts: 14571
Joined: Sun, 20. Nov 05, 22:45
x4

Post by UniTrader » Fri, 7. Dec 07, 00:54

der Code aus der Browseransicht hätte den meisten Scriptern gelangt ;)
ich hab mir das ganze jetzt ned runtergeladen weil ich das für so nen kleinkram sinnlos halte.. ausserdem hab ich ne vermutung:

Du hast mit sicherheit deinen Script an einen Schiffskommandoslot gebunden oder?? (warscheinlich ein Erweiterter)
dann hängt es ganz einfach damit zusammen, dass das Script so lange auf dem Slot läuft bis es sich selbst beendet oder anderweitig beendet wird (z.B. durch einen wechsel des Kommandos), auch wenn dies nicht direkt in der Kommandokonsole Sichtbar ist..
if not stated otherwise everything i post is licensed under WTFPL

Ich mache keine S&M-Auftragsarbeiten, aber wenn es fragen gibt wie man etwas umsetzen kann helfe ich gerne weiter ;)

I wont do Script&Mod Request work, but if there are questions how to do something i will GLaDly help ;)

lutschkuchen
Posts: 17
Joined: Thu, 1. Nov 07, 14:50
x4

Post by lutschkuchen » Fri, 7. Dec 07, 13:05

Sorry.

Meine Dateien :

Code: Select all

Script plugin.lk.sat.v1
Version: 1
for Script Engine Version: 25

Description
Arguments
1: arg.sector , Var/Sector Position , 'set Item to Sector Position' 
Source Text

001   * by lutschkuchen
002   
003   set script command: CMD_LK_SAT_V1
004   $prise = 8088
005   $money = get player money
006   $prise.tmp = 0 - $prise
007   $name = [PLAYERSHIP] -> get pilot name
008   $item.sec.x = $arg.sector[0]
009   $item.sec.y = $arg.sector[1]
010   $item.sec.z = $arg.sector[2]
011   $item.sec.name = $arg.sector[3]
012   
013   START speak text: page=13 id=131 priority=25
014 @ $wait = wait randomly from 30000 to 60000 ms
015   if $money < $prise
016    $txt = sprintf: pageid=4371 textid=102, $name, $prise, null, null, null
017    send incoming message $txt to player: display it=0
018    return null
019   end
020   add money to player: $prise.tmp
021 @ $wait = wait randomly from 60000 to 90000 ms
022   $item =  create ship: type=Navigationssatellit owner=Player addto=$item.sec.name x=$item.sec.x y=$item.sec.y z=$item.sec.z
023   $txt = sprintf: pageid=4371 textid=101, $name, $item.sec.name, null, null, null
024   send incoming message $txt to player: display it=0
025   return $item

Code: Select all

Script plugin.lk.sat.v2
Version: 1
for Script Engine Version: 25

Description
Arguments
1: arg.sector , Var/Sector Position , 'set Item to Sector Position' 
Source Text

001   * by lutschkuchen
002   
003   set script command: CMD_LK_SAT_V2
004   $prise = 15842
005   $money = get player money
006   $prise.tmp = 0 - $prise
007   $name = [PLAYERSHIP] -> get pilot name
008   $item.sec.x = $arg.sector[0]
009   $item.sec.y = $arg.sector[1]
010   $item.sec.z = $arg.sector[2]
011   $item.sec.name = $arg.sector[3]
012   
013   START speak text: page=13 id=131 priority=25
014 @ $wait = wait randomly from 30000 to 60000 ms
015   if $money < $prise
016    $txt = sprintf: pageid=4371 textid=102, $name, $prise, null, null, null
017    send incoming message $txt to player: display it=0
018    return null
019   end
020   add money to player: $prise.tmp
021 @ $wait = wait randomly from 60000 to 90000 ms
022   $item =  create ship: type=Erweiterter Satellit owner=Player addto=$item.sec.name x=$item.sec.x y=$item.sec.y z=$item.sec.z
023   $txt = sprintf: pageid=4371 textid=101, $name, $item.sec.name, null, null, null
024   send incoming message $txt to player: display it=0
025   return $item

Code: Select all

Script init.plugin.lk.sat
Version: 1
for Script Engine Version: 25

Description
Arguments
Source Text

001   load text: id=4371
002   
003   * Taking unused standard product of X2
004   $shipupgrade = Satelliten Software LK1
005   
006   * Install product at TerraCorp HQ and secret stations
007   $SellStations =  array alloc: size=0
008   $Sector = get sector from universe index: x=1, y=4
009   $SellStation =  find station: sector=$Sector class or type=Equipment Dock race=Argonen flags=null refobj=null maxdist=null maxnum=1 refpos=null
010   if $SellStation -> exists
011    append $SellStation to array $SellStations
012   end
013   $Sector = get sector from universe index: x=3, y=6
014   $SellStation =  find station: sector=$Sector class or type=Equipment Dock race=Paraniden flags=null refobj=null maxdist=null maxnum=1 refpos=null
015   if $SellStation -> exists
016    append $SellStation to array $SellStations
017   end
018   $Sector = get sector from universe index: x=8, y=9
019   $SellStation =  find station sells: resource Lebenserhaltung für Frachtraum with min. jumps: max.price=null, amount=null, max.jumps=0, startsector=$Sector, trader=null
020   if $SellStation -> exists
021    append $SellStation to array $SellStations
022   end
023   $Sector = get sector from universe index: x=15, y=6
024   $SellStation =  find station sells: resource Triplex Scanner with min. jumps: max.price=null, amount=null, max.jumps=0, startsector=$Sector, trader=null
025   if $SellStation -> exists
026    append $SellStation to array $SellStations
027   end
028   $counter =  size of array $SellStations
029   while $counter > 0
030    dec $counter = 
031    $EQDOCK = $SellStations[$counter]
032    if $EQDOCK -> exists
033     if not $EQDOCK -> trades with ware $shipupgrade
034      $EQDOCK -> add product to factory or dock: $shipupgrade
035      $setamount = $EQDOCK -> add 1 units of $shipupgrade
036     end
037    end
038   end
039   
040   * If in mod universe or all stations above are destroyed
041   * install product on Equiment Docks in galaxy
042   $SizeSellStations =  size of array $SellStations
043   if $SizeSellStations == 0
044    $stationclass1 = Equipment Dock
045    $maxsectX = get max sectors in x direction
046    while $maxsectX > 0
047     dec $maxsectX = 
048     $maxsectY = get max sectors in y direction
049     while $maxsectY > 0
050      dec $maxsectY = 
051      $sectorname = get sector from universe index: x=$maxsectX, y=$maxsectY
052      $EQDOCK =  find station: sector=$sectorname class or type=$stationclass1 race=null flags=[Find.Nearest] refobj=null maxdist=null maxnum=null refpos=null
053      if $EQDOCK -> exists
054       if not $EQDOCK -> trades with ware $shipupgrade
055        $EQDOCK -> add product to factory or dock: $shipupgrade
056        $setamount = $EQDOCK -> add 1 units of $shipupgrade
057       end
058      end
059     end
060    end
061   end
062   
063   * Bind new commands to ships and product
064   global script map: set: key=CMD_LK_SAT_V1, class=Moveable Ship, race=Player, script='plugin.lk.sat.v1', prio=0
065   set script command upgrade: command=CMD_LK_SAT_V1  upgrade=$shipupgrade
066   
067   global script map: set: key=CMD_LK_SAT_V2, class=Moveable Ship, race=Player, script='plugin.lk.sat.v2', prio=0
068   set script command upgrade: command=CMD_LK_SAT_V2  upgrade=$shipupgrade
069   
070   return null

Code: Select all

494371.xml

<?xml version="1.0" encoding="UTF-8" ?>
<language id="49">
	
	<page id="17" title="Boardcomp. objects"> 
 		<t id="5793">Satelliten Software LK1</t>
		<t id="5794">{17,5665}</t>
	</page>

	<page id="2008" title="Befehlsmenue und Befehl" descr="Typ des Kommandomenues (5) und Kommandonummer (11,12)">
		<t id="511">CMD_LK_SAT_V1</t>
		<t id="512">CMD_LK_SAT_V2</t>
	</page>
	
	<page id="2010" title="Befehlsnamen lang" descr="Langversion der Befehle, im Schiff in der Kommandokonsole links und in der Schiffsinfo.">
		<t id="511">\033AS.P.S.\033X Navigationssatellit bestellen</t>
		<t id="512">\033AS.P.S.\033X Erweiterter Satellit bestellen</t>
	</page>

	<page id="2011" title="Befehlsnamen kurz" descr="Kurzversion der Befehle, im Schiff in der Kommandokonsole rechts und im Cockpit.">
		<t id="511">SAT.v1</t>
		<t id="512">SAT.v2</t>
	</page>

	<page id="2022" title="Befehlsinfos" descr="Befehlserklärungen. Mit Taste i im Kommandomenü abrufbar.">
		<t id="511">Diese Software nimmt eine Satelliten Bestellung entgegen.\nIhr \033YNavigationssatellit\033X wird an die ausgewählte Position ausgeliefert und aufgestellt. Für den Aufstell-Service entstehen Ihnen Kosten von \033Y8088 Cr.\033X inklusive Satellit.</t>
		<t id="512">Diese Software nimmt eine Satelliten Bestellung entgegen.\nIhr \033YErweiterter Satellit\033X wird an die ausgewählte Position ausgeliefert und aufgestellt. Für den Aufstell-Service entstehen Ihnen Kosten von \033Y15842 Cr.\033X inklusive Satellit.</t>
	</page>
		
	<page id="4371" title="lk437" descr="Nachrichten vom Script an den Spieler.">
		<t id="100">[author]Satelliten Positionier Server Alpha[/author]\n</t>
		<t id="101">{4371,100}Hallo \033Y%s\033X.\nWir haben gerade die Bestätigung von unseren Frachter bekommen,\ndas Ihr bestellter Satellit in \033Y%s\033X  aufgestellt wurde.{4371,199}</t>
		<t id="102">{4371,100}Hallo \033Y%s\033X,\nbitte prüfen Sie Ihre \033RFinanzmittel\033X.\nWir konnten den Betrag von \033Y%s Cr.\033X\nnicht von Ihrem Konto abbuchen.\nIhre Bestellung wurde \033Rstorniert\033X.{4371,199}</t>
		<t id="199">\n\n\033B© Khrem & Faa Service Corporation\033X\n\033BRoter Schein\033X</t>
	</page>
</language>
Mit freundlichen Gruß
Tommy

Post Reply

Return to “X²: Die Bedrohung - Scripts und Modding”