I'm back! And my questions are becoming increasingly difficult. But I'm sure you can handle that.
I am now able to let ships escape on command, but I noticed some weird effects I don't understand with that and I have a new problem.
Weird effects:
- When I add the goal to stay-near-ship with the ghost and then try to remove it, it doesn't happen. clear-goals works, removing a single goal doesn't. Are there any tips on how to use ai-remove-goal?
I solved the problem like this: I created an event "resume mission" as a copy of the "AI orders" event for this nav point and I call it every time the event that caused the retreat is true X seconds ago. Works so far, I use a variable (at least a ...sort of, see below) to build some sort of state machine so it doesn't fire all the time.
- how do I read variables? I found how to set them, but I can't find how to read them. That's the reason why I became... creative. I used the "is-cargo-known", "set-scanned" and "set-unscanned" SEXPs to use the scanned-flag of my ghost object as a boolean variable that I can set and read with events. Of course thats not good style so I'd like to know how I can use variables.
- every-time-argument seems to have a problem with AND, or the distance SEXP doesn't work as I think it does. My pictures show the example. The first one is working, the second one isn't.
So you might wonder what I'm actually trying to do. The answer is the following:
Saga does have pretty lethal capship explosions, and in some of my missions the player and his wingman are flying Darket light fighters. They will die every time they or somebody else in their vicinity blow a capship up.
Saga solved this problem by guarding almost all wingmen, so they couldn't die at all. In my campaign I don't want to to this since wingmen will be a bot more dispensable expendable than in the Saga main campaign. So they should be able die, but not because of capship explosions.
I thought about making them invincible for a few seconds every time a capship blows up, but I didn't like that much either.
So then I thought: Ok, why don't they just flee for a few seconds in some direction while the cap blows up, using their afterburners.
It took a while until I could script that but it worked and looks good. I told them to send a message every time they move away ("This ship will blow up, retreat and regroup!" and when they turn around and come back for their next attack ("resume mission").
And indeed everything works now, just by inserting two events with arguments for the capships for each wing that should flee from explosions. ....Except a few small things.
I want that they only flee if the capship is really near them. They are not supposed to flee if they are not close to the exploding capship. They do that now and I thought I could fix by just adding an AND. That seems to break the whole event though, and I'm not sure why.
[attachment deleted by a ninja]