How do you create LEVELS?
Moderators: Moderators for English X Forum, Scripting / Modding Moderators
-
- EGOSOFT
- Posts: 13124
- Joined: Sat, 9. Nov 02, 11:45
How do you create LEVELS?
I have decided to include Levels in my developing scripts. What are the basics of it?
How do I attatch them to either factorys or ships?
Thanks.
How do I attatch them to either factorys or ships?
Thanks.
Come watch me on Twitch where I occasionally play several of the X games
-
- Posts: 1133
- Joined: Thu, 10. Jul 03, 07:42
Writing scripts with levels is a three step process:
So, when you define what hoops the player has to jump through, and where you can make your script intentionally stupid, you do this:
EDIT: Can I have a volunteer to translate this tutorial into German?
- First you design a script that does X. Define all the things that your script will do. Work your heart out and make your script do "Really Cool Things®".
- Now that you've spent time and effort, woken in the middle of night in a cold sweat after having dreams where X² scripting commands are clumping together like Khaak Clusters and kidnapping your children, you now go ahead look for ways to break your script - to make your script intentionally stupid unless the player has jumped through X number of hoops first.
- You now define what arbitrary hoops a player has to go so that the script isn't intentionally stupid any more.
So, when you define what hoops the player has to jump through, and where you can make your script intentionally stupid, you do this:
- Define a variable. Let's (out of the blue) call it "PlayerAgravation". Set it to zero.
- Write this variable using the "set local variable" command to some local variable. Out of the blue again, let's call it: "How.Agravated.The.Player.Is.Because.This.Script.Is.Intentionally.Stupid". First, though, check to see if that local variable has been set before so you don't overwrite what the script did before.
- Now, at all the key junctures in your script... the places where your script does something REALLY cool... you put tests like:so that unless the script is at a certain "level" it actually won't do what you've spend all your hard work and energy making it do.
Code: Select all
skip if PlayerAgrivation < 10
- As the player jumps through whatever hoops it is you've decided to make him jump through in order to make the script do whatever it was it was actually intended to do in the first place, you:and write that to the local variable.
Code: Select all
inc PlayerAgravation
- Rinse and repeat.
EDIT: Can I have a volunteer to translate this tutorial into German?
You were warned... pirates will be hunted down like vermin.
Ex Turbo Modestum
Ex Turbo Modestum
-
- Posts: 3008
- Joined: Wed, 6. Nov 02, 20:31
considering the sarcasm level, that was actually quite a good run-through
I agree with the more clever aspects of some scripts to take time to mature - better use of trade runs in mk3 trade and BPH, use of jumpdrive in mk3 trade and BPH - as these scripts can have far-reaching effects
I don't agree with, for example, BPH not selling until level 4 or not being available for use in trading stations (however stupidly) until level 4, because imo buying and selling are the whole point of the script.
of couse, if I am THAT bothered, I should work really hard and get loads of money and buy out egosoft and mould it in my image (mwuha ha) so I'll shut up and be constructive now

I agree with the more clever aspects of some scripts to take time to mature - better use of trade runs in mk3 trade and BPH, use of jumpdrive in mk3 trade and BPH - as these scripts can have far-reaching effects
I don't agree with, for example, BPH not selling until level 4 or not being available for use in trading stations (however stupidly) until level 4, because imo buying and selling are the whole point of the script.
of couse, if I am THAT bothered, I should work really hard and get loads of money and buy out egosoft and mould it in my image (mwuha ha) so I'll shut up and be constructive now

-
- Posts: 2981
- Joined: Mon, 29. Dec 03, 03:29
Let's please keep all BPH rants centered in one place so that we don't have to look to hard to find them shall we?

thx

thx

"Nature's first green is gold" . . . stay golden.
-
- Posts: 5145
- Joined: Mon, 23. Feb 04, 01:28
-
- Posts: 3008
- Joined: Wed, 6. Nov 02, 20:31
-
- EGOSOFT
- Posts: 13124
- Joined: Sat, 9. Nov 02, 11:45
I am now using global vairiables because it seems to sut me more. It is named by the stations ID. Do Global vairables have any disadvantages to stuff like this?
Come watch me on Twitch where I occasionally play several of the X games
-
- Posts: 1133
- Joined: Thu, 10. Jul 03, 07:42
PRoblem with global variables is that they don't go away if/when an object is destroyed. If you are using global variables for levelling information with the id of a ship or station, and that ship or station gets destroyed, then the global variables will still exist. Like temp files left over when a badly behaved program exits.
Use:
Local variables if you are storing information that is unique to a particular object.
Global variables if you are storing information that is the same for every ship/station.
Use:
Local variables if you are storing information that is unique to a particular object.
Global variables if you are storing information that is the same for every ship/station.
You were warned... pirates will be hunted down like vermin.
Ex Turbo Modestum
Ex Turbo Modestum
-
- Posts: 985
- Joined: Sun, 7. Dec 03, 05:15
I would like to make a coment on "intentionally stupid scripts" that need to be leveled....
Consider that this is only a simulation...an artifical world that only exists on our pc's...a toy
then consider the amount of programming it would take to say..create a modern day Cargo Plan for real, that load its own cargo, finds the best buyer, takes off on its own, flys to its destination, lands own its own , unloads its own cargo, puts money in your pocket...rense and then repeats
........... it hasn't been done yet that I know of. So all the work those simple "intentionally stupid scripts" simulate actually translates into trillions of line of code that it would take to actually do what it does if it was real.......blah blah blah.......
Consider that this is only a simulation...an artifical world that only exists on our pc's...a toy



