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
Script Help [SOLVED] Using a Single Crowbar on Multiple Doors
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#21
RE: Using a Single Crowbar on Multiple Doors

Of course that's why... I'm an idiot.. sorry.

The problem was that when you were done with the first door, you'd get a crowbar from GiveItem but I had given it the wrong name, since I didn't know what name you were using. And since it now had the wrong name, it wouldn't work on the other doors. Glad you got it working!

Trying is the first step to success.
09-22-2014, 09:24 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#22
RE: Using a Single Crowbar on Multiple Doors

It's no problem! Big Grin Thank you for the wall of text though, it was super helpful.

Just wish I knew what was going on with the sounds and particles. :/

EDIT:

Nvm, fixed that too!

I never added the variable to AreaEffect. *facepalm*

The script is now in full working order and I will edit the OP with the script for future generations! ;D

(This post was last modified: 09-22-2014, 09:29 AM by AGP.)
09-22-2014, 09:26 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#23
RE: Using a Single Crowbar on Multiple Doors

Edit: AHEM, I'll just spoiler this because of the comment below Wink

Spoiler below!
See, your particles and sounds are being played at the area named AreaEffect for each door. Because the doors probably aren't in the same location, that won't do well. Try this:

Rename the area for each door to match the placement of it, for example AreaEffect_Door_1 for Door_1.

In the script, do a similar thing as before with the particle and sound script lines. When referencing the "AreaEffect" instead try "AreaEffect_"+GetLocalVarString("CrowbarDoor"). If that string is Door_1, then the name should match the area by Door_1.

(This post was last modified: 09-22-2014, 09:31 AM by Mudbill.)
09-22-2014, 09:29 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#24
RE: Using a Single Crowbar on Multiple Doors

Well, let's see if you can fix it yourself.

Hint:
Everytime you break the door with the crowbar, a sound and a particle effect will be active at "AreaEffect".

Any idea why it won't work at other areas?


NINJA'D.

God dammit Mudbill! Big Grin

Trying is the first step to success.
(This post was last modified: 09-22-2014, 09:31 AM by FlawlessHappiness.)
09-22-2014, 09:30 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#25
RE: Using a Single Crowbar on Multiple Doors

(09-22-2014, 09:29 AM)Mudbill Wrote: See, your particles and sounds are being played at the area named AreaEffect for each door. Because the doors probably aren't in the same location, that won't do well. Try this:

Rename the area for each door to match the placement of it, for example AreaEffect_Door_1 for Door_1.

In the script, do a similar thing as before with the particle and sound script lines. When referencing the "AreaEffect" instead try "AreaEffect_"+GetLocalVarString("Door"). If that string is Door_1, then the name should match the area by Door_1.

Yes, just realized this. *facepalm*

for(int i=1; i<=4; ++i) CreateParticleSystemAtEntity("", "ps_hit_wood.ps", "AreaEffect_"+i, false);
    for(int i=1; i<=4; ++i) PlaySoundAtEntity("", "break_wood_metal", "AreaEffect_"+i, 0, false);

09-22-2014, 09:31 AM
Find
Mudbill Offline
Muderator

Posts: 3,881
Threads: 59
Joined: Apr 2013
Reputation: 179
#26
RE: Using a Single Crowbar on Multiple Doors

Dammit, I was too late for the spoiler xP

(This post was last modified: 09-22-2014, 09:32 AM by Mudbill.)
09-22-2014, 09:32 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#27
RE: [SOLVED] Using a Single Crowbar on Multiple Doors

Actually, no the for loop won't work here, AGP.

Because now, when you're doing the callback, the sound will play at ALL of the doors, and the particle will spawn at all the areas at the same time!

Trying is the first step to success.
09-22-2014, 09:35 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#28
RE: [SOLVED] Using a Single Crowbar on Multiple Doors

Haha! XD Thanks, guys, for the help! I went ahead and posted the full working script so that others may enjoy the awesomeness. Big Grin

(09-22-2014, 09:35 AM)FlawlessHappiness Wrote: Actually, no the for loop won't work here, AGP.

Because now, when you're doing the callback, the sound will play at ALL of the doors, and the particle will spawn at all the areas at the same time!

Oh shoot! You're right! *facepalm again*

(This post was last modified: 09-22-2014, 09:36 AM by AGP.)
09-22-2014, 09:35 AM
Find
FlawlessHappiness Offline
Posting Freak

Posts: 3,980
Threads: 145
Joined: Mar 2012
Reputation: 171
#29
RE: [SOLVED] Using a Single Crowbar on Multiple Doors

Since you're having the two things in the collide callback, why not have them call at

"AreaEffect_"+asParent.

And just rename all the effect areas to the right names.

Trying is the first step to success.
09-22-2014, 09:39 AM
Find
AGP Offline
Senior Member

Posts: 448
Threads: 45
Joined: Dec 2012
Reputation: 23
#30
RE: [SOLVED] Using a Single Crowbar on Multiple Doors

It's now gone back to skipping the particle effects. :/

It did work using "_"+i, but it did make the particles appear for all the other doors.

09-22-2014, 09:44 AM
Find




Users browsing this thread: 1 Guest(s)