[Discussion] Generic X3TC S&M questions II
Moderators: Scripting / Modding Moderators, Moderators for English X Forum
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Signals are often ran twice just because... well, it's a bug I think. It's best to run a check using a variable to see if it's been run before on the same object.
As for the second, ship I would assume.
As for the second, ship I would assume.
______
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: 3823
- Joined: Fri, 12. Aug 05, 20:46
As long as flags doesn't contains [find.multiple] it will return only one ship granted one is found.
You should definitively put something in flag anyway, [Find.Random] or [Find.Nearest] at least.
You should definitively put something in flag anyway, [Find.Random] or [Find.Nearest] at least.
X3:TC/AP Pirate Guild 3 - Yaki Armada 2 - Anarkis Defense System
Anarkis Gaming HQ
Independent Game Development
X3 Scripting and Modding Station
Anarkis Gaming HQ
Independent Game Development
X3 Scripting and Modding Station
-
- Posts: 14
- Joined: Wed, 16. Nov 05, 04:59
I have a quick question about
I'm writing a docking script that checks if the ship has a docking computer, if so, it calls 'put into environment' to place the ship in the station.
The problem is that it doesn't work for the playership?
To check that it was executing properly, I placed a 'write to player log' call before and after the 'put into environment' call, but the first string is the only one that appears. The script seems to terminate at the 'put' call, but if I tell another ship to dock, it flys into range and pops inside so it seems to be specific to the playership.
The ship is only a TM and can dock normally.
Any clues? or what am I doing wrong?
Code: Select all
<object> -> put into environment <env>
The problem is that it doesn't work for the playership?
To check that it was executing properly, I placed a 'write to player log' call before and after the 'put into environment' call, but the first string is the only one that appears. The script seems to terminate at the 'put' call, but if I tell another ship to dock, it flys into range and pops inside so it seems to be specific to the playership.
The ship is only a TM and can dock normally.
Any clues? or what am I doing wrong?
-
- Posts: 2033
- Joined: Wed, 29. Jun 05, 01:45
@ SlapNTickle
Is the script still running? i.e. is it still on the stack of scripts that are running, or is just completely gone?
Also how are you running the script? (global script? or on the playership?)
I suspect one of a few things could be happening
a) Running that on the playership is causing an error in X3, thus it is terminating the script (Instead of the usual continuing)
b) (less likely IMHO) it may be "wait"-ing until it can complete this action (in which case the script is still on the stack). Does getting out of the ship cause it to finish running the script?
btw. Put into env, does not relate in any way to having or not having a docking computer.
Is the script still running? i.e. is it still on the stack of scripts that are running, or is just completely gone?
Also how are you running the script? (global script? or on the playership?)
I suspect one of a few things could be happening
a) Running that on the playership is causing an error in X3, thus it is terminating the script (Instead of the usual continuing)
b) (less likely IMHO) it may be "wait"-ing until it can complete this action (in which case the script is still on the stack). Does getting out of the ship cause it to finish running the script?
btw. Put into env, does not relate in any way to having or not having a docking computer.
-
- Posts: 14
- Joined: Wed, 16. Nov 05, 04:59
s9ilent
I also use 'put into env' in my move to sector script so I don't require any energy (never liked that "feature"
) and that works fine running on the playership.
b. Getting out didn't help as the script wasn't on the stack.
The ships speed is set to 0, which is the 'put into env' call, then the autopilot X that appears in the middle of the screen turns off. I checked the script editor and the script isn't running as a task or on the stack.Is the script still running? i.e. is it still on the stack of scripts that are running, or is just completely gone?
The script is running on the playership.Also how are you running the script? (global script? or on the playership?)
I also use 'put into env' in my move to sector script so I don't require any energy (never liked that "feature"

