[Discussion] Generic X3TC S&M questions II
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 2033
- Joined: Wed, 29. Jun 05, 01:45
-
- Posts: 4254
- Joined: Fri, 20. Oct 06, 19:02
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Ok, I've got several arrays of sectors here, what's the best way of displaying them in a menu?
I want:
Title1:
Sector 1 from array 1.
Sector 2 fro...
etc.
Title2:
Sector 1 from array 1.
S...
Etc. etc.
Not sure of the best way to put text arrays into menus.
I want:
Title1:
Sector 1 from array 1.
Sector 2 fro...
etc.
Title2:
Sector 1 from array 1.
S...
Etc. etc.
Not sure of the best way to put text arrays into menus.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Because of these pictures I thought that you knew your way around menus, don't you? Or is there a special problem with arrays I don't understand?
Greetings,
ScRaT
Greetings,
ScRaT
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Menus were Mark's domain. 
I know my way around menus reasonably, I just have trouble making them look half decent. What I've got so far will do:
http://i758.photobucket.com/albums/xx22 ... 1290707861

I know my way around menus reasonably, I just have trouble making them look half decent. What I've got so far will do:
http://i758.photobucket.com/albums/xx22 ... 1290707861
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Ah, okay.Menus were Mark's domain.

There's not much more you can do. I think not using an info menu, but a normal menu instead would help, since the menu now is too broad. I don't think colors would help much.What I've got so far will do
As a general idea: Can these intrusion altert levels be set by the user? If so, you could also use value selections for each sector. Maybe sorting the sectors by name or alphabet to make it more clearly arranged. Just an idea.
Greetings,
ScRaT
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Hmm, user set levels might be good. They don't actually have an ingame effect, the alerts, they're just for the player's benefit. Colour will come later. As for Alphabetising it, I was going to but I'm not sure how.
At all.
At all.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 1468
- Joined: Wed, 3. Aug 05, 05:05
EJon
How about setting up the menu something like this. With the code the way you have it, it will work out like this quite easily.
[ external image ]
MarCon
How about setting up the menu something like this. With the code the way you have it, it will work out like this quite easily.
[ external image ]
MarCon
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Hmm, any idea on why this is all of a sudden choosing completely random ships to hit, way out of range, and very occasionally everyone?
Line52 would have a Kill Object on it, I removed it for Debug purposes.
Line52 would have a Kill Object on it, I removed it for Debug purposes.
Code: Select all
001 $Checking = [THIS] -> get local variable: name='ej.military.bigship.blast'
002 $BlastPlaceholder = [THIS] -> get local variable: name='ej.wreck.explo'
003 if $Checking != [TRUE] AND $BlastPlaceholder == [FALSE]
004 |[THIS] -> set local variable: name='ej.military.bigship.blast' value=[TRUE]
005 |
006 |$Sector = [THIS] -> get sector
007 |$Att = [THIS] -> get attacker
008 |$DeadShip = [THIS] -> get position as array
009 |
010 |$ShipA = $Sector -> get ship array from sector/ship/station
011 |$StaA = $Sector -> get station array from sector
012 |
013 |$Count1 = size of array $ShipA
014 |while $Count1
015 ||dec $Count1 =
016 ||$Ship = $ShipA[$Count1]
017 ||skip if not $Ship -> is invincible
018 |||gosub End
019 ||skip if not $Ship == [THIS]
020 |||gosub End
021 ||$Ins = $Ship -> get maximum shield strength
022 ||$Range = get distance between $Ship and $DeadShip
023 ||if $Range >= 0 AND $Range < 500
024 |||$Rand1 = = random value from 200000 to 1250000 - 1
025 |||$Damage = $Rand1
026 ||else if $Range >= 500 AND $Range < 1000
027 |||$Rand2 = = random value from 50000 to 200000 - 1
028 |||$Damage = $Rand2
029 ||else if $Range >= 1000 AND $Range < 1500
030 |||$Rand3 = = random value from 5000 to 50000 - 1
031 |||$Damage = $Rand3
032 ||else if $Range >= 1500 AND $Range < 2000
033 |||$Rand4 = = random value from 1000 to 5000 - 1
034 |||$Damage = $Rand4
035 ||else if $Range >= 2000 AND $Range < 5000
036 |||$Damage = 1000
037 ||else if $Range > 5000
038 |||$Damage = 0
039 ||end
040 ||$Shield = $Ship -> get current shield strength
041 ||$ShieldAfter = $Shield - $Damage
042 ||$Ship -> set current shield strength to $ShieldAfter
043 ||display subtitle text: text='Damaged' duration=121 ms
044 ||$HitClass = $Ship -> get object class
045 ||
046 ||if $ShieldAfter <= 0 OR $Ins <= 0
047 |||$Debt = $Damage - $Shield
048 |||$HullAfter = $Hull - $Debt
049 |||$Ship -> set hull to $HullAfter
050 |||$FinalHull = $Ship -> get hull
051 |||if $FinalHull <= 0
052 ||||
053 ||||write to player logbook $DeadShip
054 ||||write to player logbook $Ship
055 ||||write to player logbook $Range
056 |||end
057 ||end
058 |end
059 |
060 |$Count2 = size of array $StaA
061 |while $Count2
062 ||dec $Count2 =
063 ||$Sta = $StaA[$Count2]
064 ||skip if not $Sta -> is invincible
065 |||gosub End
066 ||skip if not $Sta == [THIS]
067 |||gosub End
068 ||$Ins = $Sta -> get maximum shield strength
069 ||$Range = get distance between $Sta and $DeadShip
070 ||if $Range >= 0 AND $Range < 500
071 |||$Rand1 = = random value from 200000 to 1250000 - 1
072 |||$Damage = $Rand1
073 ||else if $Range >= 500 AND $Range < 1000
074 |||$Rand2 = = random value from 50000 to 200000 - 1
075 |||$Damage = $Rand2
076 ||else if $Range >= 1000 AND $Range < 1500
077 |||$Rand3 = = random value from 5000 to 50000 - 1
078 |||$Damage = $Rand3
079 ||else if $Range >= 1500 AND $Range < 2000
080 |||$Rand4 = = random value from 1000 to 5000 - 1
081 |||$Damage = $Rand4
082 ||else if $Range >= 2000 AND $Range < 5000
083 |||$Damage = 1000
084 ||else if $Range > 5000
085 |||$Damage = 0
086 ||end
087 ||$Shield = $Sta -> get current shield strength
088 ||$ShieldAfter = $Shield - $Damage
089 ||$Sta -> set current shield strength to $ShieldAfter
090 ||if $ShieldAfter <= 0 OR $Ins <= 0
091 |||$Debt = $Damage - $Shield
092 |||$HullAfter = $Hull - $Debt
093 |||$Sta -> set hull to $HullAfter
094 |||$FinalHull = $Sta -> get hull
095 |||if $FinalHull <= 0
096 ||||$Sta -> destroy object: killer=$Att, show no explosion=[FALSE]
097 |||end
098 ||end
099 |end
100 |
101 End:
102 end
103 return null
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Mh, the only thing that seems wrong to me, are the following lines:
You are traversing the array, but if one of the ships of the arrays is [THIS] (which it always is), you directly end the complete script. I think, you intended to do the following:
"gosub End" doesn't make much sense anyway, if "End" is just "return null".
There are still some other thing, that I'd like to point out:
I actually don't know what the SE does, when it finds an "end", without a corresponding opening statement (like "while", "if", etc.). I think it's safer not to rely on any kind of behaviour and just switch these lines.
Greetings,
ScRaT
Code: Select all
013 |$Count1 = size of array $ShipA
014 |while $Count1
015 ||dec $Count1 =
016 ||$Ship = $ShipA[$Count1]
017 ||skip if not $Ship -> is invincible
018 |||gosub End
019 ||skip if not $Ship == [THIS]
020 |||gosub End
Code: Select all
013 |$Count1 = size of array $ShipA
014 |while $Count1
015 ||dec $Count1 =
016 ||$Ship = $ShipA[$Count1]
017 ||skip if not $Ship -> is invincible
018 |||continue
019 ||skip if not $Ship == [THIS]
020 |||continue
There are still some other thing, that I'd like to point out:
Code: Select all
101 End:
102 end
103 return null
Greetings,
ScRaT
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Hmm, good point, didn't think about that.
Removed the gosub.
EDIT:
Hmm, at the moment it seems to think the distance between the blowing up ship and the hit ship is either 0, or some big minus number.
Removed the gosub.
EDIT:
Hmm, at the moment it seems to think the distance between the blowing up ship and the hit ship is either 0, or some big minus number.

