Arexack_Heretic wrote:
That vicinity code.
It fires only once?
The planetary vicinity event triggers, as the name suggest, when you enter the vicinity of a planetary body, and that happens once.
Once you know you're near the sun, you can set up a timer, firing maybe once every 2 seconds or so. In there you can check if the temperature is high enough, then display the message/collect furs.
You'll also need to kill that timer, using the shipExitedPlanetaryVicinity event too. Inside that you put the code that says: is AH_trumble_timer running? stop that timer now, since we're away from the sun.
The code you've got there is trying to do a bit too much (something that was indeed needed in legacy - the thing is, we're not in legacy script anymore). As it says in the manifest documentation, if you try to add more cargo than you can fit, nothing bad will happen.
Edit: you did forget to reset the number of AH trumbles, though!
Code: Select all
this.fryTrumbles = function()
{
player.consoleMessage("Oh noes! Your careless sundiving has fried your trumbles!");
if (player.ship.cargoSpaceAvailable > 0)
{
// add as many furs as possible
player.ship.manifest.furs += missionVariables.AH_trumbleCount/1000
}
else
{
player.consoleMessage("Their furry corpses litter every corner of the ship.");
}
missionVariables.AH_trumbleCount = 0; // they're dead now.
};
Or if you really want to do something fancy:
Code: Select all
this.fryTrumbles = function()
{
player.consoleMessage("Oh noes! Your careless sundiving has fried your trumbles!");
var fursToAdd=missionVariables.AH_trumbleCount/1000; // using missionVariables is slow, use them as little as possible.
if (player.ship.cargoSpaceAvailable > 0)
{
if (player.ship.cargoSpaceAvailable < fursToAdd)
{
player.consoleMessage("No matter how hard you try, you can't stuff all their corpses in the cargo hold...");
}
// add as many furs as possible
player.ship.manifest.furs += fursToAdd;
}
else
{
player.consoleMessage("Their furry corpses litter every corner of the ship.");
}
missionVariables.AH_trumbleCount = 0; // they're dead now.
};