a. How does the game handle the insta-dock when the playership has a docking computer installed and you select Autodock (or whatever it's called) from the station menu when your in range?I suspect one of a few things could be happening
a) Running that on the playership is causing an error in X3, thus it is terminating the script (Instead of the usual continuing)
b) (less likely IMHO) it may be "wait"-ing until it can complete this action (in which case the script is still on the stack). Does getting out of the ship cause it to finish running the script?
b. Getting out didn't help as the script wasn't on the stack.
Yes I know, what I wanted was to have the ship insta-dock if it had a docking computer installed, otherwise dock normally with 'fly to station'. Sometimes when docking the playership normally it doesn't lower the docking clamp and you have to manually request docking permission. I wasn't sure if this happened to script controlled ships as well but wanted to eliminate the possibility just in case. Although turning on SETA while docking seems to prevent the problem.btw. Put into env, does not relate in any way to having or not having a docking computer.
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Ok, I'm having really bad trouble with my support scripts now.
They spawn ships for missions, but it's really complex.
Each mission is different, has it's own section of support scripts of which 1 has just been changed and another I ripped apart and all the rest aren't done.
Each one needs to spawn a slightly random amount of ships based on a load of parameters I can't think about how to set...
Grr!
Imagine a mission which requires spawning an M1 and M2, a few M7, loads of M6 and M8 and fighter swarms, outfitting and telling them to attack another spawned enemy fleet, and the ships in each fleet differ by race, the numbers differ by unwritten parameters, the mission difficulty etc...
I'm literally despairing here.
If someone with just a little time on there hands could take a look at some stuff for me I'd be so so happy.
They spawn ships for missions, but it's really complex.
Each mission is different, has it's own section of support scripts of which 1 has just been changed and another I ripped apart and all the rest aren't done.
Each one needs to spawn a slightly random amount of ships based on a load of parameters I can't think about how to set...
Grr!
Imagine a mission which requires spawning an M1 and M2, a few M7, loads of M6 and M8 and fighter swarms, outfitting and telling them to attack another spawned enemy fleet, and the ships in each fleet differ by race, the numbers differ by unwritten parameters, the mission difficulty etc...

If someone with just a little time on there hands could take a look at some stuff for me I'd be so so happy.
______
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: 1135
- Joined: Sun, 19. Oct 08, 18:46
LOL, yeah I've tried to code missions in the past via script editor... it's proabably the most difficult kind of script you can do. Soo many combinations of factors to consider. Good luck with that.
There are 10 types of people in the S&M forums - those who understand binary, and those who don't.
Black holes are where God divided by zero.
Black holes are where God divided by zero.
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
The missions are fine, it's just the complex-ness of spawning everything.
If I could do it MD I would, but the fact that you choose to do the missions yourself and they give you a rank and everything means I'd need to make every military into a corporation to do it.
Anyway, if anyone has any ideas or time, just say.

If I could do it MD I would, but the fact that you choose to do the missions yourself and they give you a rank and everything means I'd need to make every military into a corporation to do it.

Anyway, if anyone has any ideas or time, just say.


______
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
I've got it sort of working now, but I'll need someone to have a quick check over it... there's some...
'Problems'.
Anyway...
I really hope I can get this working.
EDIT:
Ok, I've ended up with this.
It's going to be long when it's finished.
Only 1 side spawns, and I get, well, all the random stuff I'd expect that I'll have to filter out. Astronauts etc.
But can you see the problem?
Or any problem? It's the section '81' that we're looking at, from line 58.
'Problems'.
Anyway...

