News:

Happy 20th, FFvT3R!

Main Menu

hero 1 speech

Started by bearded, August 20, 2009, 09:14:53 PM

Previous topic - Next topic

bearded

what would be the python to make hero 1 speak it's first rage line?  using ffx if that helps.  and for  :ff: .

wickerman

opent he lang folder (in data folder) and find the caption that corresponds to the voice pack hero 1 uses.

Let's say Shadow.

Then have them speak the rage line like so (again this example uses shadow's VP)


speak('hero1', 'SPEECH_SH_RAGE_01')
The Wickerman - creator of the Metal Storm Mod -
[img]http://webzoom.freewebs.com/wickermanim/cw.jpg[/img]

bearded

thank you.  but is there a way to make a hero_1 speak it's own rage 1?
would it use a head nif?
maybe something to do with ffx's traits...

stumpy

I don't think the reaction speech is spoken using a head.nif. I could be wrong, but I thought that only happened for mission captions. Of course, you could use the sound file for the reaction and create captions by adding the FFEdit entries, the captions.txt text, etc.

I assume the issue you have with wickerman's suggestion is that it requires that you know which character hero_1 is and you want to be able to do it for any character, without knowing ahead of time the character's template.

The most straightforward way might be to actually enrage the character - even if only for a split second - using the Object_SetPrimaryState() function (and use it again to cancel, if needed). I believe that will trigger the speech. Of course, you may have a reason not to do that...

You can also go about this without actually enraging the character by using the datfiles and chardata modules. The difficulty there is that they do not come installed with FFX for the first game, so you have to do that yourself, though instructions come with the datfiles archive.

With datfiles/chardata installed, you can find the voice ID for a given character and then use the approach wickerman outlined. E.g. include the following code in your mission.py file
from chardata import *

def SpeakRage(hero):
    VoiceID = GetCharacterData(hero).get('VID')
    if not VoiceID:
        print 'SpeakRage: No voice ID available for %s.' % hero
        return
    RageTag = 'SPEECH_' + VoiceID + '_RAGE_01'
    speak(hero, RageTag)


Then just call SpeakRage('hero_1') when you want the speech, or "ff.SpeakRage('hero_1')", from within a cut-scene.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

bearded

perfecto.  can i assume that would work with other types?  would i be able to replace speakrage with speakalert for example?

stumpy

Yup. You should be able to tinker with the penultimate line to get the reaction speech you want. In fact, a somewhat more flexible version would be
from chardata import *

def SpeakReaction(hero, reaction='RAGE', variation='01'):
    VoiceID = GetCharacterData(hero).get('VID')
    if not VoiceID:
        print 'SpeakRage: No voice ID available for %s.' % hero
        return
    ReactionTag = 'SPEECH_' + VoiceID + '_' + reaction + '_' + variation
    speak(hero, ReactionTag)


That way, you can call SpeakReaction() with the hero's name and one of two options for which reaction you want and even which variation on the reaction. E.g. SpeakReaction('hero_1', reaction='ALERT') or SpeakReaction('hero_1', reaction='ALERT', variation='02'), assuming that the variations are available. The default reaction is 'RAGE' and default variation is '01'.

BTW, testing this just now, it looks like the head.nif will be used for the character, if it's available.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

bearded

#6
that is simply amazing.  you just made my mod so much better.
in the datfiles.py it says to
Quote# For documentation, search the Scripting forum on Freedom Reborn for
#     +Documentation +datfiles +chardata
# and subject "datfiles and chardata: documentation...".
but i can't find it.  is it here?  do i need it or is everything i need in the datfiles.py itself?
i'm going to do my extensive work with it in the morning.
just incredible.
also, in my missions/scripts folder i have a datfiles.py with this:
Quote# DAT files Reader
# By Stumpy
# v.2, posted Thu Jan 27, 2005
# in Freedom Reborn Forum Index: Scripting Forum: Getting all markers (objects, positionals, et cetera)
which i'm sure i don't want to replace.  do i need to save the datfiles.py from your link above in my missions/scripts folder?
the dafiles.py already in my scripts has this link:
http://freedomreborn.net/phpbb/viewtopic.php?t=26722
which no longer works.

stumpy

The link in the older version of datfiles is from the older FR boards. The new boards have a lower limit on how long the posts can be, so I started including the documentation in the archive. [EDIT] Oops! It looks like the link I posted above was to a trimmed down archive that didn't have the docs. The updated file with the documentation is datfiles0257.7z. That archive should have a file called Character Data Module Installation And Use Notes.rtf with the rough install instructions.

I am pretty sure you can replace older python files with the ones in the newer archive, but it doesn't hurt to back them up.

However, if you already have the files in the archive (there are four python files) in your data/missions/scripts folder for the first game, then you may already be set up. Most people didn't install datfiles for the first game because I released it in late '04 and in '05 the first version of FFX for FFvT3R had it integrated. If you have a shortcut to the FFX Control Centre that points to a file called ControlCentreWrapper.bat, then you should already be set up. Otherwise follow the steps in the install notes.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

bearded

#8
i've got to say.  voodoo.  importing chardat magically fixed a lot, and i mean a lot, of errors i've been having for years.
all fixed!  i discovered for this to work the character has to have an animportrait in ffedit.
superb!
and...what do you think is wrong with this line?
SpeakReaction('hero_1', reaction='SELECT', variation='0' + str(randint(1, 8)))
out of about 15 restarts, it worked once, like the third time for select_07.

stumpy

I'm glad chardata helped, though I am not sure why it would fix unrelated problems. It may be that importing it coincidentally imports another module that you needed.

Quote from: bearded on August 22, 2009, 06:22:52 PM
and...what do you think is wrong with this line?
SpeakReaction('hero_1', reaction='SELECT', variation='0' + str(randint(1, 8)))
out of about 15 restarts, it worked once, like the third time for select_07.

Hmm. Nothing obviously wrong is jumping out at me, just looking at the code. What error was in script.log when it didn't work?

Sometimes, when an error crops up inconsistently from a simple function call, the problem is somewhere else, but it looks like the call is the problem because it's the only thing we are expecting any output from...
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

bearded

#10
no error, just the 'speakInternal' line.  it worked the once and that was it.
this is pretty nifty tho.  do you think it would work for hero file characters, if the hero file had an animportrait in resources?  i'm going to try it.
with some proper tweaking, there could be almost dynamic dialogue!

stumpy

It should work for any character with a voice ID whose been branded by the FFX Control Centre. So, yes for customs, assuming they have a voice assigned to them (e.g. as long as it's not blank when you look at the character from the squad screen).

On the random variation, make sure the range is appropriate. If the number generated is higher than the number of reactions of that type for that voice pack, nothing will happen. Most characters, for instance, won't have 8 different select reactions.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg

bearded

it's working now.  i think it was trying to speak before the character had actually spawned.  but if i make sure the guy is in, it works.
as for my other errors, one major one i could never figure out, none of the character voices would work unless i had lost a mission and restarted.  now i don't have to do that!
as for my other errors, i get a series of these based on about 15 templates.
Campaign_ReadObjects() warning: object template <ffx_flames> has more than one entry for attribute <minForce>, values -1.000000 and 1000000.000000

stumpy

That's a check on dodgy FFEdit data I built in to the datfiles reading capability. If you check with FFEdit, I think you'll find those objects have more than one entry for a given template attribute. It's not important for all attributes (though it's worth removing duplicates just so you can be sure which one the game is using), but it can definitely cause trouble with attributes like complex, material, mass, etc.
Courage is knowing it might hurt, and doing it anyway. Stupidity is the same. And that's why life is hard. - Jeremy Goldberg