Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Exploding doors
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#1
Exploding doors

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");
}
12-03-2012, 09:18 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#2
RE: Exploding doors

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

Trying is the first step to success.
(This post was last modified: 12-03-2012, 09:38 PM by FlawlessHappiness.)
12-03-2012, 09:37 PM
Find
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#3
RE: Exploding doors

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);
(...)
12-03-2012, 09:44 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#4
RE: Exploding doors

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

Trying is the first step to success.
(This post was last modified: 12-03-2012, 10:29 PM by FlawlessHappiness.)
12-03-2012, 10:29 PM
Find
giacomo9 Offline
Junior Member

Posts: 37
Threads: 11
Joined: Nov 2012
Reputation: 0
#5
RE: Exploding doors

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
Find
The chaser Offline
Posting Freak

Posts: 2,486
Threads: 76
Joined: Jun 2012
Reputation: 113
#6
RE: Exploding doors

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

THE OTHERWORLD (WIP)
[Image: k6vbdhu]

Aculy iz dolan.
12-03-2012, 11:00 PM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#7
RE: Exploding doors

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

Trying is the first step to success.
12-04-2012, 06:50 AM
Find




Users browsing this thread: 1 Guest(s)