Constrictor mission oddities (a lot of spoilers!)

For test results, bug reports, announcements of new builds etc.

Moderators: winston, another_commander, Getafix

User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Constrictor mission oddities (a lot of spoilers!)

Post by Cmdr James »

I have got to the "right system" a few times, and killed the constrictor.

There are a few things that are not quite as I expected.

If I eject after killing him, it does not seem to complete the mission.

He does not drop a canister, just one metal (which is just alloys) - did I miss out on a cloaking device, or any other equipment? I know there is a cloaking device mission in galaxy 5. He also does not seem to eject even though I know he has an escape pod (this is interesting as there is a bonus for catching the pod)

I know the 256 kills is "canon", but it seems quite an odd thing to be rewarded with (outside of strict mode). Also, you only get one kill for a thargoid, even a really big cruiser with all kinds of guns and whatnot all over it, so 256 for something about as powerful as a regular thargoid is a bit over the top. In non-strict maybe it should be replaced with a medal, or more cash?

He seems very easy to kill (I have fore military lasers, and military shield boosters on a cobra 3), the only problem is getting him before he injects out into the middle of nowhere and you have to try again. out of maybe 10 tries I killed him about 7, and lost him a couple, he never killed me, never did any damage at all I dont think.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

No, there is no equipment or anything. The Constrictor’s death_actions just set a variable that causes a reward payout to happen next time you dock.

I see this as another case of “making it make sense is not our mission”. You could override the mission with an OXP, but I’m not in favour of major changes to the core game missions.
User avatar
Cmdr James
Commodore
Commodore
Posts: 1357
Joined: Tue Jun 05, 2007 10:43 pm
Location: Berlin

Post by Cmdr James »

Makes sense. I might investigate what is going on with the mission not ending properly if I launch an escape pod instead of docking normally though.

This is exactly as far as I got in Elite TNK, so a big day for me :)
User avatar
Hoopy
---- E L I T E ----
---- E L I T E ----
Posts: 438
Joined: Wed Oct 03, 2007 8:54 pm
Location: Durham, England

Post by Hoopy »

once i get to Elite in Oolite I should perhaps go back to TNK to get to Elite in that. I think I got to about 4-5000 kills, but you can 'cheat' by knowing that shooting a cargo cannister gives you a kill... Is that worse that shooting inactive tharglets rather than scooping them?
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Hoopy wrote:
once i get to Elite in Oolite I should perhaps go back to TNK to get to Elite in that. I think I got to about 4-5000 kills, but you can 'cheat' by knowing that shooting a cargo cannister gives you a kill... Is that worse that shooting inactive tharglets rather than scooping them?
Shooting cargo should not award you a kill. There is special code in it to disable this. When it still happens there is a bug somewhere.

Awarding a kill for shooting targlets it wrong in my opinion. Original tharglets were rare and were only present when you had already killed the mother. For the mother you got just 1 point so also giving points for the children seemed fair. But with all those OXP's generating also targlets without intervention of the player, it seems wrong to give killpoints for them.
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Hoopy wrote:
but you can 'cheat' by knowing that shooting a cargo cannister gives you a kill...
Eric Walch wrote:
Shooting cargo should not award you a kill. There is special code in it to disable this. When it still happens there is a bug somewhere.
Second that for 'normal' cases. But maybe Hoopy has shot a honeypod? Maybe a trap or something. How much money was awarded?
Eric Walch wrote:
Awarding a kill for shooting targlets it wrong in my opinion. Original tharglets were rare and were only present when you had already killed the mother. For the mother you got just 1 point so also giving points for the children seemed fair.
Yupp. Good point Eric. Maybe the kill should only be added when the mother is still alive.
User avatar
Hoopy
---- E L I T E ----
---- E L I T E ----
Posts: 438
Joined: Wed Oct 03, 2007 8:54 pm
Location: Durham, England

Post by Hoopy »

sorry - maybe i wasn't clear: In Elite:TNK you get a kill for shooting cargo pods. I've never got a kill in any other version of Elite.

I think you're right too - points for killing inactive tharglets seems too much like cheating.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

I took it on me to rewrite the conhunt mission into JS. It is just a few lines of code. It will be ready soon. Maybe the problem with the escapepod will than automatical be solved. At least I can not see why the mission does not work when using a pod.

