Frictional Games Forum (read-only)

Full Version: Spencer Mansion
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3
Alright, I've been putting this off because I wanted to figure it out on my own but now I have no idea what I'm doing wrong. I made a key and a level door, and I want the two of them to get along.

What's wrong with this code? When I attempt to use the key on the door it just says "Can't use item this way."

Code:
void onStart()
{
    AddUseItemCallback("", "keysimple1", "mhbedroomdoor", "MHBedroom", true);
}


///
/// DOORS ///
///

void MHBedroom(string &in asItem, string &in asEntity)
{
    SetLevelDoorLocked("mhbedroomdoor", false);
    PlaySoundAtEntity("", "unlock_door.snt", "mhbedroomdoor", 0.0f, true);
    RemoveItem("keysimple1");
}

After this is sorted out, I can then make another progress video. The dining room is finished, though I'm probably gonna leave it out of the first map and use a level door to get to it.
Seriously, no one?
Hmm.. I'd put an "_" inbetween the "simple" and the "1" so: "keysimple_1"
In the level editor, do the names match up?
is the name of the door exactly what it is in the .hps file?
double check the names and such. I see nothing wrong with your script.
The problem should be of the names in the Level Editor and the .hps file like Snuffalofagus says.
Is an underscore really necessary for keys? Because it made absolutely no difference. I even replaced the '1' with an 'a' and it changed nothing. I also added an underscore to the name of the door, changing it to 'mhbedroom_door' but it was no use. No matter what I do to the script and names of the entities, it just doesn't work. I even changed the script so that the key would unlock a different level door but I got the same result.

I match everything correctly, but the game insists that the key 'can't be used this way' every time I test it. Either the world is wrong, or someone isn't telling me everything to make this work. The names match up and the script has no errors, which means something else is missing and I have on idea what.

However. Is there an alternate scripting method I can use? Like... could I create a little Script area around the doorknob, and that's where you have to use the key on to unlock the door? Would that work?
Hmm.. that's new.. never heard of that problem before.
I'm not sure if this would work, but most of my "AddUseItemCallback"s are in the OnEnter section..

and the /////Doors//// thing.. hmm.. Idk about that.
Added onEnter, and removed the ///DOORS thing, but still no changes. It just doesn't work.
(07-16-2011, 09:31 AM)AlexxShadenk777 Wrote: [ -> ]Added onEnter, and removed the ///DOORS thing, but still no changes. It just doesn't work.

in OnStart is better

You get the key in the map where you have to use the key???
Hmm.. this is very odd.. post ALL of your script.
and one more suggestion, try renaming the key and the door.
@H: Filippe: Yes, both key and door are in the same map.
@Snuffalofagus: I did post all of the script, it's the only thing I wrote into the hps.

And I renamed everything once already too.
Pages: 1 2 3