Nexus Modding > Scripting

create a wreckyard

(1/3) > >>

Hades:
Hey need your help guy !
I would make a wreckyard, lot of ship with damaged device.
Is there a way to select all devices of a list of ship ?
I tried execlist(listships,selectdevices(1,s.this,inset(s.this,XX)));
But it does nothing and with dump(1) It appear in the console only appear 1piece of each device :/

The Old Dragon:
Hi Hades,

You're not far off.
Once you've created your list of ships in the yard (we'll call it 'MyShips' for now), try this...


--- Code: ---ExecList(MyShips,
           MyDevices:=GetFreeSel();
           SelectDevices(MyDevices,S.this, InSet(S.this, 31) | Not(InSet(S.this, 31));
           Dump(MyDevices);
);
--- End code ---

Basically, we select any Set 31 devices and then any that aren't Set 31, therefore collecting any and all devices aboard the wrecks.  :)

Hades:
Thanks for the help Old Dragon ;), it seems it select all devices, but i have still an issue with the damage^^
I tried

--- Code: ---while(numof(mydevices)>0,pickfirst(mydevices):damage:=rnd(0,100);removefirst(mydevices););
--- End code ---

and

--- Code: ---execlist(mydevices,s.this:damage:=rnd(0,100));
--- End code ---

and when i launch the game none of the devices are damaged :/

The Old Dragon:
Have you tried placing the code in the 'SceneInit' rule?

I have a mission set up with some targets floating about in it. Placing this in the SceneInit rule has the desired effect for me.


--- Code: ---Targets:=GetfreeSel();
selectShips(Targets,S.race=#race_Target_Bouys);
Execlist(Targets,
MakeFullyKnown(S.this);
FreezeReconState(S.this,1);

                      Devs:=GetFreeSel();
SelectDevices(Devs,S.this,InSet(S.this,31)|Not(InSet(S.this,31)));
ExecList(Devs,S.this:Damage:=rnd(0,100));
Dump(Devs);
);
--- End code ---

Though it didn't want to play when placed in the 'In' rule of the 'Director' machine...

Hades:
Yeah it was in the sceneinit, but I find why it didn't work.

Need to put everything about the devices (select them and execution) in the execlist of the list "myships" the way I did was that


--- Code: --- selectships(myships,s.race=#race_OSEC);dump(myships);
execlist(myships,makefullyknown(s.this);freezereconstate(s.this,1););
execList(MyShips,MyDevices:=GetFreeSel();SelectDevices(MyDevices,S.this,InSet(S.this, 31) | Not(InSet(S.this, 31));));
execlist(mydevices,s.this:damage:=rnd(0,100));
--- End code ---
We must put  the last one next the selectdevices, but i don't know why lol.
It works now thanks !  :love:

Navigation

[0] Message Index

[#] Next page

Go to full version