Frictional Games Forum (read-only)
[SCRIPT] [SOLVED] Using a Single Crowbar on Multiple 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: [SCRIPT] [SOLVED] Using a Single Crowbar on Multiple Doors (/thread-26253.html)

Pages: 1 2 3 4 5


RE: Using a Single Crowbar on Multiple Doors - FlawlessHappiness - 09-22-2014

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!


RE: Using a Single Crowbar on Multiple Doors - AGP - 09-22-2014

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


RE: Using a Single Crowbar on Multiple Doors - Mudbill - 09-22-2014

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.



RE: Using a Single Crowbar on Multiple Doors - FlawlessHappiness - 09-22-2014

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


RE: Using a Single Crowbar on Multiple Doors - AGP - 09-22-2014

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

Code:
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);



RE: Using a Single Crowbar on Multiple Doors - Mudbill - 09-22-2014

Dammit, I was too late for the spoiler xP


RE: [SOLVED] Using a Single Crowbar on Multiple Doors - FlawlessHappiness - 09-22-2014

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!


RE: [SOLVED] Using a Single Crowbar on Multiple Doors - AGP - 09-22-2014

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*


RE: [SOLVED] Using a Single Crowbar on Multiple Doors - FlawlessHappiness - 09-22-2014

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.


RE: [SOLVED] Using a Single Crowbar on Multiple Doors - AGP - 09-22-2014

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.