Altering of player legal status via XML script
Moderators: winston, another_commander
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
Altering of player legal status via XML script
Perhaps someone knows how to alter the player's legal status in an XML script?
On the wiki I only found how to set the legal rank but not how to add to or subtract from it.
If someone could enlighten me on the issue I would be most pleased
Thanks in advance
L
On the wiki I only found how to set the legal rank but not how to add to or subtract from it.
If someone could enlighten me on the issue I would be most pleased
Thanks in advance
L
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
Not sure if this helps but it mentions setting local variables
Quote:
Mission Variables
As of 1.65? these methods can also be used with script local variables by suppling a "local_" variable rather than a "mission_" varaible. The difference is that "mission_" variables are stored within a save file and "local_" variables are not saved with the game and are only valid localy, within a mission script.
set: mission_variable <value>
// sets the mission_variable to the value given
// the value can be a particular string or numeric value,
// or a queriable state
reset: mission_variable <value>
// sets the mission_variable to be UNDEFINED
increment: mission_variable
// increases the mission variable's value by 1.0
decrement: mission_variable
// decreases the mission variable's value by 1.0
add: mission_variable <value>
// adds the value given to the mission_variable
// the value can be a number or a queriable state
// like shipsFound_number
subtract: mission_variable <value>
// subtracts the value given from the mission_variable
// the value can be a number or a queriable state
// like shipsFound_number
so
can you not
Code:
set: local_legal <value>
then
Code:
setLegalStatus: local_legal
or to add
Code:
add: local_legal <value>
Maybe i hope this works
Quote:
Mission Variables
As of 1.65? these methods can also be used with script local variables by suppling a "local_" variable rather than a "mission_" varaible. The difference is that "mission_" variables are stored within a save file and "local_" variables are not saved with the game and are only valid localy, within a mission script.
set: mission_variable <value>
// sets the mission_variable to the value given
// the value can be a particular string or numeric value,
// or a queriable state
reset: mission_variable <value>
// sets the mission_variable to be UNDEFINED
increment: mission_variable
// increases the mission variable's value by 1.0
decrement: mission_variable
// decreases the mission variable's value by 1.0
add: mission_variable <value>
// adds the value given to the mission_variable
// the value can be a number or a queriable state
// like shipsFound_number
subtract: mission_variable <value>
// subtracts the value given from the mission_variable
// the value can be a number or a queriable state
// like shipsFound_number
so
can you not
Code:
set: local_legal <value>
then
Code:
setLegalStatus: local_legal
or to add
Code:
add: local_legal <value>
Maybe i hope this works
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
.
Hi rustybolts!
I am not entirely sure, but I think that the solution you are suggesting only works for mission variables (such as being defined by us, the oxp'ers) but not for hardcoded variables that are already there in the core game, like the legal rating.
Then I could easily be wrong about that.
The scripting part I want to do looks like this:
The "<string>???</string>" part would be where I want to deduct from or add to the players legal rank. Basically this script checks if the player owns a certain station and if it is owned, gives him the income and alters his legal rating.
The income bit is already working, but as to the legal thing I am clueless. How would you apply your solution to the above ??? sequence? I am ready to experiment if need be ...
Thanks for the suggestion in any case
L
I am not entirely sure, but I think that the solution you are suggesting only works for mission variables (such as being defined by us, the oxp'ers) but not for hardcoded variables that are already there in the core game, like the legal rating.
Then I could easily be wrong about that.
The scripting part I want to do looks like this:
Code: Select all
<key>Stations_owned_income_AAA</key>
<array>
<dict>
<key>conditions</key>
<array>
<string>status_string equal STATUS_EXITING_WITCHSPACE</string>
<string>mission_playerstation_AAA equal 1</string>
</array>
<key>do</key>
<array>
<string>awardCredits: 4000</string>
<string>???</string>
</array>
</dict>
</array>
The income bit is already working, but as to the legal thing I am clueless. How would you apply your solution to the above ??? sequence? I am ready to experiment if need be ...
Thanks for the suggestion in any case
L
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
Code: Select all
<string>set :local_legal [legalStatus_number]</string
<key>Stations_owned_income_AAA</key>
<array>
<dict>
<key>conditions</key>
<array>
<string>status_string equal STATUS_EXITING_WITCHSPACE</string>
<string>mission_playerstation_AAA equal 1</string>
</array>
<key>do</key>
<array>
<string>awardCredits: 4000</string>
<string>add: local_legal 5</string>
<string>setLegalStatus: local_legal</string>
</array>
</dict>
</array>
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
The line where i put
may have to be written
I dunno but its worth a shot
I used this code here to extract the format.
But that doesnt use the local variable to award the credits.
Goodluck
Code: Select all
<string>setLegalStatus: local_legal</string>
Code: Select all
<string>setLegalStatus: [local_legal]</string>
I used this code here to extract the format.
Code: Select all
<key>script_actions</key>
<array>
<string>set: local_my_credits [credits_number]</string>
<string>awardCredits: 1</string>
<string>subtract: local_my_credits [credits_number]</string>
<dict>
<key>conditions</key>
<array>
<string>local_my_credits lessthan 0</string>
</array>
<key>do</key>
<array>
<string>awardCredits: -1</string>
<string>"your stuff if scooped by player"</string>
</array>
<key>else</key>
<array>
<string>"your stuff if scooped by NPC ship"</string>
</array>
</dict>
</array>
Goodluck
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
Tested my solution and works here's my code
You can test the above code yourself it will change your legal status via the local variable legal once you have entered Zaonce in galaxy 1
Code: Select all
{
test = (
{
conditions = ("galaxy_number equal 0");
do = (
{
conditions = (
"planet_number equal 129"
);
do = (
"set :local_legal [legalStatus_number]",
"add: local_legal 64",
"setLegalStatus: [local_legal]"
);
}
);
}
);
}
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Cmdr James
- Commodore
- Posts: 1357
- Joined: Tue Jun 05, 2007 10:43 pm
- Location: Berlin
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Generally spoken there are commands that expect a value and those that expect a variable.Rustybolts wrote:The line where i putmay have to be writtenCode: Select all
<string>setLegalStatus: local_legal</string>
I dunno but its worth a shotCode: Select all
<string>setLegalStatus: [local_legal]</string>
In cased a fixed number is expected for a command you can replace that with [variable]. Before Oolite executes a line it first replace everything between [] and than executes the new line.
String expansion works at all places except in a CONDITION line.
UPS-Courier & DeepSpacePirates & others at the box and some older versions
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
...
So if I i.e. execute the following script:
... then the above example should, after each witchjump, add 4000 Cr to the player's fortune and raise his legal rank towards "Offender" or "Fugitive" by 5 points, is that correct?
L
Code: Select all
<key>Stations_owned_income_AAA</key>
<array>
<dict>
<key>conditions</key>
<array>
<string>status_string equal STATUS_EXITING_WITCHSPACE</string>
<string>mission_playerstation_AAA equal 1</string>
</array>
<key>do</key>
<array>
<string>awardCredits: 4000</string>
<string>setLegalStatus: [local_legal]</string>
<string>add: local_legal 5</string>
<string>setLegalStatus: [local_legal]</string>
</array>
</dict>
</array>
L
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
It will but is there a top limit to your legal status .How high does this rating go i thought 64 but have found no evidence. You will need to find out and perform a check to see if this top limit has been reached. before adding more on to local legal otherwise it will just keep increasing.
Unless legal status has a cap it wont exceed not sure have not found the info
Unless legal status has a cap it wont exceed not sure have not found the info
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
..
I am sorry to report that ...
... isn't working: When I test this, the legal status stays as it is
Any ideas?
L
Code: Select all
<key>do</key>
<array>
<string>setLegalStatus: [local_legal]</string>
<string>add: local_legal 5</string>
<string>setLegalStatus: [local_legal]</string>
</array>
Any ideas?
L
- Rustybolts
- ---- E L I T E ----
- Posts: 293
- Joined: Sun Jun 07, 2009 6:22 pm
- Location: UK
Could this be why?
If not are you meeting your conditions?
In which case increase the amount you add.The bounty on the player, which determines legal status. It is halved at each witchspace jump.
If not are you meeting your conditions?
STE.+ Firefly/Dragonfly + BlackJacksbullion v.1.23 link below.
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
http://www.mediafire.com/?sharekey=ca16 ... f6e8ebb871
- Lestradae
- ---- E L I T E ----
- Posts: 3095
- Joined: Tue Apr 17, 2007 10:30 pm
- Location: Vienna, Austria
..
I add 10 - even if they were applied before the witchjump, there should still be five left after it - making me an Offender when Clean. And that doesn't happen.
The conditions are applied correctly - because the 4000 Cr get awarded as they should!
L
The conditions are applied correctly - because the 4000 Cr get awarded as they should!
L
- Eric Walch
- Slightly Grand Rear Admiral
- Posts: 5536
- Joined: Sat Jun 16, 2007 3:48 pm
- Location: Netherlands
Re: ..
It does exactly what you ask. Just ask yourself at each line what it will do. And look at the code of Rustybolts that does work.Lestradae wrote:I am sorry to report that ...
... isn't working: When I test this, the legal status stays as it isCode: Select all
<key>do</key> <array> <string>setLegalStatus: [local_legal]</string> <string>add: local_legal 5</string> <string>setLegalStatus: [local_legal]</string> </array>
Any ideas?
UPS-Courier & DeepSpacePirates & others at the box and some older versions