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


Thread Rating:
  • 1 Vote(s) - 1 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Help with sounds!
Armored Cow Offline
Member

Posts: 72
Threads: 3
Joined: Sep 2010
Reputation: 0
#11
RE: Help with sounds!

MulleDK19 seems to know his way around the editor/scripting Tongue

He's probably helped the most besides the developers.
09-17-2010, 02:11 AM
Find
Cgturner Offline
Junior Member

Posts: 28
Threads: 7
Joined: Sep 2010
Reputation: 0
#12
RE: Help with sounds!

(09-17-2010, 02:11 AM)Armored Cow Wrote: MulleDK19 seems to know his way around the editor/scripting Tongue

He's probably helped the most besides the developers.

Yeah! Hahaha. I have another question, anyone feel free to answer. In this scenario, I want the door to creak open by itself once you step into the script area. I can make the sound (but need the .snt for the best wooden creak noise), but I don't know how to put in the actual action of opening. Any help is welcome!

P.S. I see the - void SetMoveObjectState(string& asName, float afState); - function, and it seems to be what I need, but I'm not sure how to implement that into the script.

Coding so far:

void OnStart()

{
    PlaySoundAtEntity("bang", "10_close_door", "Player", 0, false);
    
    AddEntityCollideCallback("Player", "area_squeal", "Collidearea_squeal", true, 1);
    
    AddEntityCollideCallback("Player", "area_scratch", "Collidearea_scratch", true, 1);
    
    AddEntityCollideCallback("Player", "opendoor", "Collideopendoor", true, 1);
    
    SetEntityPlayerInteractCallback("lantern_1", "LanternTaken", true);
    
    AddUseItemCallback("useexit", "PrisonKey", "PrisonDoor", "UseKey", true);
}    

void UseKey(string &in asItem, string &in asEntity)
{
    SetSwingDoorLocked(asEntity, false, true);

    RemoveItem(asItem);
}

void Collidearea_squeal(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("animal_squeal", "custom_animal_squeal01.snt", "Player", 0, false);
}

void Collidearea_scratch(string &in asParent, string &in asChild, int alState)
{
    AddTimer("hit_wood.snt", 0.5f, "TimerSoundSequence");
    AddTimer("hit_wood.snt", 1.0f, "TimerSoundSequence");
    AddTimer("hit_wood.snt", 1.4f, "TimerSoundSequence");
}
void LanternTaken(string &in asEntity)
{
    PlaySoundAtEntity("scratch", "05_wall_scratch", "Player", 0, false);
}

void TimerSoundSequence(string &in asTimer)
{
    PlaySoundAtEntity("hitwood", asTimer, "castle_arched01_1", 0, false);
}

void Collideopendoor(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("open", "door_level_wood_open.snt", "castle_arched01_1", 1, true);
}
Thanks!
09-17-2010, 03:21 AM
Find
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#13
RE: Help with sounds!

(09-17-2010, 03:21 AM)Cgturner Wrote:
(09-17-2010, 02:11 AM)Armored Cow Wrote: MulleDK19 seems to know his way around the editor/scripting Tongue

He's probably helped the most besides the developers.

Yeah! Hahaha. I have another question, anyone feel free to answer. In this scenario, I want the door to creak open by itself once you step into the script area. I can make the sound (but need the .snt for the best wooden creak noise), but I don't know how to put in the actual action of opening. Any help is welcome!

P.S. I see the - void SetMoveObjectState(string& asName, float afState); - function, and it seems to be what I need, but I'm not sure how to implement that into the script.

SetSwingDoorDisableAutoClose("door", true);
AddPropImpulse("door", 0.0f, 0.0f, -1.0f, "prop");

Not sure whether the local coordinate system is actually called "prop" or if it's called "local".

[Image: 16455.png]
09-17-2010, 03:25 AM
Find
Cgturner Offline
Junior Member

Posts: 28
Threads: 7
Joined: Sep 2010
Reputation: 0
#14
RE: Help with sounds!

Here's what I've got:
void Collideopendoor(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("open", "door_level_wood_open.snt", "castle_arched01_1", 1, true);
    SetSwingDoorDisableAutoClose("castle_arched01_1", true);
    AddPropImpulse("castle_arched01_1", 0.0f, 0.0f, -1.0f, "prop");
}

The sound plays correctly, but the door remains closed.

EDIT:
Well I've manipulated that code as much as possible, and the door still remains shut. What is supposed to be done? Is it something with the "prop" variable?
09-17-2010, 03:51 AM
Find
Cgturner Offline
Junior Member

Posts: 28
Threads: 7
Joined: Sep 2010
Reputation: 0
#15
RE: Help with sounds!

Okay, I am now working on the description when the door is interacted with (locked, and once unlocked).

AddEntityCollideCallback("Player","PrisonDoor","CollidePlayerWithPrisonDoor");

    AddEntityCollideCallback("Player","castle_arched01_1","CollidePlayerWithcastle_arched01_1");

void CollidePlayerWithPrisonDoor()
{
    if(HasItem("PrisonKey") == true)
    {
        SetMessage("Use your inventory to select the key and use it on the door.", 10);
    }
    else
    {
        SetMessage("You will need a key to open the cell door.", 5);
    }

}

