[Mod] Character Voice edit

Sanocon
Posts: 57
Joined: Sat Mar 24, 2012 3:10 pm

Re: [Idea] Character Voice edit

Post by Sanocon » Mon Feb 03, 2014 10:58 pm

cchausman wrote:
Sanocon wrote:I already did that and it works, but only for the npcs not the player. The only sounds you get when your the player is physical contact sounds.
To clarify, physical contact sounds such as a punch landing or a weapon slicing flesh, not the character vocalizing.

On that note, I don't even think the NPCs make injury vocalizations, just effort sounds (attacking) and the death one.
Look in the data/sounds folder. There are different types the default is non-voice acting based, that's why they sound that way. (I can't remeber which alpha video it is but David did cover this on changing voice files.)

Ok I'm going to try adding the voice files myself and see the debug script when I boot a level. Anybody know what programing format the aschar file is so I can activate the proper programing highlighter?

cchausman
Posts: 22
Joined: Thu Aug 01, 2013 10:19 pm

Re: [Idea] Character Voice edit

Post by cchausman » Mon Feb 03, 2014 11:57 pm

Sanocon wrote:
cchausman wrote:
Sanocon wrote:I already did that and it works, but only for the npcs not the player. The only sounds you get when your the player is physical contact sounds.
To clarify, physical contact sounds such as a punch landing or a weapon slicing flesh, not the character vocalizing.

On that note, I don't even think the NPCs make injury vocalizations, just effort sounds (attacking) and the death one.
Look in the data/sounds folder. There are different types the default is non-voice acting based, that's why they sound that way. (I can't remeber which alpha video it is but David did cover this on changing voice files.)

Ok I'm going to try adding the voice files myself and see the debug script when I boot a level. Anybody know what programing format the aschar file is so I can activate the proper programing highlighter?
I believe .as is the extension for an action script file. I don't understand the rest of what you said though.

Sanocon
Posts: 57
Joined: Sat Mar 24, 2012 3:10 pm

Re: [Idea] Character Voice edit

Post by Sanocon » Wed Feb 05, 2014 7:42 pm

ok so after a while, i figured out how to implement the sounds. (programming talk activated) so what's going on is the aschar script uses [string sound ="name/of/file/path/and/script.xml";] to load and play the sound, however "sound" is a local variable and it can only be declared once. cchausman had it close,
cchausman wrote:

Code: Select all

awake && knocked_out == _unconscious){
        string sound = "Data/Sounds/voice/animal/wolf_get_hit.xml";
        string sound = "Data/Sounds/hit/hit_medium_juicy.xml";
        PlaySoundGroup(sound, this_mo.position);
}
however since "sound" has already been declared as a string, "string" is not needed, so the code needs to be like this.

Code: Select all

awake && knocked_out == _unconscious){
        string sound = "Data/Sounds/voice/animal/wolf_get_hit.xml";
        sound = "Data/Sounds/hit/hit_medium_juicy.xml";
        PlaySoundGroup(sound, this_mo.position);
}
(programming talk off)
I'll see which ones work and which ones don't. if i run into any probloms I'll let you folks know.

User avatar
Anton
pretty cool guy
Posts: 3328
Joined: Fri Oct 17, 2008 8:16 pm
Location: Los Angeles
Contact:

Re: [Idea] Character Voice edit

Post by Anton » Wed Feb 05, 2014 9:33 pm

cchausman wrote:I believe .as is the extension for an action script file. I don't understand the rest of what you said though.
*Angelscript (just so people aren't confused about the scripting language being used…)

cchausman
Posts: 22
Joined: Thu Aug 01, 2013 10:19 pm

Re: [Idea] Character Voice edit

Post by cchausman » Wed Feb 05, 2014 10:17 pm

Sanocon wrote:ok so after a while, i figured out how to implement the sounds. (programming talk activated) so what's going on is the aschar script uses [string sound ="name/of/file/path/and/script.xml";] to load and play the sound, however "sound" is a local variable and it can only be declared once. cchausman had it close,
cchausman wrote:

Code: Select all

awake && knocked_out == _unconscious){
        string sound = "Data/Sounds/voice/animal/wolf_get_hit.xml";
        string sound = "Data/Sounds/hit/hit_medium_juicy.xml";
        PlaySoundGroup(sound, this_mo.position);
}
however since "sound" has already been declared as a string, "string" is not needed, so the code needs to be like this.

