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


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

Posts: 72
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Cgturner Offline
Junior Member

Posts: 28
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
MulleDK19 Offline
Senior Member

Posts: 545
Joined: Jun 2009
Reputation: 10
Post: #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 all posts by this user Quote this message in a reply
Cgturner Offline
Junior Member

Posts: 28
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Cgturner Offline
Junior Member

Posts: 28
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Armored Cow Offline
Member

Posts: 72
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
MulleDK19 Offline
Senior Member

Posts: 545
Joined: Jun 2009
Reputation: 10
Post: #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 all posts by this user Quote this message in a reply
jens Offline
Frictional Games

Posts: 4,095
Joined: Apr 2006
Reputation: 202
Post: #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
Visit this user's website Find all posts by this user Quote this message in a reply
Cgturner Offline
Junior Member

Posts: 28
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Cgturner Offline
Junior Member

Posts: 28
Joined: Sep 2010
Reputation: 0
Post: #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 all posts by this user Quote this message in a reply
Post Reply 




User(s) browsing this thread: 1 Guest(s)