void CollidePlayerWithcastle_arched01_1()
{
    if(HasItem("key_1") == true)
    {
        SetMessage("Use your inventory to select the key and use it on the door.", 10);
    }
    else
    {
        SetMessage("You will need a key to open this door.", 5);
    }

}
The game crashes upon starting when I use the code above. I got this off of the script functions wiki, but I may have used it the wrong way.

EDIT:
I would also like to know how to properly name in-game items, such as keys, so that it shows up both on-screen when the player is close enough, and in the inventory.
09-17-2010, 03:56 PM
Find
Armored Cow Offline
Member

Posts: 72
Threads: 3
Joined: Sep 2010
Reputation: 0
#16
RE: Help with sounds!

It looks good to me and I would test it but I can't at the moment due to other scripting problems Tongue


EDIT: Actually instead of an AddEntityCollideCallback for the Prison Door maybe you need SetEntityPlayerInteractCallback? Not sure.
09-17-2010, 04:04 PM
Find
MulleDK19 Offline
Senior Member

Posts: 545
Threads: 21
Joined: Jun 2009
Reputation: 10
#17
RE: Help with sounds!

(09-17-2010, 03:51 AM)Cgturner Wrote: Here's what I've got:
void Collideopendoor(string &in asParent, string &in asChild, int alState)
{
    PlaySoundAtEntity("open", "door_level_wood_open.snt", "castle_arched01_1", 1, true);
    SetSwingDoorDisableAutoClose("castle_arched01_1", true);
    AddPropImpulse("castle_arched01_1", 0.0f, 0.0f, -1.0f, "prop");
}

The sound plays correctly, but the door remains closed.

EDIT:
Well I've manipulated that code as much as possible, and the door still remains shut. What is supposed to be done? Is it something with the "prop" variable?

try with 1.0f instead of -1.0f

[Image: 16455.png]
09-17-2010, 04:06 PM
Find
jens Offline
Frictional Games

Posts: 4,093
Threads: 199
Joined: Apr 2006
Reputation: 202
#18
RE: Help with sounds!

(09-17-2010, 03:56 PM)Cgturner Wrote: Okay, I am now working on the description when the door is interacted with (locked, and once unlocked).

AddEntityCollideCallback("Player","PrisonDoor","CollidePlayerWithPrisonDoor");

    AddEntityCollideCallback("Player","castle_arched01_1","CollidePlayerWithcastle_arched01_1");

void CollidePlayerWithPrisonDoor()
{
    if(HasItem("PrisonKey") == true)
    {
        SetMessage("Use your inventory to select the key and use it on the door.", 10);
    }
    else
    {
        SetMessage("You will need a key to open the cell door.", 5);
    }

}

void CollidePlayerWithcastle_arched01_1()
{
    if(HasItem("key_1") == true)
    {
        SetMessage("Use your inventory to select the key and use it on the door.", 10);
    }
    else
    {
        SetMessage("You will need a key to open this door.", 5);
    }

}
The game crashes upon starting when I use the code above. I got this off of the script functions wiki, but I may have used it the wrong way.

EDIT:
I would also like to know how to properly name in-game items, such as keys, so that it shows up both on-screen when the player is close enough, and in the inventory.

As it says on the wiki, the code is not complete and does not work, it is simplified to be an example of the actual syntax. That is why the game will crash.
09-17-2010, 04:17 PM
Website Find
Cgturner Offline
Junior Member

Posts: 28
Threads: 7
Joined: Sep 2010
Reputation: 0
#19
RE: Help with sounds!

MulleDK19,
Still nothing. The sound still plays correctly, and I know I have the right Entity because I checked, and the sound is emitted from the door.

Jens,
I thought by saying "simplified" on the wiki, it meant "this is a working script, minus the correct names for entities, script areas, etc". Do I have any chance of you telling me the correct syntax, or should I check some of the pre-made scripts in the game itself?
09-17-2010, 04:25 PM
Find
Cgturner Offline
Junior Member

Posts: 28
Threads: 7
Joined: Sep 2010
Reputation: 0
#20
RE: Help with sounds!

Well, this is both sound and particle system related. I want to make sure this is the correct way to make a timed sequence for sound/particle effects.

void Collidearea_scratch(string &in asParent, string &in asChild, int alState)
{
    AddTimer("hit_wood01.snt", 0.5f, "TimerSoundSequence");
    AddTimer("hit_wood01.snt", 1.0f, "TimerSoundSequence");
    AddTimer("hit_wood01.snt", 1.4f, "TimerSoundSequence");
    AddTimer("ps_impact_dust_low", 0.5f, "TimerSoundSequence");
    AddTimer("ps_impact_dust_high", 1.0f, "TimerSoundSequence");
    AddTimer("ps_impact_dust_high", 1.4f, "TimerSoundSequence");
}

void TimerSoundSequence(string &in asTimer)
{
    PlaySoundAtEntity("hitwood01", asTimer, "castle_arched01_1", 0, false);
    CreateParticleSystemAtEntity("psgal", "ps_impact_dust_low", "castle_arched01_1", false);
    CreateParticleSystemAtEntity("psgal", "ps_impact_dust_high", "dust_3", false);
    CreateParticleSystemAtEntity("psgal", "ps_impact_dust_low", "dust_1", false);
}

The sound plays correctly, from the correct entity, but the particle effects happen every time the sound starts, and I only want each particle effect to happen once. Thanks for any help!
09-18-2010, 06:58 AM
Find




Users browsing this thread: 1 Guest(s)