One other related item. Currently the constrictor uses a pirateAI.plist. I have never had problems with it but as it had a bounty, it is possible that police ships find him sooner and chase him away before the player finds him. (they could even kill him)

Should I leave it that way (stay as original as possible) or give the ship his own AI.plist. Than I can also give the ship his own script that calculates the distance to the player. When > 50000 I set the bounty to "clean" to avoid police (and the like) attacking the ship and set is back to its original value when the player approaches within 50000 meters. The player will not see any difference.

This would also be a good example of a ship with his own script and the AI interacting with the script.
Last edited by Eric Walch on Mon Feb 25, 2008 2:39 pm, edited 1 time in total.
User avatar
TGHC
---- E L I T E ----
---- E L I T E ----
Posts: 2157
Joined: Mon Jan 31, 2005 4:16 pm
Location: Berkshire, UK

Post by TGHC »

I thought that the Constrictor mission was hard coded!?

As far as the A1 is concerned, I would leave it as is, it fits in with the fuel injectors in Oolite. In the original version the constrictor was a real pain, in that it twisted and turned all over the place and had very strong shields, so it was a wrist aching slow grind of a kill.
The Grey Haired Commander has spoken!
OK so I'm a PC user - "you know whats scary? Out of billions of sperm I was the fastest"
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

None of the built-in missions are hard-coded (unless you count the carrier market). They’re scripted in the same way as OXPs. The idea of making the Constrictor non-criminal when it’s far from the player is a good one.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

I translated the constrictor-hunt mission into JS. On this I noticed a bug (or better wrong behaviour). However, I see no possibility to do it better:

When entering the SYSTEM_DATA_SCREEN, a message is added to the screen. I noticed it is always shown, no matter at witch system you are looking. This has always been so as the script has no clue at witch system you were looking.

In the original version the text was added when you were in the system. No matter if docked or in flight. I changed that to being docked only. For me is looks better and I avoid checking while in flight.

