Nexus Modding > Scripting

Scripting Issues

<< < (4/25) > >>

Mularac:
there's a bit of a problem there with your code, when I send the "EnableActivateEvents" command and the shields of a ship havent been rised, then the previous shieldintegrity value are overwritten when I actually rise them, as the game detects that since the shields haven't been rised the shield integrity is "0".

So far my only solution has been to had the game inmediately rise the shields, even though there is no ship in sight, but that's only temporary.

The Old Dragon:
Another option then, maybe, is to manually write the initial value?
This would remove the need to temporarily raise the shields at the start of the mission...

Mularac:
the initial value?
there's such thing???

On another topic, how do you change the name of a ship when you insert it on a mission? I only get the name that appears on the .sobj file...

Arparso:
@Mularac:
You'll need to initialize the "LastShieldIntegrity" variable of each ship with a proper value, if you want to have the shields fully loaded after their first activation. Simply change the first rule of my example script above to:

--- Code: ---            RULE event In
                :action
                    SelectEx(s.shield,
                        EnableActivateEvents(s.this, 1);
                        s.this:owner:LastShieldIntegrity:=100000;            // raise this value, if it's not sufficient for your shields
                        Debug("enabled 'activate' events for shield", s.this, "on", s.this:owner);
                    );
                :end
            END

--- End code ---
After starting the mission, the shields won't be up at first, but they should be fully loaded after their first activation. (if not, raise the initial LastShieldIntegrity value even more)

Other question: how do you insert your ship into the mission? If by "CreateShip()" - this command takes the ship's name as 3rd parameter.

Mularac:
thanks, that did it.

and, no, the ship came from a fleet, added via de addlocation command. (campaign scripting)
I've tried the  *** := uGet("ship_***");, and it worked, because I could use "***" instead of "ship_***" in plenty of other things, but in the mission I get "ship_***" instead of "***"
That is, if I can now get pass the "I crash withouth no apparent reason" thing. I hate it that when I change two things I get four erros that each cost me a couple of hours....

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version