Object visibility

Hi there,

I’m writing a game and came across an oddity I don’t understand. I can’t find any resources that answer the question and, although I have a work around, I’d like to find out why it’s happening.

The game I’m writing is a Mech game and one of the missions has the player fighting an enemy mech and needing to cannibalize the power core.

I have a specific mech “damagedMech” that extends “organicAlienMech”. It has a component called “targetablePowerCore” that extends “combatTarget” named “active alien power core”.

Once the mech is reduced to 0 damage, I use “damagedMech.moveIntoForTravel(elsewhere)” ; I have a room called elsewhere that I’m stashing story objects and then move an object called “inactiveMech” (that is just a thing) from elsewhere to the player room. It has a component called “inactivePowerCore” that is a component and a thing, with the name of “inactive alien power core”.

This works fine for when “get inactive core” is entered but the confusing part is when I type ‘get core’ the response is:
Which core do you mean, the active alien power core, or the inactive alien power core?

I am relatively certain the original components were moved with the “damagedMech” owner to elsewhere and that only the inactivePowerCore is in the same room as the player.
Does anyone know why the parser is asking about the non-present core?
Is there a visibility fix or knowledge fix?

I can make the player ‘forget’ about the core, but that seems a poor fix.

I’m trying the following code and it seems to work the way you want it to:

Example
startRoom: Room 'Start Room'
    "This is the starting room. "
;

+ me: Actor
;

+ damagedMech: Actor 'damaged mech' 'damaged mech'
    dobjFor(Attack) {
        verify() { }
        check() { }
        action() {
            "You deal the final killing blow to the damaged mech. ";
            inactiveMech.moveInto(self.location);
            self.moveInto(nil);
        }
    }
;

++ activeCore: Component 'active alien power core' 'active alien power core'
;

inactiveMech: Heavy 'inactive mech' 'inactive mech'
;

+ inactiveCore: Thing 'inactive alien power core' 'inactive alien power core'
;

Start Room

This is the starting room.

The damaged mech is standing here.

>take core
You can’t have that; it’s part of the damaged mech.

>attack mech
You deal the final killing blow to the damaged mech.

>look
Start Room

This is the starting room.

The inactive mech contains an inactive alien power core.

>take core
Taken.

Could you provide an excerpt from your code? Without that it’s all poking around in the dark. (My guess is either one of your classes interferes with moveIntoForTravel, causing the active power core to be left behind, or things in elsewhere get added to scope somehow.)

Absolutely, thank you for answering!

It’ll take me about an hour but I’ll add the code as soon as I can :slight_smile: .

EDITED to add: You’ve got the bare bones of the whole scene already XD .

I was preparing the answer when I discovered the problem; inactiveMech was NOT just a thing;

inactiveMech: damagedMech 'wrecked inactive alien organic mech' 'inactive mech' @elsewhere

It looks like it copies the components as well!

I see you made damagedMech an actor. Is that an important distinction for relatively shallow ‘enemy bots’?

It gives you access to things like ActorStates (which I guess you could use instead of switching out the mech object), but other than that… as long as you don’t feel the need for those things, I don’t see why you shouldn’t just keep the mechs as Things.

Thank you very much :slight_smile: .

Welcome to TADS! I haven’t seen any TADS questions on here for pretty many weeks… :slight_smile:

1 Like

I was a little worried there wouldn’t be many responses but it’s been great so far :smiley: .

1 Like