Translation proved to more challenging than I original thought. Oolite used a trick to add those messages: All legacy scripts are evaluated on hitting the F7 key. (I never knew it but looking at the original script it had to be in the code an I found it in "PlayerEntityControls.m". I also noticed in this file that legacy scripts launch always immediately after a mission screen ends. (not limited by the 10 seconds timer)

I didn't want to use a tickle to add the messages on the F7 screen, so I introduced a timer. Also a good opportunity to show the use of a timer.

The code below should do the trick. I only tested the initial part, but it should work all. Comments are welcome before I finalise it. Tomorrow I look at the ship-script.

Code: Select all

this.name        = "oolite-constrictor-hunt"; 
this.author      = "eric walch"; 
this.copyright   = "© 2008 the Oolite team."; 
this.description = "Constrictor hunt mission"; 
this.version     = "1.71"; 

/*
A timer has been set up on docking to check for the system_data_screen. When found the timer is stopped.
On certain system_data_screens a message is added.
*/
this.checkScreen = function()
{
    if(guiScreen == "GUI_SCREEN_SYSTEM_DATA" && !this.messageAdded)
    {
        this.messageAdded = true
        if(galaxyNumber == 0)
        {
            switch (system.ID)
            {
            case  28: mission.addMessageTextKey("constrictor_hunt_0_28"); break
            case  36: mission.addMessageTextKey("constrictor_hunt_0_36"); break
            case 150: mission.addMessageTextKey("constrictor_hunt_0_150"); break
            default: break;
            }
        }
        if(galaxyNumber == 1)
        {
            switch (system.ID)
            {
            case   3: 
            case   5:
            case  16:
            case  26:
            case  32:
            case  68:
            case 106:
            case 107:
            case 162:
            case 164:
            case 184:
            case 192:
            case 220: mission.addMessageTextKey("constrictor_hunt_1_A"); break
            case 253: mission.addMessageTextKey("constrictor_hunt_1_253"); break
            case  79: mission.addMessageTextKey("constrictor_hunt_1_79"); break
            case  53: mission.addMessageTextKey("constrictor_hunt_1_53"); break
            case 118: mission.addMessageTextKey("constrictor_hunt_1_118"); break
            case 193: mission.addMessageTextKey("constrictor_hunt_1_193"); break
            default: break;
            }
        }
    }
    else
    {
        if(!player.docked) this.conhuntTimer.stop() // stop timer when launched !
        this.messageAdded = false // set to false when not on GUI_SCREEN_SYSTEM_DATA screen
    }
}

/*
All the screen offers look alike. Therefor a function is created that does the work. With a single call from other parts all the things are set. When a function has a value it is set and when null it is cleared.
*/
this.missionScreen=function(messageKey, backGround, choiceKey, ShipKey, MusicKey)
{
    mission.showShipModel(ShipKey);mission.setMusic(MusicKey);
    mission.setBackgroundImage(backGround);
    mission.showMissionScreen();
    mission.addMessageTextKey(messageKey);
    if (choiceKey) mission.setChoicesKey(choiceKey);
    mission.setBackgroundImage(); mission.setMusic();
}

this.missionOffers = function()
{
    if (guiScreen == "GUI_SCREEN_MISSION") return; // there will be a "missionScreenEnded" in future to react uppon.
    if (missionVariables.offering || (mission.choice && mission.choice != ""))  return;
    // there will be a "missionChoiceWasReset" in future to react uppon.
    if (player.dockedStation.isMainStation)
    {
        if(missionVariables.conhunt == "MISSION_COMPLETE")
        // remove all event handlers after mission completion.
        {
            delete this.missionScreenEnded
            delete this.missionChoiceWasReset
            delete this.shipExitedWitchspace
            delete this.shipLaunchedFromStation
            delete this.shipDockedWithStation
        }
        if(galaxyNumber < 2 && !missionVariables.conhunt && player.score > 255)
        {
            this.missionScreen("constictor_hunt_brief1", null, null, "constrictor");
            if(galaxyNumber == 0) mission.addMessageTextKey("constrictor_hunt_brief1a"); // galaxy = 0
            else mission.addMessageTextKey("constrictor_hunt_brief1b"); // galaxy = 1
            missionVariables.conhunt = "STAGE_1"
            mission.setInstructionsKey("conhunt_short_desc1") 
        }
        if(galaxyNumber < 2 && missionVariables.conhunt == "STAGE_1")
        {
                // set up a timer for display in the the GUI_SCREEN_SYSTEM_DATA while docked.
                if(this.conhuntTimer) this.conhuntTimer.start()
                else this.conhuntTimer = new Timer(this, this.checkScreen, 0.25, 0.25)
                this.messageAdded = false
        }
        if(missionVariables.conhunt == "CONSTRICTOR_DESTROYED")  // Variable is set by the ship-script
        {
             this.missionScreen("constictor_hunt_debrief", null, null, "constrictor");
             player.credits += 5000
             player.bounty = 0	// legal status
             player.score += 256 // shipkills
             mission.addMessageTextKey()  // reset the missionbriefing
             missionVariables.conhunt == "MISSION_COMPLETE"
        }
    }
}

this.setUpShips = function()
{
    if(missionVariables.conhunt == "STAGE_1" && galaxyNumber == 1 && system.ID == 193)
    {
        if(system.countShipsWithRole("constrictor") == 0) system.legacy_addShips("constrictor", 1)
    }
}

// below are the 5 eventhandlers that are triggered by the system.
this.shipDockedWithStation = function()
{
    this.missionOffers()
}

this.missionScreenEnded = this.missionChoiceWasReset = function()
{
    if(!player.docked) return;
    this.missionOffers()
}

this.shipExitedWitchspace = this.shipLaunchedFromStation = function()
{
    this.setUpShips();
}
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Eric Walch wrote:
Translation proved to more challenging than I original thought. Oolite used a trick to add those messages: All legacy scripts are evaluated on hitting the F7 key. (I never knew it but looking at the original script it had to be in the code an I found it in "PlayerEntityControls.m". I also noticed in this file that legacy scripts launch always immediately after a mission screen ends. (not limited by the 10 seconds timer)

I didn't want to use a tickle to add the messages on the F7 screen, so I introduced a timer. Also a good opportunity to show the use of a timer.
Presumably, that -checkScript was added for the benefit of the constrictor mission. :-)

It seems sensible to add script events for switching to the GUI screens that are script-friendly, and I’ll look for other places where -checkScript is called. I happen to be going through the various AI -reactToMessage:s at the moment. If you can think of anything else that should have a script notification, now would be a good time to speak up.

That reminds me… I know we had a discussion about which screens should have tickle events a while back, but I just noticed that the market screen is excluded while contracts, equip and shipyard are not. Unless anyone can think of a reason for that, I’ll add market to the ticky set.
User avatar
Eric Walch
Slightly Grand Rear Admiral
Slightly Grand Rear Admiral
Posts: 5536
Joined: Sat Jun 16, 2007 3:48 pm
Location: Netherlands

Post by Eric Walch »

Ahruman wrote:
Presumably, that -checkScript was added for the benefit of the constrictor mission. :-)
That was also what I thought when seeing the checkScript there.
Ahruman wrote:
It seems sensible to add script events for switching to the GUI screens that are script-friendly, and I’ll look for other places where -checkScript is called.
I saw checkScript is also called on pressing F5. But for the constictor mission I am content with the timer option. Internal mission code should give programming examples and with the remaining two missions I see no logical reason to add a timer.
Ahruman wrote:
That reminds me… I know we had a discussion about which screens should have tickle events a while back, but I just noticed that the market screen is excluded while contracts, equip and shipyard are not. Unless anyone can think of a reason for that, I’ll add market to the ticky set.
The reason was that players could hit return on an item and then select a mission option that just turned up. (it happened me twice with fuel) For one, the mission itself can check to add only a screen when on a save place when there are choices. The legacy version of UPS will only show briefings without choices on such "dangerous" GUI screens. With JS there will be no pause for the player to go to those screens, so there will be no problem.