I really hope I can get this working.
EDIT:
Ok, I've ended up with this.
It's going to be long when it's finished.
Only 1 side spawns, and I get, well, all the random stuff I'd expect that I'll have to filter out. Astronauts etc.
But can you see the problem?
Or any problem? It's the section '81' that we're looking at, from line 58.
Code: Select all
Arguments
1: Type , Var/Number , 'Type'
2: Dif , Value , 'Difficulty'
3: Sec , Var/Sector , 'Sector'
4: Target , Value , 'Target'
5: Enemy , Var/Race , 'Enemy'
Source Text
001 $BaseNum = 4
002
003 $Class = array alloc: size=0
004 append M1 to array $Class
005 append M2 to array $Class
006 append M3 to array $Class
007 append M4 to array $Class
008 append M5 to array $Class
009 append M6 to array $Class
010 append M7 to array $Class
011 append M8 to array $Class
012
013 if $Dif == 1
014 |$AllyMulti = 3
015 |$EnemyMulti = 1
016 else if $Dif == 2
017 |$AllyMulti = 5
018 |$EnemyMulti = 2
019 else if $Dif == 3
020 |$AllyMulti = 8
021 |$EnemyMulti = 4
022 else if $Dif == 4
023 |$AllyMulti = 12
024 |$EnemyMulti = 8
025 else if $Dif == 5
026 |$AllyMulti = 15
027 |$EnemyMulti = 12
028 else if $Dif == 6
029 |$AllyMulti = 16
030 |$EnemyMulti = 17
031 else if $Dif == 7
032 |$AllyMulti = 20
033 |$EnemyMulti = 25
034 end
035
036
037 display subtitle text: text='Calculating sup.' duration=400 ms
038 $Mil = get global variable: name='ej.player.which.military'
039
040 if $Type == 11
041 * Recon
042 |
043 else if $Type == 12
044 * Anti-Recon
045 |
046 else if $Type == 21
047 * Patrol Intercept
048 |
049 else if $Type == 22
050 * All Patrols
051 |
052 else if $Type == 31
053 * All Escorts
054 |
055 else if $Type == 72
056 * Destroy Capital
057 |
058 else if $Type == 81
059 * Clear Sector
060 |$RBase = $BaseNum * $AllyMulti
061 |$RBase = $BaseNum * $EnemyMulti
062 |
063 |$ClasslistSize = size of array $Class
064 |while $ClasslistSize
065 ||dec $ClasslistSize =
066 ||$IndClass = $ClasslistSize[$Class]
067 ||$Ar = array alloc: size=0
068 ||$Ar = get ship type array: maker race=$Mil class=$IndClass
069 ||$ShipCount = size of array $Ar
070 ||while $RBase
071 |||dec $RBase =
072 |||$ShipsUse = = random value from 0 to $ShipCount - 1
073 |||$FShip = $Ar[$ShipsUse]
074 |||$FShip = create ship: type=$FShip owner=$Mil addto=$Sec x=0 y=0 z=0
075 |||$FShip -> set local variable: name='ej.military.support' value=[TRUE]
076 |||$Name = sprintf: fmt='%s Special Task Force %s', $Mil, $FShip, null, null, null
077 |||$FShip -> set name to $Name
078 |||$FShip -> add default items to ship
079 |||$FShip -> set race logic control enabled to [FALSE]
080 @ |||= wait 100 ms
081 @ |||START $FShip -> call script '!ship.cmd.killenemies.std' :
082 |||display subtitle text: text='Support incoming!' duration=400 ms
083 ||end
084 |end
085 |
086 |$ClasslistSize = size of array $Class
087 |while $ClasslistSize
088 ||dec $ClasslistSize =
089 ||$IndClass = $ClasslistSize[$Class]
090 ||$Ar = array alloc: size=0
091 ||$Ar = get ship type array: maker race=$Enemy class=$IndClass
092 ||$ShipCount = size of array $Ar
093 ||while $RBase
094 |||dec $RBase =
095 |||$ShipsUse = = random value from 0 to $ShipCount - 1
096 |||$FShip = $Ar[$ShipsUse]
097 |||$FShip = create ship: type=$FShip owner=$Enemy addto=$Sec x=0 y=0 z=0
098 |||$FShip -> set local variable: name='ej.military.support' value=[TRUE]
099 |||$Name = sprintf: fmt='%s Special Task Force %s', Paranid, $FShip, null, null, null
100 |||$FShip -> set name to $Name
101 |||$FShip -> add default items to ship
102 |||$FShip -> set race logic control enabled to [FALSE]
103 @ |||= wait 100 ms
104 @ |||START $FShip -> call script '!job.fight.attackallenemies' :
105 |||display subtitle text: text='Support incoming!' duration=400 ms
106 ||end
107 |end
108 |
109 else if $Type == 82
110 * Destroy Factory
111 |$Fight = get ship type array: maker race=$Mil class=M3
112 |$FShip = create ship: type=$Ship owner=$Mil addto=$Sec x=0 y=0 z=0
113 |$FShip -> set local variable: name='ej.military.support' value=[TRUE]
114 |$Name = sprintf: fmt='%s Special Task Force %s', $Mil, $Ship, null, null, null
115 |$FShip -> set name to $Name
116 |$FShip -> add default items to ship
117 |$FShip -> set race logic control enabled to [FALSE]
118 @ |= wait 100 ms
119 @ |START $FShip -> call script '!ship.cmd.attack.std' : the victim=$Target do not follow in new sector=[TRUE]
120 |display subtitle text: text='Support incoming!' duration=400 ms
121 |
122 else if $Type == 91
123 * Transport
124 |
125 else if $Type == 92
126 * Rescue
127 |
128 else if $Type == 93
129 * Build
130 end
131 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: 1468
- Joined: Wed, 3. Aug 05, 05:05
to start with,
Why do these both have the same variable name? line 61 overwrites line 60.
again same name,
You don't need to create an array first for the 'get ship type' command, it will handle that itself.
and i think this,
Prob should be,
same with this,
MarCon
Why do these both have the same variable name? line 61 overwrites line 60.
Code: Select all
060 |$RBase = $BaseNum * $AllyMulti
061 |$RBase = $BaseNum * $EnemyMulti
Code: Select all
067 ||$Ar = array alloc: size=0
068 ||$Ar = get ship type array: maker race=$Mil
and i think this,
Code: Select all
066 ||$IndClass = $ClasslistSize[$Class]
Code: Select all
066 ||$IndClass = $Class[$ClasslistSize]
Code: Select all
089 ||$IndClass = $ClasslistSize[$Class]
MarCon
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Ah, the first one is a mistake, the rest are probably my real faults...
Made those modifications and just got a load of bombers.
EDIT2:
Looks like the swapping of those 2 class things was definitely not needed.
I'm still getting odd ships though.
I expect to get things which have been shoved in under M5 etc., but TMs, TSs and TPs!?
Made those modifications and just got a load of bombers.