"Try not. Do or do not, there is no try."-Yoda
"[Its] time for the human race to enter the solar system"-Dan Quayle
"[Its] time for the human race to enter the solar system"-Dan Quayle
-
- Posts: 1133
- Joined: Thu, 10. Jul 03, 07:42
Yes, but also imagine that you are now in the X universe, where all the mechanics and infrastructure of ships that can navigate, fly, maneuver, land, transfer cargo, scan, fire weapons, and so forth already exists. Now imagine how stupid it is, for example, that a sector trader can't ever simply look at a list of products in the sector it's in and choose the one with the best buy/sell price difference. Despite the fact that a best buys/best selling price extension does that pretty much automatically. Game balance is one thing, but woeful stupidity passed off as game balance is just an excuse for making a player jump through arbitrary hoops.
X² is an amazing game because it is so incredibly immersive. You can sit down at your computer and really FEEL like you are in the X universe. It is my suggestion that scripts which, in the name of game balance, need to be intentionally made stupid don't belong in the game at all. They detract from the immesiveness of the game. I feel less like I am in the X universe because those scripts stand out as glaring reminders that game balance is being considered a higher "cause" than game reality.
X² is an amazing game because it is so incredibly immersive. You can sit down at your computer and really FEEL like you are in the X universe. It is my suggestion that scripts which, in the name of game balance, need to be intentionally made stupid don't belong in the game at all. They detract from the immesiveness of the game. I feel less like I am in the X universe because those scripts stand out as glaring reminders that game balance is being considered a higher "cause" than game reality.
You were warned... pirates will be hunted down like vermin.
Ex Turbo Modestum
Ex Turbo Modestum
-
- Posts: 5145
- Joined: Mon, 23. Feb 04, 01:28
It is true that the Level changes can help the game and give better balance. However, it must be done very carefully. It is quite possible for the "dumb" stage of the script to be jarring to the player's immersion.
It is also possible for the "level up" changes to overload the capabilites of the ship in question so that the actual effectiveness is reduced rather than improved.
For instance, the ability to protect more than one ship at higher level could result in No ship being properly protected.
Just some thoughts...
It is also possible for the "level up" changes to overload the capabilites of the ship in question so that the actual effectiveness is reduced rather than improved.
For instance, the ability to protect more than one ship at higher level could result in No ship being properly protected.
Just some thoughts...

