Nexus Modding > Scripting

Scripting Issues

<< < (24/25) > >>

Mularac:
About that previous issue, I managed to find a way to narrow down the problem.

Basically, when a specific weapon fires, a firstHit event is called regarding the targetted ship, and then I save the attacker and victim in 2 separate lists but with the same index, so when the FirstHit event is called, all I have to do is check that the "e.shooter" variable of that rule corresponds to the object present in the "attackers" list in the same index as the one of the victim. There's, however, a giagantic fault with that. Nexus doesn't admit repeated objects in their lists, so if, let's say, 2 ships attack the same one, the code will only get triggered for one of the hits.

So, is there a way to have repeated objects in a list??

Arparso:
I believe there is, if you're using an array rather than a normal selection. Use "Dim()" to create an array of a given size a and use "GetN()" and "SetN()" to retrieve or set individual array elements at a given position in the array. Something like:


--- Code: ---MyShip := GetSceneObj("MyShip");
MyArray := GetFreeSel();
Dim(MyArray, 200);
SetN(MyArray, 15, MyShip);
MyShipToo := GetN(MyArray, 15);

--- End code ---

Can't test it right now as I'm not at home, but that should work. However, if I remember correctly, Nexus doesn't support lists, arrays or selections bigger than 256 elements... for whatever arbitrary reason.

Mularac:
Yeah, that did it! thanks!

The Old Dragon:
Hi All,

Quick question, does anyone know where to find the code that triggers the various warnings (I'm mainly interested in the one for detecting incoming fighters, but I'd like to see the rest too)?

Thanks.

Arparso:
I think those might be hardcoded. I'm not completely sure, of course, but I don't remember stumbling across any script code related to issuing those warnings.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version