Code: Select all

awake && knocked_out == _unconscious){
        string sound = "Data/Sounds/voice/animal/wolf_get_hit.xml";
        sound = "Data/Sounds/hit/hit_medium_juicy.xml";
        PlaySoundGroup(sound, this_mo.position);
}
(programming talk off)
I'll see which ones work and which ones don't. if i run into any probloms I'll let you folks know.
Well hot damn, I was close! Do you know how to implement sounds into code that never initially had that "string sound" line to begin with?

Code: Select all

void TakeDamage(float how_much){
    if(this_mo.controlled){
        AchievementEventFloat("player_damage", how_much);
    }
    const float _permananent_damage_mult = 0.4f;
    how_much *= p_damage_multiplier;
    temp_health -= how_much;
    permanent_health -= how_much * _permananent_damage_mult;
    if(permanent_health <= 0.0f && knocked_out != _dead){
        level.SendMessage("character_died "+this_mo.getID());
        SetKnockedOut(_dead);
        this_mo.StopVoice();
    }
    if(temp_health <= 0.0f && knocked_out == _awake){
        level.SendMessage("character_knocked_out "+this_mo.getID());
        SetKnockedOut(_unconscious);
        --lives;
        if(lives > 0){
            RecoverHealth();
            recovery_time = 3.0f;
            roll_recovery_time = 3.0f;
        } else {
            if(this_mo.controlled){
                TimedSlowMotion(0.1f,0.7f, 0.05f);
            }
            if(!this_mo.controlled && tethered == _TETHERED_FREE){
                this_mo.PlaySoundGroupVoice("death",0.4f);
            }
            //SetRagdollType(_RGDL_INJURED);
        }
    }
}

Sanocon
Posts: 57
Joined: Sat Mar 24, 2012 3:10 pm

Re: [Idea] Character Voice edit

Post by Sanocon » Wed Feb 05, 2014 11:32 pm

cchausman wrote:Well hot damn, I was close! Do you know how to implement sounds into code that never initially had that "string sound" line to begin with?
when you type in the script for a a non existing sound script, did the game give an error saying that the "enemycontrol.as" failed to load or something?

User avatar
Thomason1005
Posts: 712
Joined: Sat Apr 20, 2013 7:44 am
Location: GerMany

Re: [Idea] Character Voice edit

Post by Thomason1005 » Wed Feb 05, 2014 11:35 pm

Angelscript is similar to on c++

and for the sound you should be able to just use
PlaySoundGroup("Data/Sounds/hit/hit_medium_juicy.xml", this_mo.position);
anywhere you want

cchausman
Posts: 22
Joined: Thu Aug 01, 2013 10:19 pm

Re: [Idea] Character Voice edit

Post by cchausman » Wed Feb 05, 2014 11:46 pm

Sanocon wrote:when you type in the script for a a non existing sound script, did the game give an error saying that the "enemycontrol.as" failed to load or something?
No, fixing those script sound lines to only list once where there were originally two let the game run fine. Unfortunately though voices still did not play, just the weapon impacts.
Thomason1005 wrote:Angelscript is similar to on c++

and for the sound you should be able to just use
PlaySoundGroup("Data/Sounds/hit/hit_medium_juicy.xml", this_mo.position);
anywhere you want
That would be great, if I knew how to read any of this code in the first place.

Sanocon
Posts: 57
Joined: Sat Mar 24, 2012 3:10 pm

Re: [Idea] Character Voice edit

Post by Sanocon » Thu Feb 06, 2014 12:24 am

ok, test time. I'm going to need help on this next part. I need help finding parts of code to add the voice sounds. I'm going to turn the topic from "Idea" to "mod" since we figured out the snipet of code to solf the problom.

