Frictional Games Forum (read-only)
Exploding doors - Printable Version

+- Frictional Games Forum (read-only) (https://www.frictionalgames.com/forum)
+-- Forum: Amnesia: The Dark Descent (https://www.frictionalgames.com/forum/forum-6.html)
+--- Forum: Custom Stories, TCs & Mods - Development (https://www.frictionalgames.com/forum/forum-38.html)
+---- Forum: Development Support (https://www.frictionalgames.com/forum/forum-39.html)
+---- Thread: Exploding doors (/thread-19428.html)



Exploding doors - giacomo9 - 12-03-2012

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");
}



RE: Exploding doors - FlawlessHappiness - 12-03-2012

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");


RE: Exploding doors - giacomo9 - 12-03-2012

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);
(...)


RE: Exploding doors - FlawlessHappiness - 12-03-2012

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


RE: Exploding doors - giacomo9 - 12-03-2012

You're right, I did not notice the error in the name. Now everything is working. Thank you for your time Smile


RE: Exploding doors - The chaser - 12-03-2012

(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.


RE: Exploding doors - FlawlessHappiness - 12-04-2012

(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.