Nexus Modding > Scripting
Shields that prevent their parent ship from firing
Arparso:
Your condition looks wrong, try this:
--- Code: ---condition E.shield:devType=#shld_fulldef;
--- End code ---
First: E.shield is referencing the whole device - you can't directly compare it with your devicetype name. Instead, get the devType-variable of the device like seen above.
Second: When comparing two values, never use the assignment operator :=. To compare values (or variables) for equality, just use the equal sign =. The assignment operator should only be used to assign values to variables... you'll get unexpected behaviour when using it for comparisons.
The rest looks good. There's some room for improvement on your weapon selection code, though. Instead of checking the sets of the devices with InSet(), you can use s.this:weapon instead. It'll give an 1, if the device in question is a weapon and 0, if otherwise. That'll include fighters and bombers as well, though, so you may want to filter those out using !s.this:dockType.
--- Code: ---SelectDevices(Weapons,e.ship, s.this:weapon & !s.this:docktype);
--- End code ---
Keldane:
It figures - I tried changing the condition to almost exactly what you suggested, Arparso, but made the mistake of using E.Shield= instead of E.Shield:. Thank you for the help - it now works precisely as intended. :D
Navigation
[0] Message Index
[*] Previous page
Go to full version