EDIT2:
Looks like the swapping of those 2 class things was definitely not needed.
I'm still getting odd ships though.
I expect to get things which have been shoved in under M5 etc., but TMs, TSs and TPs!?

______
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
Right. So.
I know the Skip If doesn't work because it's an object class and an object crossing. Don't worry. I know. I'm fixing it.
The question is...
Why is it spawning TS, TM, TP and TLs ANYWAY!? :wtf:
Code: Select all
001 $BaseNum = 4
002
003 $Class = array alloc: size=0
004 append M1 to array $Class
005 append M2 to array $Class
006 append M3 to array $Class
007 append M4 to array $Class
008 append M5 to array $Class
009 append M6 to array $Class
010 append M7 to array $Class
011 append M8 to array $Class
012
013 if $Dif == 1
014 |$AllyMulti = 3
015 |$EnemyMulti = 1
016 else if $Dif == 2
017 |$AllyMulti = 5
018 |$EnemyMulti = 2
019 else if $Dif == 3
020 |$AllyMulti = 8
021 |$EnemyMulti = 4
022 else if $Dif == 4
023 |$AllyMulti = 12
024 |$EnemyMulti = 8
025 else if $Dif == 5
026 |$AllyMulti = 15
027 |$EnemyMulti = 12
028 else if $Dif == 6
029 |$AllyMulti = 16
030 |$EnemyMulti = 17
031 else if $Dif == 7
032 |$AllyMulti = 20
033 |$EnemyMulti = 25
034 end
035
036
037 display subtitle text: text='Calculating sup.' duration=400 ms
038 $Mil = get global variable: name='ej.player.which.military'
039
040 if $Type == 11
041 * Recon
042 |
043 else if $Type == 12
044 * Anti-Recon
045 |
046 else if $Type == 21
047 * Patrol Intercept
048 |
049 else if $Type == 22
050 * All Patrols
051 |
052 else if $Type == 31
053 * All Escorts
054 |
055 else if $Type == 72
056 * Destroy Capital
057 |
058 else if $Type == 81
059 * Clear Sector
060 |$RBase = $BaseNum * $AllyMulti
061 |$RBase2 = $BaseNum * $EnemyMulti
062 |
063 |$ClasslistSize = size of array $Class
064 |while $ClasslistSize
065 ||dec $ClasslistSize =
066 ||$IndClass = $ClasslistSize[$Class]
067 ||$Ar = array alloc: size=0
068 ||$Ar = get ship type array: maker race=$Mil class=$IndClass
069 ||$ShipCount = size of array $Ar
070 ||while $RBase
071 |||dec $RBase =
072 |||$ShipsUse = = random value from 0 to $ShipCount - 1
073 |||$FShip = $Ar[$ShipsUse]
074 |||skip if $FShip == TS OR $FShip == TM OR $FShip == TP OR $FShip == TL
075 ||||$FShip = create ship: type=$FShip owner=$Mil addto=$Sec x=0 y=0 z=0
076 |||$FShip -> set local variable: name='ej.military.support' value=[TRUE]
077 |||$Name = sprintf: fmt='%s Special Task Force %s', $Mil, $FShip, null, null, null
078 |||$FShip -> set name to $Name
079 |||$FShip -> add default items to ship
080 |||$FShip -> set race logic control enabled to [FALSE]
081 @ |||= wait 100 ms
082 @ |||START $FShip -> call script '!ship.cmd.killenemies.std' :
083 |||display subtitle text: text='Support incoming!' duration=400 ms
084 ||end
085 |end
086 |
087 |$ClasslistSize = size of array $Class
088 |while $ClasslistSize
089 ||dec $ClasslistSize =
090 ||$IndClass = $ClasslistSize[$Class]
091 ||$Ar = array alloc: size=0
092 ||$Ar = get ship type array: maker race=$Enemy class=$IndClass
093 ||$ShipCount = size of array $Ar
094 ||while $RBase2
095 |||dec $RBase2 =
096 |||$ShipsUse = = random value from 0 to $ShipCount - 1
097 |||$FShip = $Ar[$ShipsUse]
098 |||skip if $FShip == TS OR $FShip == TM OR $FShip == TP OR $FShip == TL
099 ||||$FShip = create ship: type=$FShip owner=$Enemy addto=$Sec x=0 y=0 z=0
100 |||$FShip -> set local variable: name='ej.military.support' value=[TRUE]
101 |||$Name = sprintf: fmt='%s Special Task Force %s', Paranid, $FShip, null, null, null
102 |||$FShip -> set name to $Name
103 |||$FShip -> add default items to ship
104 |||$FShip -> set race logic control enabled to [FALSE]
105 @ |||= wait 100 ms
106 @ |||START $FShip -> call script '!job.fight.attackallenemies' :
107 |||display subtitle text: text='Support incoming!' duration=400 ms
108 ||end
109 |end
110 |
111 else if $Type == 82
112 * Destroy Factory
113 |$Fight = get ship type array: maker race=$Mil class=M3
114 |$FShip = create ship: type=$Ship owner=$Mil addto=$Sec x=0 y=0 z=0
115 |$FShip -> set local variable: name='ej.military.support' value=[TRUE]
116 |$Name = sprintf: fmt='%s Special Task Force %s', $Mil, $Ship, null, null, null
117 |$FShip -> set name to $Name
118 |$FShip -> add default items to ship
119 |$FShip -> set race logic control enabled to [FALSE]
120 @ |= wait 100 ms
121 @ |START $FShip -> call script '!ship.cmd.attack.std' : the victim=$Target do not follow in new sector=[TRUE]
122 |display subtitle text: text='Support incoming!' duration=400 ms
123 |
124 else if $Type == 91
125 * Transport
126 |
127 else if $Type == 92
128 * Rescue
129 |
130 else if $Type == 93
131 * Build
132 end
133 return null
The question is...
Why is it spawning TS, TM, TP and TLs ANYWAY!? :wtf:
______
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.
______
-
- Sith Lord
- Posts: 8255
- Joined: Wed, 6. Nov 02, 20:31
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
Ok, that definitely doesn't work, because it's trying to get it from an object not a type.
So.
Is there a way to work out the class of a type, not an object?
And if not, ot just anyway, why am I getting things other than M1-8 which are arrayed! GRR!
So.
Is there a way to work out the class of a type, not an object?
And if not, ot just anyway, why am I getting things other than M1-8 which are arrayed! GRR!
______
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
well to start with your putting your 'classes' into array $Class,And if not, ot just anyway, why am I getting things other than M1-8 which are arrayed! GRR!
Code: Select all
003 $Class = array alloc: size=0
004 append M1 to array $Class
005 append M2 to array $Class
006 append M3 to array $Class
007 append M4 to array $Class
008 append M5 to array $Class
009 append M6 to array $Class
010 append M7 to array $Class
011 append M8 to array $Class
Code: Select all
092 ||$Ar = get ship type array: maker race=$Enemy class=$IndClass
Code: Select all
090 ||$IndClass = $ClasslistSize[$Class]
-
- Posts: 9378
- Joined: Mon, 29. Dec 08, 20:58
How?
I've changed those as you told me before because that's how they should go, but I only get M1s if I swap the arrays round, I got M8s and then Mammoths before.
So for some reason it's trying to increase the arrays, it's going above M8.
I think.
I'm so confuuused!
I've changed those as you told me before because that's how they should go, but I only get M1s if I swap the arrays round, I got M8s and then Mammoths before.
So for some reason it's trying to increase the arrays, it's going above M8.
I think.
I'm so confuuused!
______
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
Could someone please just take a look at it so I don't lose my sanity?!
Once this is done it's almost plain sailing...
Thanks again for all the support you lot give. I like this community!
EDIT:
The logs say M1, M2, M3, M4 etc...
And it only ever makes things on the first thing it's given!?
Something dodgy with the
or whatever that UniTrader told me to put in... 
I've got no idea how to random it without that though lol.
Once this is done it's almost plain sailing...