______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Ah, okay. Look at the signatures of the commands again and you'll see why:
<RetVar> = get distance between <Var/Ship/Station> and <Var/Ship/Station>
<RetVar> = get distance: position array1=<Var/Array> array2=<Var/Array>
You use the first command, which directly uses ingame objects, but you give it position arrays. Thus you should either use the second command or use the objects directly (which is imo the better choice).
Greetings,
ScRaT
<RetVar> = get distance between <Var/Ship/Station> and <Var/Ship/Station>
<RetVar> = get distance: position array1=<Var/Array> array2=<Var/Array>
You use the first command, which directly uses ingame objects, but you give it position arrays. Thus you should either use the second command or use the objects directly (which is imo the better choice).
Greetings,
ScRaT
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
Where do you define $Hull for the following line?
Greetings,
ScRaT
Code: Select all
$HullAfter = $Hull - $Debt
ScRaT
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Can't believe I didn't notice that. I'd just noticed that if you've got more shielding than damage taken you end up with -debt, which is then -... so if you took a bit of shield damage with a ship with hull damage you'd get hull back.
Can't believe I didn't notice I slightly more glaringly obvious point.
Yup, fixed.
Dumped some Falcon S. next to an Akuma, one directly inside it, one 500m away from the center (in one wall), then 1km, 2km, 4km, and 6km.
1 and 2 eliminated, 3 17% shield, 4 99% shield, 5 & 6 completely untouched.
Will try again with a less shielded fighter for trials.