Tinker
"If engineers built buildings the way programmers write programs, the first woodpecker that came along would destroy civilization!"
"If engineers built buildings the way programmers write programs, the first woodpecker that came along would destroy civilization!"
-
- Posts: 2981
- Joined: Mon, 29. Dec 03, 03:29
IMHO, in addition to just attempting to provide balance (which I see as a secondary function), levels (when carefully thought out) add a considerable amount of depth to the game. Especially the dreaded BPH levels in my opinion add a surprisingly robust role play element to the game for those that are up to the challenge.
I can't tell you how long I agonized about the best way/locations to train up my bph freighters before moving them to different areas where the unlocked functionality could be put to better use. I must've spent twice as much time and effort thinking through all the ramifications of moving my lvl 3 guy to station x and shuffling my lvl5 guy over to station y than I would have had they both been running buyware best. Some might argue that this increased micromanagement detracts from the game, and for them, they'd be right.
Personally, I loved it.
IMO, one of the best things about X2 has always been the ability of the player to customize their X2 experience.
If you're in the mood for difficult combat, fly to a station and take an assasination mission, or even repel a xenon invasion. If you're not, don't.
If you're in the mood to agonize about the best way to deploy your developing freighters, go for it. The game will reward your efforts in terms of slightly increased efficiency of operation of your manufacturing base. (and a heady dose of self-accomplishment) If you're not in the mood, go fly around and explore, or mine, or take courier missions, or ....
Levels add just one more way to involve the player into caring about what goes on in the universe and within their own budding empire. Sure, it's an admittedly shallow role playing interface tacked onto an already expansive simulation. Does it belong? I dunno, but in my case, when I'm in the mood to allow my anal tendencies free reign, it sure feels darn good.
(I'll even admit to knowing the names of a few of my level 7 traders. *sniff* they've been with me from the beginning)
Cheers.
I can't tell you how long I agonized about the best way/locations to train up my bph freighters before moving them to different areas where the unlocked functionality could be put to better use. I must've spent twice as much time and effort thinking through all the ramifications of moving my lvl 3 guy to station x and shuffling my lvl5 guy over to station y than I would have had they both been running buyware best. Some might argue that this increased micromanagement detracts from the game, and for them, they'd be right.
Personally, I loved it.
IMO, one of the best things about X2 has always been the ability of the player to customize their X2 experience.
If you're in the mood for difficult combat, fly to a station and take an assasination mission, or even repel a xenon invasion. If you're not, don't.
If you're in the mood to agonize about the best way to deploy your developing freighters, go for it. The game will reward your efforts in terms of slightly increased efficiency of operation of your manufacturing base. (and a heady dose of self-accomplishment) If you're not in the mood, go fly around and explore, or mine, or take courier missions, or ....
Levels add just one more way to involve the player into caring about what goes on in the universe and within their own budding empire. Sure, it's an admittedly shallow role playing interface tacked onto an already expansive simulation. Does it belong? I dunno, but in my case, when I'm in the mood to allow my anal tendencies free reign, it sure feels darn good.
(I'll even admit to knowing the names of a few of my level 7 traders. *sniff* they've been with me from the beginning)
Cheers.
"Nature's first green is gold" . . . stay golden.
-
- Posts: 1133
- Joined: Thu, 10. Jul 03, 07:42
Involving the player is a good thing. My issue with levels, or (more correctly) the idea that the functionality of a script changes as certain conditions change, is not fundamental. The idea that a player can take part to change the conditions under which a script operates, and thus change the script's functionality is a good premise. My issue is that we have yet to see an effective implementation of it, and I worry that the examples we've seen will spawn more of the same.
I apologize in advance to BurnIt! and ticaki, because theirs are the implementations I am about to criticize.
The BPH trader is at least somewhat better, in that the original decision on where to train it requires somewhat more player involvement. Even there, it is essentially a "drag and drop" solution once that is done. You stick it somewhere, and then just wait until it decides it's smart enough to work efficiently.
I'm sorry, but I have to disagree most strenuously that either of those scripts' levelling mechanisms add any real degree of depth to X². In fact, I believe that their levelling mechanisms detract from game immersion and realism. X2, fortunately, has deep pockets as far as realism is concerned, which is perhaps why no general alarm bells (besides the one I am ringing) have gone off. But if we see the developers make more of the same, and if we see these get signed, then we will also see X2 become less immersive, and that is something that would be heartbreaking.
Of course, it's easy for me to criticize, as I have yet to produce a signed script of my own. Only time will tell if what I create is something where the levelling mechanism harmonizes game balance, player involvement, and realism.
To BurnIt! and ticaki, the developers of the trader and BPH, I apologize for the forcefulness of this post. You were the first, and paved the way in the dark. Your scripts are excellent work. My only concern is with the levelling mechanism in them, and this is something I realize hadn't been strenuously pre-planned, but evolved on its own, so to speak.
Any Moderator: Perhaps we can split off some of these posts away from the actual mechanics of levelling for Xenon_Slayer, into a thread discussing the merits and methodology. I think this is an important topic for the community to ponder.
I apologize in advance to BurnIt! and ticaki, because theirs are the implementations I am about to criticize.
The archtypical "level" system is the Sector/Universe Trader. How does it involve the player into doing more than simply checking to see what level they are at so they can switch from sector to universe trading? There is no method for a player to interact with the mechanism the script has for levelling, nor to influence it in any way except in picking the original sector for it to begin operations. If, for example, you could enter the ship and by performing some manual trades (and this "training" the new pilot in person) you could influence the speed or way in which the script gained levels, this would be interesting. As it is, there is no interaction, and what effects the levels do have are to make the already inefficient buy/sell mechanism even more inefficient at low levels - so inefficient as to be beyond even the "willing suspension of disbelief". Can you imagine any sane person trading by picking a random ware out of a list that includes every ware in the universe and then seeing if anyone happens to sell it in your sector and then seeing if the price happens to be below average? Sorry BurnIt!, but the concessions you made in order to make the script not damage the play balance do not, in my opinion, belong as a signed script.Burianek wrote:Levels add just one more way to involve the player into caring about what goes on in the universe and within their own budding empire.
The BPH trader is at least somewhat better, in that the original decision on where to train it requires somewhat more player involvement. Even there, it is essentially a "drag and drop" solution once that is done. You stick it somewhere, and then just wait until it decides it's smart enough to work efficiently.
I'm sorry, but I have to disagree most strenuously that either of those scripts' levelling mechanisms add any real degree of depth to X². In fact, I believe that their levelling mechanisms detract from game immersion and realism. X2, fortunately, has deep pockets as far as realism is concerned, which is perhaps why no general alarm bells (besides the one I am ringing) have gone off. But if we see the developers make more of the same, and if we see these get signed, then we will also see X2 become less immersive, and that is something that would be heartbreaking.
Of course, it's easy for me to criticize, as I have yet to produce a signed script of my own. Only time will tell if what I create is something where the levelling mechanism harmonizes game balance, player involvement, and realism.
To BurnIt! and ticaki, the developers of the trader and BPH, I apologize for the forcefulness of this post. You were the first, and paved the way in the dark. Your scripts are excellent work. My only concern is with the levelling mechanism in them, and this is something I realize hadn't been strenuously pre-planned, but evolved on its own, so to speak.
Any Moderator: Perhaps we can split off some of these posts away from the actual mechanics of levelling for Xenon_Slayer, into a thread discussing the merits and methodology. I think this is an important topic for the community to ponder.
You were warned... pirates will be hunted down like vermin.
Ex Turbo Modestum
Ex Turbo Modestum
-
- Posts: 353
- Joined: Sat, 3. Apr 04, 09:47
I mostly agree with you Reven. It would be a lot better if the "intentionally stupid" part were replaced with something more realistic, like Morale or Wage Brackets.
So replace "stupid" with "lazy" and now you have a means for the player to interact with the workings of your script.
What if I'm cheap and pay my pilots minimum wage? They do just enough not to get fired! But if I pay them well, they will ostensibly work harder and derive more satisfaction from their labour(raising Morale, another factor in pilot behavior/efficiency perhaps?)
another Morale Booster would be to check if the Player is docked at the same station as the Pilot(hanging out in the Pilot's Lounge!)
So replace "stupid" with "lazy" and now you have a means for the player to interact with the workings of your script.
What if I'm cheap and pay my pilots minimum wage? They do just enough not to get fired! But if I pay them well, they will ostensibly work harder and derive more satisfaction from their labour(raising Morale, another factor in pilot behavior/efficiency perhaps?)
another Morale Booster would be to check if the Player is docked at the same station as the Pilot(hanging out in the Pilot's Lounge!)
-
- EGOSOFT
- Posts: 13124
- Joined: Sat, 9. Nov 02, 11:45
The ID is unique is'nt it though. Also I am using an Argon shipyard for the script. I dont think the player will have enough of them to make a duplecate. It will be Player/ Shipyard / Loads of numbers.Reven wrote:Problem with global variables is that they don't go away if/when an object is destroyed. If you are using global variables for levelling information with the id of a ship or station, and that ship or station gets destroyed, then the global variables will still exist.
I like levels in the game. They are adding the feeling of progression for cirtain things. Maybe its about time someone created a leveling system for fighters. The more they kill the better the ship is with AI control.
Edit: Just found the Thread about that. WOOPIE.

Come watch me on Twitch where I occasionally play several of the X games
-
- EGOSOFT
- Posts: 13124
- Joined: Sat, 9. Nov 02, 11:45
I am just about finished on the first drafts of the scripts when... I found the local Vairiables I set were null from the start. This is the code.
The $Level is still null when It should be 1.
Have I made a big mistake somewere?
Code: Select all
014 $Hq = create station: type=Argon Federal Argon Shipyard owner=Player addto=$sector x=$x y=$y z=$z
015 $Hq -> set name to '(Im not telling you guys the name yet)'
016 $Hq -> set local variable: name=$Level value=1
017 write to player logbook $Level
Have I made a big mistake somewere?
Come watch me on Twitch where I occasionally play several of the X games
-
- Posts: 2981
- Joined: Mon, 29. Dec 03, 03:29
hmm, the name of the local variable should be a string, you wouldn't use $Level for this,
so this will work:
I just renamed your local variable Hq.Level to stress the fact that it is, in no way, associated with the script variable $Level. (until I set it in line 017)
Does that make sense?
so this will work:
Code: Select all
014 $Hq = create station: type=Argon Federal Argon Shipyard owner=Player addto=$sector x=$x y=$y z=$z
015 $Hq -> set name to '(Im not telling you guys the name yet)'
016 $Hq -> set local variable: name='Hq.Level' value=1
017 $Level = $Hq -> get local variable: name ='Hq.Level'
018 write to player logbook $Level
Does that make sense?
Last edited by Burianek on Mon, 25. Oct 04, 17:56, edited 1 time in total.
"Nature's first green is gold" . . . stay golden.