Thanks again for all the support you lot give. I like this community!

EDIT:
Code: Select all
001 $BaseNum = 4
002
003 $Class = array alloc: size=0
004 append M8 to array $Class
005 append M7 to array $Class
006 append M6 to array $Class
007 append M5 to array $Class
008 append M4 to array $Class
009 append M3 to array $Class
010 append M2 to array $Class
011 append M1 to array $Class
012
013 if $Dif == 1
014 |$AllyMulti = 3
015 |$EnemyMulti = 1
016 else if $Dif == 2
017 |$AllyMulti = 5
018 |$EnemyMulti = 2
019 else if $Dif == 3
020 |$AllyMulti = 8
021 |$EnemyMulti = 4
022 else if $Dif == 4
023 |$AllyMulti = 12
024 |$EnemyMulti = 8
025 else if $Dif == 5
026 |$AllyMulti = 15
027 |$EnemyMulti = 12
028 else if $Dif == 6
029 |$AllyMulti = 16
030 |$EnemyMulti = 17
031 else if $Dif == 7
032 |$AllyMulti = 20
033 |$EnemyMulti = 25
034 end
035
036
037 display subtitle text: text='Calculating sup.' duration=400 ms
038 $Mil = get global variable: name='ej.player.which.military'
039
040 if $Type == 11
041 * Recon
042 |
043 else if $Type == 12
044 * Anti-Recon
045 |
046 else if $Type == 21
047 * Patrol Intercept
048 |
049 else if $Type == 22
050 * All Patrols
051 |
052 else if $Type == 31
053 * All Escorts
054 |
055 else if $Type == 72
056 * Destroy Capital
057 |
058 else if $Type == 81
059 * Clear Sector
060 |$RBase = $BaseNum * $AllyMulti
061 |$RBase2 = $BaseNum * $EnemyMulti
062 |
063 |$ClasslistSize = size of array $Class
064 |while $ClasslistSize
065 ||dec $ClasslistSize =
066 ||$IndClass = $Class[$ClasslistSize]
067 ||write to player logbook $IndClass
068 ||$Ar = array alloc: size=0
069 ||$Ar = get ship type array: maker race=$Mil class=$IndClass
070 ||$ShipCount = size of array $Ar
071 ||while $RBase
072 |||dec $RBase =
073 |||$ShipsUse = = random value from 0 to $ShipCount - 1
074 |||$FShip = $Ar[$ShipsUse]
075 |||$FClass = $FShip -> get object class
076 |||write to player logbook $FClass
077 |||skip if $FClass == TS OR $FClass == TM OR $FClass == TP OR $FClass == TL
078 ||||$FShip = create ship: type=$FShip owner=$Mil addto=$Sec x=0 y=0 z=0
079 |||$FShip -> set local variable: name='ej.military.support' value=[TRUE]
080 |||$Name = sprintf: fmt='%s Special Task Force %s', $Mil, $FShip, null, null, null
081 |||$FShip -> set name to $Name
082 |||$FShip -> add default items to ship
083 |||$FShip -> set race logic control enabled to [FALSE]
084 @ |||= wait 100 ms
085 @ |||START $FShip -> call script '!ship.cmd.killenemies.std' :
086 |||display subtitle text: text='Support incoming!' duration=400 ms
087 ||end
088 |end
089 |
090 |$ClasslistSize = size of array $Class
091 |while $ClasslistSize
092 ||dec $ClasslistSize =
093 ||$IndClass = $Class[$ClasslistSize]
094 ||write to player logbook $IndClass
095 ||$Ar = array alloc: size=0
096 ||$Ar = get ship type array: maker race=$Enemy class=$IndClass
097 ||$ShipCount = size of array $Ar
098 ||while $RBase2
099 |||dec $RBase2 =
100 |||$ShipsUse = = random value from 0 to $ShipCount - 1
101 |||$FShip = $Ar[$ShipsUse]
102 |||$FClass = $FShip -> get object class
103 |||write to player logbook $FClass
104 |||skip if $FClass == TS OR $FClass == TM OR $FClass == TP OR $FClass == TL
105 ||||$FShip = create ship: type=$FShip owner=$Enemy addto=$Sec x=0 y=0 z=0
106 |||$FShip -> set local variable: name='ej.military.support' value=[TRUE]
107 |||$Name = sprintf: fmt='%s Special Task Force %s', Paranid, $FShip, null, null, null
108 |||$FShip -> set name to $Name
109 |||$FShip -> add default items to ship
110 |||$FShip -> set race logic control enabled to [FALSE]
111 @ |||= wait 100 ms
112 @ |||START $FShip -> call script '!job.fight.attackallenemies' :
113 |||display subtitle text: text='Support incoming!' duration=400 ms
114 ||end
115 |end
116 |
117 else if $Type == 82
118 * Destroy Factory
119 |$Fight = get ship type array: maker race=$Mil class=M3
120 |$FShip = create ship: type=$Ship owner=$Mil addto=$Sec x=0 y=0 z=0
121 |$FShip -> set local variable: name='ej.military.support' value=[TRUE]
122 |$Name = sprintf: fmt='%s Special Task Force %s', $Mil, $Ship, null, null, null
123 |$FShip -> set name to $Name
124 |$FShip -> add default items to ship
125 |$FShip -> set race logic control enabled to [FALSE]
126 @ |= wait 100 ms
127 @ |START $FShip -> call script '!ship.cmd.attack.std' : the victim=$Target do not follow in new sector=[TRUE]
128 |display subtitle text: text='Support incoming!' duration=400 ms
129 |
130 else if $Type == 91
131 * Transport
132 |
133 else if $Type == 92
134 * Rescue
135 |
136 else if $Type == 93
137 * Build
138 end
139 return null
And it only ever makes things on the first thing it's given!?
Something dodgy with the
Code: Select all
100 |||$ShipsUse = = random value from 0 to $ShipCount - 1
101 |||$FShip = $Ar[$ShipsUse]

I've got no idea how to random it without that though lol.
______
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
The problem lies within the "create ship" command.074 |||$FShip = $Ar[$ShipsUse]
075 |||$FClass = $FShip -> get object class
076 |||write to player logbook $FClass
077 |||skip if $FClass == TS OR $FClass == TM OR $FClass == TP OR $FClass == TL
078 ||||$FShip = create ship: type=$FShip owner=$Mil addto=$Sec x=0 y=0 z=0
$FShip is an object, not a ship class. But the "create ship" command needs a ship class, so it should be:
Code: Select all
078 ||||$FShip = create ship: type=$FClass owner=$Mil addto=$Sec x=0 y=0 z=0
Greetings,
ScRaT
-
- Posts: 2035
- Joined: Wed, 18. Aug 10, 14:28