Yup, fixed.
Dumped some Falcon S. next to an Akuma, one directly inside it, one 500m away from the center (in one wall), then 1km, 2km, 4km, and 6km.
1 and 2 eliminated, 3 17% shield, 4 99% shield, 5 & 6 completely untouched.
Will try again with a less shielded fighter for trials.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Any better maths I could use for the damage?
If Range = 0
Damage = 1500000
Else
Damage = 1500000 / Range
Top = Damage + ((Damage / 100) * 20)
Bottom = Damage - ((Damage / 100) * 20)
DamageRand = Random number between Top and Bottom -1.
If Range > 5000
?
Top damage would be 1,500,000
Bottom would be 300 at 5 Km.
(not taking into account the randomiser)
Does that sound feasible?
What I don't like is ending on 300 damage, which for small crafts is quite significant. 1m could seperate you from serious damage to no damage if you're in an M5.
EDIT: Most of that was complete nonsense.
If Range = 0
Damage = 1500000
Else
Damage = 1500000 / Range
Top = Damage + ((Damage / 100) * 20)
Bottom = Damage - ((Damage / 100) * 20)
DamageRand = Random number between Top and Bottom -1.
If Range > 5000
?
Top damage would be 1,500,000
Bottom would be 300 at 5 Km.
(not taking into account the randomiser)
Does that sound feasible?
What I don't like is ending on 300 damage, which for small crafts is quite significant. 1m could seperate you from serious damage to no damage if you're in an M5.
EDIT: Most of that was complete nonsense.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
-
- Posts: 1962
- Joined: Tue, 8. Jan 08, 18:19
How about some pyhsics? The intensity of a spherical wave is proportional to the square of the distance. In other words:
I ~ 1/r²
So in your case this would be:
$Damage = $Damage / ($Range * $Range)
If $Range is small, the resulting damage will be big, if it is big, the resulting damage will be small.
You should take some care when calculating in X like this of course, since it only uses integers. Additionally you have to take into account overflows (could be the result of $Range * $Range) and dividing by zero (although that should never happen since two objects will almost (?) never have the same position).
Greetings,
ScRaT
I ~ 1/r²
So in your case this would be:
$Damage = $Damage / ($Range * $Range)
If $Range is small, the resulting damage will be big, if it is big, the resulting damage will be small.
You should take some care when calculating in X like this of course, since it only uses integers. Additionally you have to take into account overflows (could be the result of $Range * $Range) and dividing by zero (although that should never happen since two objects will almost (?) never have the same position).
Greetings,
ScRaT