1. M6M?

2. Is it the Phoenix?
3. My computer is refusing to let me access the XML for the script, so I'm afraid it'll be a picture of the code on Photobucket, as I can't be bothered to upload.
(Unless someone says I definitely should)
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
Code: Select all
001 * Basic stats...
002 $arr = get warearray for [THIS]
003 $mil = get global variable: name='ej.player.which.military'
004
005 $att = [THIS] -> get attacker
006 $race = [THIS] -> get owner race
007 skip if $att == Player
008 |$attrace = $att -> get owner race
009 $bounty = [THIS] -> get local variable: name='ej.bounty'
010 if $bounty == null
011 |$bounty = 0
012 |send incoming message 'Step1. Stats' to player: display it=[TRUE]
013 |
014 * Multipliers for attackers.
015 |
016 * All races x2 for X,K,Y and Enemy Race
017 * All races x2 for their Enemy
018 * All races x2 for Pirates except Teladi (x1)
019 * All races x0 for any other kills. You dont get paid for friendly fire!
020 |
021 * If the players military, or the race of the attacker is...
022 |
023 |if $mil OR $attrace == Argon
024 ||if $race == Paranid OR Pirates
025 |||$multiplier = 2
026 ||else
027 |||$multiplier = 0
028 ||end
029 ||
030 |else if $mil OR $attrace == Boron
031 ||if $race == Split OR Pirates
032 |||$multiplier = 2
033 ||else
034 |||$multiplier = 0
035 ||end
036 ||
037 |else if $mil OR $attrace == Split
038 ||if $race == Boron OR Pirates
039 |||$multiplier = 2
040 ||else
041 |||$multiplier = 0
042 ||end
043 ||
044 |else if $mil OR $attrace == Paranid
045 ||if $race == Argon OR Pirates
046 |||$multiplier = 2
047 ||else
048 |||$multiplier = 0
049 ||end
050 ||
051 |else if $mil OR $attrace == Teladi
052 ||if $race == Pirates
053 |||$multiplier = 1
054 ||else
055 |||$multiplier = 0
056 ||end
057 ||
058 * If the the race of the attacker is... (player cant join mil. for these races)
059 ||
060 |else if $attrace == Yaki
061 ||$multiplier = 2
062 ||
063 |else if $attrace == Terran
064 ||$multiplier = 0
065 ||
066 |else if $attrace == ATF
067 ||$multiplier = 0
068 ||
069 |else if $attrace == Pirates
070 ||if $race == Teladi
071 |||$multiplier = 1
072 ||else
073 |||$multiplier = 2
074 ||end
075 ||
076 |else if $attrace == Enemy Race
077 ||$multiplier = 2
078 ||
079 |else if $attrace == Kha'ak
080 ||$multiplier = 2
081 ||
082 |else if $attrace == Xenon
083 ||$multiplier = 2
084 ||
085 |end
086 |
087 * If the killed ship is X,K,Y or ER, it x2 to the killer to overide x0s above!
088 |
089 |if $race == Xenon OR Kha'ak OR Yaki OR Enemy Race
090 ||$multiplier = 2
091 |end
092 |
093 |send incoming message 'Step2. Multis' to player: display it=[TRUE]
094 * Works out worth of ship.
095 |
096 |$waretype = [THIS] -> get ware type code of object
097 |$relval = get relvalue of $waretype
098 |if [THIS] == M7
099 ||$shipbase = ( $relval * 65555784 ) / 1000000
100 |else if [THIS] == Colossus
101 ||$shipbase = ( $relval * 49892 ) / 1000
102 |else if [THIS] == Phoenix OR Titan
103 ||$shipbase = ( $relval * 50299 ) / 1000
104 |else
105 ||$shipbase = ( $relval * 807212 ) / 10000
106 |end
107 end
108 send incoming message 'Step3. Values' to player: display it=[TRUE]
109
110 * Works out worth of ships items as minimal
111 $count = size of array $arr
112 while $count
113 |dec $count =
114 |$item = $arr[$count]
115 |$itemworth = get min price of ware $item
116 |$worth = $worth + $itemworth
117 |send incoming message 'Counting through the ships wares...' to player: display it=[TRUE]
118 end
119
120 * Works out worth of ships items plus the base ship cost
121 $finalworth = $worth + $shipbase
122
123 * Player is killer - recieves previous bounties plus worth, affected by a Xplier.
124 if $att == Player
125 |$finalpayout = ( $bounty + $finalworth ) * $multiplier
126 |add money to player: $finalpayout
127 |send incoming message 'You just recieved...' to player: display it=[TRUE]
128 |
129 * Player isnt killer - killer gets worth added to its bounty, which is now found.
130 else if $att != Player
131 |$bounty = $att -> get local variable: name='ej.bounty'
132 |if $bounty == null
133 ||$bounty = 0
134 ||$bounty = ( $bounty + $finalworth ) * $multiplier
135 ||$att -> set local variable: name='ej.bounty' value=$bounty
136 |end
137 end
138
139 * Notes
140
141 * Killed ships belonging to player pass the item & ship worth on when killed.
142 * As you, the pilot, is not dead, theres no bounty.
143
144 * Bounties betweem race doesnt matter.
145 * EG. Pirate kills Xenon, Player as Argon mil. kills Pirate.
146 * Bounty passed on contains a Xenon kill by the pirate.
147 * Surely thats good for the military!? No. Reasoning as such:
148 * Pirate survives Xenon attack, is obviously skilled & a threat therefore.
149 * Pirate -> Xenon bounty is passed on to the player.
150 * Lets say the multiplier has made it huge, Pirates killing Boron.
151 return null
ThanksHeh, I made like everyone of the mistakes you made on my first attempt of a script
(p.s I copied and pasted everything into exscriptor so for indentation, so my line numbers are probably wrong when compared to yours) Ok from the top!
Line 6 -Handy tip
$race = [THIS] -> get owner race
You can use [OWNER], which is identicaly equal to [THIS]->get owner race
ThanksLine 23+ -Handy tip
First huge block of If's and else if's
You should probably have an else in there (just a flat else) to catch unwanted outcomes (it will help in debugging). An error handler here will save much frustration in the future
e.g. else write to player log book, error unexpected race/military + $mil + attrace
line 99 Possible bug/limitation
$shipbase = ( $relval * 65555784 ) / 1000000
will almost certainly cause overflow errors
i.e. The max number is... 2 billion ((2^31) -1) The maths is done from left to right, so if $relval * 65555784 > 2^31 it will overflow. So check to make sure that it is under this limit, other wise change it to something like
( $relval * 6555578 ) / 100000
Or better yet, take out some common factors of both numbers. Hmm... open office is telling me its exactly 6555578 ) / 100000 =65 + 5/9 thou you may want to check, it may be rounding
8194473 125000 is a simple /2 factorisation of the two numbers (div![]()
1. But then it's an object class or a waretype. Still incompatible?Line 97 Bug
if [THIS] == M7
else if [THIS] == Colossus
else if [THIS] == Phoenix OR Titan
else if [THIS] == Phoenix OR Titan
1. [THIS] is a specific OBJECT, Colossus is a waretype argon_m1_1 (or similar). So the two are not comparable. What you need to do is
$waretype == colossus (where $waretype = [THIS] -> get ware type code of object)
2. else if [THIS] == Phoenix OR Titan is not a valid statement. You can not go if a == b or c. You must go if a == b or a == c
Line 111 -pretentious/cautious tip
while $count
dec $count =
This works fine, but I always use while $count > 0, for extra safety (in case I do something trick mid loop and minus 2 from count, going to minus 1, thus causing and infinite loop
Didn't think of that!Line 111 still -Script purpose?
$count = size of array $arr
while $count
dec $count =
$item = $arr[$count]
$itemworth = get min price of ware $item
$worth = $worth + $itemworth
send incoming message 'Counting through the ships wares...' to player: display it=[TRUE]
end
Don't you need to count how many of each ware there is to get a true measure of value? (e.g. 2x shields => 2x shield value) (Use Get amount not get free/max/true))
No, it's if it's any player craft, not just the playership. I'm right there...Line 130 Bug?
if $att == Player
$finalpayout = ( $bounty + $finalworth ) * $multiplier
add money to player: $finalpayout
send incoming message 'You just recieved...' to player: display it=[TRUE]
* Player isnt killer - killer gets worth added to its bounty, which is now found.
else if $att != Player
Once again, a variable type mismatch. $att is the attacker from the top of the script. Player is a race. I think you mean to use [PLAYERSHIP]
My bad, that was meant to be the race.You need to do $att.race = $att-> get owner
There is only one player sector, which is the sector the player currently flies in. Thus you don't need the "@".{player.sector.name@sector} sector being replaced with whatever the sector name is?
No, that's not the case. Almost all commands are usable correctly.Is the MD missing a ton of stuff that should be in it but wasn't implemented?
How would I use that variable if I wanted to send a message to the player if he was in a certain sector.
Lets say the sector is Argon Prime and when he enters he gets a message?
Code: Select all
<cue name="SendMessage">
<condition>
<check_value value="{player.sector}" exact="{sector@argonprime}"/>
</condition>
<action>
<incoming_message author="Argonaught." text="You're in Argon Prime"/>
</action>
</cue>
Code: Select all
<cues>
<cue name="Testcue_top">
<condition>
<check_all>
<check_value value="{player.name}" exact="whatever"/>
</check_all>
</condition>
<action>
<do_all>
<find_sector name="Testcue_top.sector1" x="8" y="8" min="0" max="10" comment="min/max sets the amount of jumps the search radius will be, a random sector within that radius will be found"/>
<find_station name="Testcue_top.Station1" class="station" race="{sector.race@Testcue_top.sector1}">
<sector sector="Testcue_top.sector1" comment="there is no need for brackets here since it asks for a sector already"/>
<jumps exact="0"/>
</find_station>
<create_ship name="Testcue_top.Ship1" typename="SS_SH_A_M4" race="{sector.race@Testcue_top.sector1}" racelogic="0" comment="racelogic is default 1, but I set it to 0 as I want it not to wander about just like that">
<position object="Testcue_top.Station1" comment="again no need for brackets here since it asks for a object" min="20km" max="50km"/>
<sector sector="Testcue_top.sector1"/>
<equipment loadout="maximum" loadoutmask="all"/>
<command command="dock" commandobject="Testcue_top.Station1"/>
</create_ship>
<incoming_message author="debug" text="Sector: {sector.name@Testcue_top.sector1}/nStation: {object.name@Testcue_top.Station1}/nShip: {object.name@estcue_top.Ship1}"/>
</do_all>
</action>
</cue>
</cues>
Code: Select all
<do_if value="{player.age}" min="1m">
<incoming_message author="debug" text="its true"/>
</do_if>
Code: Select all
<do_choose>
<do_when value="1" exact="0">
<cancel_cue/>
</do_when>
<do_when value="2" exact="3">
<set_target/>
</do_when>
<do_otherwise>
<do_choose>
<do_when value="7" exact="5">
<abandon_ship/>
</do_when>
<do_otherwise>
<eject_cargo/>
</do_otherwise>
</do_choose>
</do_otherwise>
</do_choose>
I've discovered that alotScRaT_GER wrote:the MD is very picky about errors...