use the code from Thomason1005 as a test. The "n" key uses the same sound, if it is louder than the sound from the "n" key, it is repeating the sound.

Sanocon
Posts: 57
Joined: Sat Mar 24, 2012 3:10 pm

Re: [Mod] Character Voice edit

Post by Sanocon » Fri Feb 07, 2014 9:46 pm

So, I'm finally starting to change up some code, since almost all of the button based keys can be knocked out quickly, I might as well start on the button I cant seem to find. The jump key. Now i think i found something which it calls the key "mouse0" I need to know if i'm close or not or if the spacebar has a different i.d. name.

User avatar
Thomason1005
Posts: 712
Joined: Sat Apr 20, 2013 7:44 am
Location: GerMany

Re: [Mod] Character Voice edit

Post by Thomason1005 » Sat Feb 08, 2014 1:49 pm

Sanocon wrote:So, I'm finally starting to change up some code, since almost all of the button based keys can be knocked out quickly, I might as well start on the button I cant seem to find. The jump key. Now i think i found something which it calls the key "mouse0" I need to know if i'm close or not or if the spacebar has a different i.d. name.
mouse0 doesnt sound right. It might not be spacebar as you wont find any keys in the script that can be changed in the options screen.

Sanocon
Posts: 57
Joined: Sat Mar 24, 2012 3:10 pm

Re: [Mod] Character Voice edit

Post by Sanocon » Sat Feb 08, 2014 1:54 pm

Thomason1005 wrote:
Sanocon wrote:So, I'm finally starting to change up some code, since almost all of the button based keys can be knocked out quickly, I might as well start on the button I cant seem to find. The jump key. Now i think i found something which it calls the key "mouse0" I need to know if i'm close or not or if the spacebar has a different i.d. name.
mouse0 doesnt sound right. It might not be spacebar as you wont find any keys in the script that can be changed in the options screen.
So what should I look for?

Edit: there is a script called playercontrol.as, which uses the aschar scrip. I also found a file called aircontrols.as which aschar uses. any leads on what file i edit and where?

User avatar
Thomason1005
Posts: 712
Joined: Sat Apr 20, 2013 7:44 am
Location: GerMany

Re: [Mod] Character Voice edit

Post by Thomason1005 » Sun Feb 09, 2014 2:55 am

so as far as i understand it, aschar.as simulates the character which is then controlled either by playercontrol.as (player) or enemycontrol.as (ai).

the button presses for character controlling that can be rebound in the settings are used in playercontrol.as like p.e. GetInputDown(this_mo.controller_id, "jump") for the jump.

i dont know if this is where you want to go for the sounds, as these are basically called from aschar.as

i honestly dont really know what you want to make with this mod. what sounds are missing on player and is this a problem of the turner character or any char that is controlled by a player?

User avatar
learn_more
Posts: 158
Joined: Tue Mar 15, 2011 4:32 am

Re: [Mod] Character Voice edit

Post by learn_more » Sun Feb 09, 2014 5:59 am

see viewtopic.php?p=212619#p212619 for a reference

Sanocon
Posts: 57
Joined: Sat Mar 24, 2012 3:10 pm

Re: [Mod] Character Voice edit

Post by Sanocon » Sun Feb 09, 2014 10:04 am

Thomason1005 wrote:so as far as i understand it, aschar.as simulates the character which is then controlled either by playercontrol.as (player) or enemycontrol.as (ai).

the button presses for character controlling that can be rebound in the settings are used in playercontrol.as like p.e. GetInputDown(this_mo.controller_id, "jump") for the jump.

i dont know if this is where you want to go for the sounds, as these are basically called from aschar.as

i honestly dont really know what you want to make with this mod. what sounds are missing on player and is this a problem of the turner character or any char that is controlled by a player?
this mod is just for pure aesthetics, plus i find it odd that only the A.I. can make vocal sounds. aka the knockout and throwing a punch/kick.

I may make a new script entirely for easy player edit/easy workarrounds for character actions.

Post Reply