But still, an eventhandler: SwitchedScreen(OldScreen) could be useful for an OXP to react upon when there are no tickles used. It saves adding timers for that purpose.
User avatar
JensAyton
Grand Admiral Emeritus
Grand Admiral Emeritus
Posts: 6657
Joined: Sat Apr 02, 2005 2:43 pm
Location: Sweden
Contact:

Post by JensAyton »

Eric Walch wrote:
The reason was that players could hit return on an item and then select a mission option that just turned up. (it happened me twice with fuel)
The question then becomes: why do tickles happen on the contracts, equip and shipyard screens? Are there any legacy scripts that rely on this?
But still, an eventhandler: SwitchedScreen(OldScreen) could be useful for an OXP to react upon when there are no tickles used. It saves adding timers for that purpose.

Code: Select all

this.guiScreenChanged = function (toScreen, fromScreen)
{
    log("jstest.guiSwitched", "GUI switched from " + fromScreen + " to " + toScreen + ".");
}
Output:

Code: Select all

GUI switched from GUI_SCREEN_INTRO2 to GUI_SCREEN_STATUS.
GUI switched from GUI_SCREEN_OPTIONS to GUI_SCREEN_EQUIP_SHIP.
GUI switched from GUI_SCREEN_EQUIP_SHIP to GUI_SCREEN_STATUS.
GUI switched from GUI_SCREEN_STATUS to GUI_SCREEN_MANIFEST.
GUI switched from GUI_SCREEN_MANIFEST to GUI_SCREEN_STATUS.
GUI switched from GUI_SCREEN_STATUS to GUI_SCREEN_SHORT_RANGE_CHART.
GUI switched from GUI_SCREEN_SHORT_RANGE_CHART to GUI_SCREEN_LONG_RANGE_CHART.
GUI switched from GUI_SCREEN_LONG_RANGE_CHART to GUI_SCREEN_MARKET.
GUI switched from GUI_SCREEN_MARKET to GUI_SCREEN_SYSTEM_DATA.
There’s a discrepancy between the first two lines, because there’s no notification for switching to the options screen. I’m in two minds about this. On the one hand, there are screens scripts shouldn’t care about and don’t need to be notified for. On the other hand, being certain of getting a switched notification when leaving a screen would probably be convenient in various situations. One possibility is to lump all the “special” screens together into GUI_SCREEN_SPECIAL or some such and send notifications when “special” becomes the current gui screen. Personally I’m in favour of leaving it as is (i.e., you’re not guaranteed a notification when leaving a screen), because doing it the nicer way is likely to be a lot of work. :-)
User avatar
Svengali
Commander
Commander
Posts: 2370
Joined: Sat Oct 20, 2007 2:52 pm

Post by Svengali »

Ahruman wrote:
The question then becomes: why do tickles happen on the contracts, equip and shipyard screens?
If timer-events would stay untouched and the notification for legacy-scripts after that is granted - switch them off. I can't see a reason to do a tickle on such screens. But that would mean to disallow launching from these screens too?

If I remember right, you've said that the use of legacy-scripting will be discouraged after the MSNR. Is this still the plan?
Post Reply