Hard Light Productions Forums

Modding, Mission Design, and Coding => FS2 Open Coding - The Source Code Project (SCP) => Topic started by: Starman01 on November 16, 2006, 10:31:26 am

Title: "lock primary weapons" SEXP and Autopilot code
Post by: Starman01 on November 16, 2006, 10:31:26 am
I have a question :

I was trying to lock the players weapons so he can't shoot while inside the hangar. Not that it would really border me, but the problem is the other AI-fighters start panic like evasion maneuvers inside the hangar bay when I fire and then they start bumping into evey wall (kinda funny to watch, but still useless for the game :) )

So I locked player weapons, and everything is fine. But the autopilot code does the same, and once I come back into real time and regain control, the weapons are online again (ignoring my first "lock weapons SEXP").

Now, not even that would be bad, I could lock them at every navpoint, but I can't ! Obviously I'm only allowed to use this SEXP once in a mission.

Is this a "feature", or more a problem which results from the combination of the SEXP and the autopilot-code ?
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: karajorma on November 16, 2006, 10:54:44 am
I'll take a look. The weapon lock thing was added by me and it should simply be a case of it flipping a flag on or off.

I can't see anything wrong with either the sexp or the autopilot code. You definitely can lock and unlock weapons more than once in a mission. I just double checked that.

Build me a test mission (preferably with FS2 ships) that turns off the weapons, autopilots and then tries to turn them off again and I'll test it. I'd do it myself but I'm not familiar with the autopilot SEXPs and I don't really have the time to learn them today.
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: Starman01 on November 16, 2006, 01:23:34 pm
Hm, don't you have our beta at hand anymore ? Then I would just have to send you the upgraded Mission 01. I can't find my FS-Disks, so it's a little difficult for me to build something else (not impossible though, if everything brakes we can  edit it with notepad)
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: karajorma on November 16, 2006, 02:22:24 pm
Making a test mission in a case like this is generally worth the 5 minutes worth of work it would be. If the test mission works you know its something wrong with the mission not the code.
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: Starman01 on November 16, 2006, 02:37:18 pm
True. I'll make one and reply again, but I won't be able to do it  before Saturday I'm afraid.
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: Kazan on November 16, 2006, 03:02:29 pm
i think i know what's going on

he's locking they're weapons
they enter autopilot
they leave autopilot


entering autopilot locks weapons, leaving it unlocks them - it assumes they're unlocked prior to entering, when it needs to restore they're state to the previous level.. file it as a bug and i'll fix it
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: Starman01 on November 16, 2006, 03:08:58 pm
Yes, but once I exited autopilot, I can't lock weapons again using the SEXP, this seems to work only once.
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: karajorma on November 16, 2006, 03:32:50 pm
Exactly. I know that autopilot unlocks the weapons. but you should still be able to lock them again. I can't see any reason why you shouldn't be able to do that.
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: Starman01 on November 16, 2006, 03:35:19 pm
Maybe I just made an idiotic error and can't see the forest because of all the trees :)

I'll build that mission on the weekend, then we will see what happens.
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: AdmiralRalwood on November 16, 2006, 05:43:32 pm
It could be the game is trying to lock at the same time it's deactivating autopilot. Try waiting an extra second before locking, or something similar.
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: Starman01 on November 19, 2006, 02:54:10 am
K, I made a new mission and to my bad, it's working :(  Maybe Ralwood is right and I didn't timed it correctly. At least I hope so, if not I will bang my head against the wall. I like this mission so much, and there is so much work involved, I hope I get this one fixed (if not, I can still end the mission because you fired your weapons unallowed in a training mission, but that should be just the last consequence.
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: Starman01 on November 19, 2006, 03:54:33 am
It could be the game is trying to lock at the same time it's deactivating autopilot. Try waiting an extra second before locking, or something similar.

Cudos, that was the problem. I didn't thought about that. Thanks :)
Title: Re: "lock primary weapons" SEXP and Autopilot code
Post by: AdmiralRalwood on November 19, 2006, 11:44:52 am
No problem.