How to get local variables in case of death?

The place to discuss scripting and game modifications for X³: Terran Conflict and X³: Albion Prelude.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Nicoman35
Posts: 661
Joined: Thu, 17. Nov 05, 14:12

How to get local variables in case of death?

Post by Nicoman35 » Sat, 22. Oct 11, 08:38

Hi,
I would like to save the content of a local variable stored on a certain ship, when this ship is destroyed. Is this possible?
Bye

User avatar
Jack08
Posts: 2971
Joined: Sun, 25. Dec 05, 11:42

Re: How to get local variables in case of death?

Post by Jack08 » Sat, 22. Oct 11, 10:13

Nicoman35 wrote:Hi,
I would like to save the content of a local variable stored on a certain ship, when this ship is destroyed. Is this possible?
Bye
you can access the local variable from a SIGNAL_KILLED script, but once signal killed has been fired im afraid the object pointer is invalid and you cant retrive data from a non-existant object
Image
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire

User avatar
Gazz
Posts: 12423
Joined: Fri, 13. Jan 06, 17:39

Re: How to get local variables in case of death?

Post by Gazz » Sat, 22. Oct 11, 11:22

SIGNAL_KILLED fires before the oject is "officially" killed.
That's the whole point because you couldn't do anything about an object that doesn't exist.

It doesn't seem to be entirely reliable, though. Sometimes ships vanish without a "killed" message in the player logs.
My complete script download page. . . . . . I AM THE LAW!
There is no sense crying over every mistake. You just keep on trying till you run out of cake.

User avatar
Jack08
Posts: 2971
Joined: Sun, 25. Dec 05, 11:42

Re: How to get local variables in case of death?

Post by Jack08 » Sat, 22. Oct 11, 12:00

Gazz wrote:SIGNAL_KILLED fires before the oject is "officially" killed.
That's the whole point because you couldn't do anything about an object that doesn't exist.

It doesn't seem to be entirely reliable, though. Sometimes ships vanish without a "killed" message in the player logs.
I thaught thats what i said?
Sorry must have worded it wrong.

But also take note that SIGNAL_KILLED is fired twice on the same obejct when a ship dies, so remember to set a local variable to true and check for it witihn the killed script if you need this signal to only fire once
Image
"One sure mark of a fool is to dismiss anything that falls outside his experience as being impossible."
―Farengar Secret-Fire

Nicoman35
Posts: 661
Joined: Thu, 17. Nov 05, 14:12

Post by Nicoman35 » Mon, 24. Oct 11, 10:57

Ok guys, thanks for the info.

Post Reply

Return to “X³: Terran Conflict / Albion Prelude - Scripts and Modding”