[Discussion] Generic X3TC S&M questions II

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Scripting / Modding Moderators, Moderators for English X Forum

User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

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.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
Serial Kicked
Posts: 3823
Joined: Fri, 12. Aug 05, 20:46
x3tc

Post by Serial Kicked »

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.
X3:TC/AP Pirate Guild 3 - Yaki Armada 2 - Anarkis Defense System

Anarkis Gaming HQ
Independent Game Development
X3 Scripting and Modding Station
SlapNTickle
Posts: 14
Joined: Wed, 16. Nov 05, 04:59
x3tc

Post by SlapNTickle »

I have a quick question about

Code: Select all

<object> -> put into environment <env>
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?
User avatar
s9ilent
Posts: 2033
Joined: Wed, 29. Jun 05, 01:45
x4

Post by s9ilent »

@ 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.
SlapNTickle
Posts: 14
Joined: Wed, 16. Nov 05, 04:59
x3tc

Post by SlapNTickle »

s9ilent
Is the script still running? i.e. is it still on the stack of scripts that are running, or is just completely gone?
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.
Also how are you running the script? (global script? or on the playership?)
The script is running 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" :wink: ) and that works fine running 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?
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?

b. Getting out didn't help as the script wasn't on the stack.
btw. Put into env, does not relate in any way to having or not having a docking computer.
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.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

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... :evil: 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.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
ThisIsHarsh
Posts: 1135
Joined: Sun, 19. Oct 08, 18:46
x3tc

Post by ThisIsHarsh »

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.
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

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. :roll:

Anyway, if anyone has any ideas or time, just say. :roll: :S
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

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... :S

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.
______
mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren »

to start with,

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 
again same name,

Code: Select all

067   ||$Ar =  array alloc: size=0 
068   ||$Ar =  get ship type array: maker race=$Mil 
You don't need to create an array first for the 'get ship type' command, it will handle that itself.


and i think this,

Code: Select all

066   ||$IndClass = $ClasslistSize[$Class] 
Prob should be,

Code: Select all

066   ||$IndClass = $Class[$ClasslistSize] 
same with this,

Code: Select all

089   ||$IndClass = $ClasslistSize[$Class] 

MarCon
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

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!? :gruebel:
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Right. So.

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
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:
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
LV
Sith Lord
Posts: 8255
Joined: Wed, 6. Nov 02, 20:31
x3tc

Post by LV »

097 |||$FShip = $Ar[$ShipsUse]

try getting obj class after this (may need a wtc check as well to get class can't remember) and using if class =! TM etc

it can be quirky, sometimes i don't use long checks because of this and stack
via single class checks in a loop
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

Ahem.
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.
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

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!
______
I'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
mark_a_condren
Posts: 1468
Joined: Wed, 3. Aug 05, 05:05
x3tc

Post by mark_a_condren »

And if not, ot just anyway, why am I getting things other than M1-8 which are arrayed! GRR!
well to start with your putting your 'classes' into array $Class,

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
and using $IndClass here,

Code: Select all

092   ||$Ar =  get ship type array: maker race=$Enemy class=$IndClass 
but it's being mucked up here, so you still need to fix these,

Code: Select all

090   ||$IndClass = $ClasslistSize[$Class] 
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

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'm Jon. I'm mostly not around any more. If you want to talk, please message me! It's cool.
______
User avatar
EmperorJon
Posts: 9378
Joined: Mon, 29. Dec 08, 20:58
x3tc

Post by EmperorJon »

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... :S

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
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

Code: Select all

100   |||$ShipsUse =  = random value from 0 to $ShipCount - 1
101   |||$FShip = $Ar[$ShipsUse]
or whatever that UniTrader told me to put in... :roll:

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.
______
User avatar
ScRaT_GER
Posts: 1962
Joined: Tue, 8. Jan 08, 18:19
x3tc

Post by ScRaT_GER »

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
The problem lies within the "create ship" command.
$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 
That's the only real mistake I saw, when checking your script.

Greetings,
ScRaT
User avatar
TrixX
Posts: 2035
Joined: Wed, 18. Aug 10, 14:28
x4

Post by TrixX »

Anyone had any success exporting models using Max 2011?

I lose all changes when I export mine at the moment.
"If you’re not prepared to be wrong, you’ll never come up with anything original."
Sir Ken Robinson

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”