Frictional Games Forum (read-only)

Full Version: Exploding doors
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
The player has an explosive potion. When you use it on the door, they explode - how to do it? I have a script for this, but it shows the information "Cannot use this item in this way"...
Here's the script:
("Completed" - that is exploding potion; "cheryl" - this is normal door; "cherylBroken" - this is broken door)

AddUseItemCallback("", "Completed", "cheryl", "Boom", true);

void Boom(string &in asItem, string &in asEntity)
{
SetEntityActive("cheryl", false);
SetEntityActive("cherylBroken", true);
PlaySoundAtEntity("", "06_break_wood.snt", "cheryl", 0, false);
RemoveItem("Complete");
}
Where exactly did you put AddUseItemCallback("", "Completed", "cheryl", "Boom", true);


These:
SetEntityActive("cheryl", false);
SetEntityActive("cherylBroken", true);
PlaySoundAtEntity("", "06_break_wood.snt", "cheryl", 0, false);


can be replaced by this:
SetPropHealth("cheryl", 0);


Also you have a typo here: RemoveItem("Complete");
It should be: RemoveItem("Completed");
I put it under "void OnStart()" in my .hps file, as here:

////////////////////////////
// Run when starting map
void OnStart()
{
SetPlayerLampOil(0.0f);
AddUseItemCallback("", "Completed", "cheryl", "Boom", true);
AddUseItemCallback("", "basementkey_1", "basement_1", "KeyOnDoor", true);
(...)
And you're sure the item is called "Completed" and the door is called "cheryl"?
You have to be 100% sure with capitals and all that
You're right, I did not notice the error in the name. Now everything is working. Thank you for your time Smile
(12-03-2012, 10:44 PM)giacomo9 Wrote: [ -> ]You're right, I did not notice the error in the name. Now everything is working. Thank you for your time Smile
When it says "Cannot use item this way!" is because names are wrong.
(12-03-2012, 11:00 PM)The chaser Wrote: [ -> ]
(12-03-2012, 10:44 PM)giacomo9 Wrote: [ -> ]You're right, I did not notice the error in the name. Now everything is working. Thank you for your time Smile
When it says "Cannot use item this way!" is because names are wrong.
Not exactly. It means that it finds no connection between the item and the entity. For example if the names are wrong.