Talking Creatures?

Revision as of 23:23, 9 July 2006 by imported>TheImperialDragon

Question

Is it possible to have talking creatures? You can add dialogue for them (there is even a dialogue button in their edit page) but in the game the enter dialogue cursor never appears when you face one of them? sykotik 15:06, 28 May 2006 (EDT)

No, creatures cannot talk... one possibility is scripting an invisible NPC, positioned such that the NPC's face is in the creature's body (so the conversation zooms in on the creature, and then scripting the creature to turn to the player when activated and the NPC to talk to the player at the same time.... could work, theoretically, though I am not (at all) sure of the possibility of having invisible NPC's, or of having them collide with the geometry of the creature, or of getting the NPC to talk to you (I don't see a ForceGreeting command anywhere...). --DragoonWraith 15:34, 28 May 2006 (EDT)
Getting NPCs to talk to you is no problem: Just Use StartConversation. Perhaps SayTo works with creatures?--JOG 16:12, 28 May 2006 (EDT)
It may depend on the kind of creature you are using. Dremoras and Vampires are not considered creatures, but as NPCs, so that could be an option to use one of them instead. Or, maybe you could try an OnActivate script for the creature to talk to the player (using StartConversation) when the player "Activates" the creature. Perhaps this will work? The only problem I can think of for this (If this would even work) is how to get the voice in sync with the creature's mouth. This whole thing probably won't work, but maybe it's worth a try?--TheImperialDragon 18:11, 28 May 2006 (EDT)
Well, chances are that no one's going to be able to read this creature's lips, so... depending on the creature, maybe there's a growl or roar animation that you could use? --DragoonWraith 19:19, 28 May 2006 (EDT)
Thanks for the feedback (even though I forgot to put this in the questions category!). I was planning to use goblins. I have yet to try your suggestions, I'll do it tomorrow. I think the OnActivate thing would be best (but does OnActivate work for creatures?). I think it would be too much bother to try to make a goblin meshed NPC (right?) ;). sykotik 20:19, 28 May 2006 (EDT)
Well, Goblins are bipedal, so it's theoretically possible, but it'd probably be a lot of work. Probably not worth it. OnActivate should work, the part I'm unsure of is the StartConversation or SayTo commands, I don't know if they'll work. If not, have the invisible NPC talk for the Goblin. --DragoonWraith 20:47, 28 May 2006 (EDT)

No success so far:

Begin GameMode
	If GetDetected Player == 1
		StartConversation Player GREETING ;This doesn't work for creatures.
		Message "I have Detected Player"
	Endif
	If GetPCFactionAttack 1SSGoblins == 1
			SetFactionReaction 1SSGoblins playerFaction -100 ;Nor this.
			Message "We are Attacked"
	Endif
End

Begin OnActivate ;This works.
	StartConversation Player GREETING ;Not this.
	Message "I am Activated"
End

Begin OnMurder Player ;This doesn't work either.
	SetFactionReaction 1SSGoblins playerFaction -100
	Message "I am Murdered"
End

Begin OnTriggerActor Player ;This doesn't.
	StartConversation Player GREETING
	Message "I am Triggered"
End 

Any other suggestions? (I don't know how to do the invisible thing... :( [Edit: Also SayTo seems to crash the game when used with creatures! sykotik 13:32, 29 May 2006 (EDT)

OK, how about when the goblin is activated, it is scripted to play the voice file. If the player can ask questions, maybe you could use a messagebox with choices after the goblin is finished speaking, or is that only for Morrowind? TheImperialDragon 19:39, 29 May 2006 (EDT)
Hmm... that could work. No subtitles, though, that could be bad. The MessageBox will work, though it will look pretty bad...
As for an invisible NPC, create an Ability with Invisibility on it... the real question is if the NPC can be stuck in the middle of the creature. --Dragoon Wraith TALK 20:34, 29 May 2006 (EDT)
Yeah, but how will the NPC move with the creature if it is moving (i.e. being attacked)? Maybe you can create a race of NPCs that look similar to goblins? That could do it for the goblin idea, but other creatures?
For DragoonWraith's idea, make it a Chameleon Ability, Invisibility wears off if the target performs an action such as attacking or opening a door. If this worked, then this would be much easier than my idea. TheImperialDragon 21:04, 29 May 2006 (EDT)
But Chameleon has the "Active Camouflage" shader, instead of actually being invisible. As far as movement, you'd put the NPC in place when the creature is activated, and the rest of the time you hide it somewhere, you don't attempt to keep it in the NPC. That might help limit the NPC's dislike of being in the creature. I've heard that SetPos removes collision from an object, is that true? --Dragoon Wraith TALK 21:52, 29 May 2006 (EDT)
I don't know, I'll experiment using the in-game console functions. Meanwhile, maybe somebody could find out how to get the cursor to change when the player is facing the goblin?TheImperialDragon 22:16, 29 May 2006 (EDT)
Hrm... That seems like a very minor issue, but I doubt it could be fixed.
On the subject of SetPos, that might be for Activators only. It wouldn't make sense if it did that with actors... would mess things up. --Dragoon Wraith TALK 22:20, 29 May 2006 (EDT)
I guess you're right, if that happened for actors, for one thing they'd probably fall through the floor or something if they lost the collision grid... How about a goblin race of NPCs? Is that possible? TheImperialDragon 22:46, 29 May 2006 (EDT)
Dragoon Wraith TALK 22:50, 29 May 2006 (EDT): I don't know enough about the details involved to say.
Maybe the orc face (with extreme slider adjustments) looks enough like the goblin that I could use a small orc for the goblins who need to speak. I would have to make the skin textures yellowish brown though. The face nifs have all those animation nodes like armour so I think making a new goblin facegen nif would be hard. Does anyone know how to make them? sykotik 12:08, 30 May 2006 (EDT)

Dragoon Wraith TALK 12:19, 30 May 2006 (EDT): First off, hauling this back to the left margin, eleven indents is just silly. Secondly, I don't think we can, yet. Actually, considering that FaceGen is involved, it's conceivable that we wouldn't be able to even with the official exporter.

I couldn't agree more with DragoonWraith, let's stick to three levels of indent, one for each of us, unless someone other than us thinks of an idea of course, or we'll end up with ultra-thin paragraphs. Anyway, I already tried to make an Orc-Goblin race, but what I came up with didn't look all too good. I don't know how to make Orc ears larger than they are, or how to get the orc to lean forward all the time like a Goblin. I will try to work a little more with the invisible NPC and OnActivate methods, and we'll see how this works... TheImperialDragon 16:15, 30 May 2006 (EDT)
OK, I finally got this to do something, but there are several problems. Where to start? Here's my script:

scn TalkingCreature

short Order
talker is my NPC, this script is attached to a goblin
Begin OnActivate
StartConversation Player GREETING ;We already know this doesn't work
Message "I am at 2048, 2048"
Talker.MoveToMarker TalkerTalksHere ;X marker, but NPC ends up outside goblin.
Set Order to 1
if Order == 1
Talker.StartConversation player GREETING ;This works
Set Order to 0
Endif
End
Also, when a dialogue begins, all animations other than the speaking actor freeze. To get the goblin always looking at the player, I was considering using the look command when the player comes within 512 units. I increased the 3D Scale size of the goblin so that his head is somewhat at the same level as the player. Unfortunately, because my NPC ends up outside the goblin (whose centre is at the middle of the X marker) it's hard to get the camera to zoom in on the goblin's face. Maybe, if the goblin doesn't already have a GREETING topic, you should make one then try and see if it works? I haven't really had a good look at the Dialogue Functions yet, so I wouldn't know what to do, I only have a vague idea of how it works. TheImperialDragon 23:00, 30 May 2006 (EDT)
Dragoon Wraith TALK 00:06, 31 May 2006 (EDT): Hrm... Maybe you could use SetScale on the Orc to make him the right height? Might it be possible to put the Orc behind the Goblin, so the player looks at the Goblin? Also, rather than using Look when the player is close, instead use it OnActivate, before placing the Orc and having him talk to the player.
Just a thought, doesn't invisibility wear off when the actor starts a conversation? TheImperialDragon 16:16, 31 May 2006 (EDT)
It does, even if it's an ability. Chameleon would work though.. --MaXiMiUS 19:37, 31 May 2006 (EDT)
No, the "Active Camouflage" shader would still show... TheImperialDragon 22:15, 31 May 2006 (EDT)


Alright, I've got an idea, we can try to create a new spell effect, similar to Chameleon, but without the "Chameleon effect" shader. Unfortunately, I've very little experience with the spell system of Oblivion, so if anybody else knows how, I think it might, and I emphasize might, be a step in the right direction.
And before I forget, as this kind of just popped into my mind, does the goblin have a GREETING topic, because if not, that could be the problem. I just checked, and it seems that creatures do appear on the list in the Dialogue Window, but they don't have any dialogue, not even a GREETING. I'll experiment with it when I have some spare time... TheImperialDragon 22:29, 4 June 2006 (EDT)
Dragoon Wraith TALK 11:34, 5 June 2006 (EDT): You can't make new spell effects at all...
Maybe use SetActorAlpha? I just saw that command, it could work.
Thank you, that works perfectly. I fixed the collision grid problem between the two NPCs (well... somewhat) and I've managed to get dialogue window to zoom in on the goblin's face, but the goblin isn't necessarily looking at the player, so I need a function that makes one actor face another. I doubt the Look function will work 100%, but I'll try it. Are there any other functions that make actors face one another? TheImperialDragon 16:56, 5 June 2006 (EDT)
Dragoon Wraith TALK 17:50, 5 June 2006 (EDT): I would think Look would work, since Goblins do tend to look at things near them, just like NPCs do.
Well, my script didn't work first time around, but maybe because I had a SayTo command in there. Here's my script (a work in progress) after taking SayTo out:
scn TalkingCreature


short Order


Begin Gamemode ;This is where I set up the Look and MoveToMarker functions, creating the effect of both characters being in the same place at the same time...
If GetInSameCell player == 0
Return ; Game runs faster I think...
elseif GetInSameCell player == 1
Talker.MoveToMarker TalkerTalksHere ;constantly moves NPC to marker
Talker.SetActorAlpha 0.0
GoblinPassive.MoveToMarker Talkertalkshere ;constantly moves goblin to marker
if GetDistance Player <= 256 ;Now the Look section
set Order to 1
Look player
endif
if Order == 1
if GetDistance player > 256
Stoplook
endif
endif
endif
End
Begin OnActivate
Talker.StartConversation player GREETING
End
Dragoon Wraith TALK 18:53, 5 June 2006 (EDT): MoveToMarker? I don't think that exists, you want MoveTo. Also, I would suggest doing the "look" this way:
scn TalkingCreature

short doOnce

Begin GameMode

  Talker.SetActorAlpha 0.0

  if ( doOnce == 1 )
    Talker.StartConversation player GREETING
  elseif ( doOnce == 2 )
  ;set to 2 by GREETING, so after the greeting has played and we're back in GameMode
    StopLook
  endif

End

Begin OnActivate

  Look player
  Talker.MoveTo GoblinPassive
  set doOnce to 1

End
That way the Goblin only looks at the player when the player activates the Goblin, and the talker is only moved once, during when the Goblin is activated, so you don't need to make the game do that every frame. The Goblin stops looking when the conversation is over.
The look stuff might be better with distance checking, however, if you want the Goblin to turn to the player when the player gets near, and keep looking til the player leaves.
Thanks for the quick reply. My script is only a prototype so that I can see if it'll work. I was going to worry about the clean-up later, and besides, it's only about the third script I've written, in which none of the others I have any idea whether they are working or not...
The reason I have the game move Talker onto the goblin space every frame is so that the talker stays inside the goblin. If I don't do this, Talker ends up outside the goblin. But what will happen is that when the Goblin is attacked or whatever, the NPC, will be transported either to another cell, or into an isolated room.
MoveToMarker does exist. It is even used in FGD08Script, you can check for yourself if you have doubts.
Anyway, I'll give both scripts a try...


Erm... Neither quite worked...
Both had similar results, it's just that the goblin didn't look at anybody. In your script, the NPC ended up outside the goblin again, and the game zoomed in on thin air, by which I mean the invisible NPC, which is what I was trying to describe above. First, we'll need to find an alternative to Look, and a way to have the goblin move with the NPC.
Dragoon Wraith TALK 20:09, 5 June 2006 (EDT): OK, questions about MoveTo and MoveToMarker, and their use for this purpose: Why do you need to use MoveToMarker in your script? Wouldn't Talker.MoveTo GoblinPassive serve the same cause? On the flip side, if not, would use MoveToMarker improve my script?
I don't know the difference between them, except that MoveToMarker is probably meant for X Markers (implied by the name of the function) and that MoveTo seems to indicate any general object. I'll try and research the difference if there is any. Yes, MoveTo would probably do for all intents and purposes of this script.
On the other hand, now that I think about it, MoveToMarker may be vector oriented, and MoveTo might not be. I'll have a look at the different instances in the game and see what the difference is. TheImperialDragon 20:28, 5 June 2006 (EDT)


Well, I couldn't find any immediate difference between the two, however, they do both work.


As for the Talking Creatures. I can think of only one way to get this so far. Have the goblin accessible from only one direction, if he's attacked, set his fight to 90 or whatever, put a Return command at the top of the script, and disable the NPC. There could be a reset after maybe 3 days, and that's basically it. TheImperialDragon 22:42, 7 June 2006 (EDT)

Omzy To put the npc inside the goblin why not do it all OnActivate? Just use the (PlaceAtMe actorName) function since the calling actor is the goblin itself. Use GetPos x, y, and z. Then use the actorName.MoveTo x-5, y, z (5 units behind goblin) for fine tuning. If all of this is done OnActivate it would not only save the memory of having the npc and goblin traveling together during every frame but also keep the goblin from being stuck at an xmarker. Just Kill, Disable, and DeleteFullActorCopy (as MaXiMiUS pointed out) after the event is finished. To get the goblin to face the PC get the PC's degree rotation values and set the goblin up 180 degrees the opposite of the player heading right before the conversation with the npc is initiated. This should make them face one another.

For most of what you're saying, we already tried.
To go into more depth, the PlaceAtMe is a good idea, but unless the game is told to do this every frame, the NPC ends up WAY outside the goblin, due to collision issues. Furthermore, the script is already OnActivate, or at least the dialogue part. The PlaceAtMe every frame should be able to do the trick to have the goblin travel.
Good thinking on the rotate angle thing though, I'll give it a try. With this bit of information, I think we may come to the conclusion of this nightmare of a long answer yet.
Instead of StartConversation, I'll use SayTo, as StartConversation has the NPC approach the player before actually initiating dialogue. The Imperial Dragon 15:23, 8 June 2006 (EDT)


Just tested, first two tries didn't work too well. I'll try again, but change a few things, just to see if this'll work. The Imperial Dragon 15:57, 8 June 2006 (EDT)


Here's my script. It works for the most part, but the Angle Set thing isn't working. Somehow, I think it's something really obvious... I put a ; in front of those parts.

scn TalkingCreature

short Hurt
short Order
float PCAngle

Begin OnMurder
	set Hurt to 1
End

Begin Gamemode
	If Hurt == 1
		Return
	endif
	If GetInSameCell player == 0
		Return
	elseif GetInSameCell player == 1
		Talker.SetActorAlpha 0.0
;		set PCAngle to ( GetAngle Z player )
;		If PCAngle >= 180
;			Set PCAngle to ( PCAngle - 180 )
;		elseif PCAngle < 180
;			Set PCAngle to ( PCAngle + 180 )
;		endif
		if Order == 1
			GoblinPassive.MoveToMarker Talkertalkshere
			Talker.MoveToMarker Talkertalkshere
;			GoblinPassive.SetAngle Z, PCAngle
		endif
		If Order == 2
			Talkertalkshere.MoveToMarker Notalking
			set Order to 0
		endif
	endif
End

Begin OnHit
	set Hurt to 1
End

Begin OnActivate
;	GoblinPassive.SetAngle Z, PCAngle
	Talkertalkshere.MoveTo GoblinPassive
	set Order to 1
	If Order == 1
;		set Order to 2 - *do this in dialogue instead*
		GoblinPassive.MoveToMarker Talkertalkshere
		Talker.MoveToMarker Talkertalkshere
		Talker.StartConversation player GREETING
	endif
End

I don't know, perhaps it is something wrong I did with the variable? If it is, can someone fix it? The Imperial Dragon 17:09, 8 June 2006 (EDT)

Omzy Since this script is attached to the creature, GetAngle Z Player will return the angle of the creature. Player.GetAngle Z returns the heading of the player. Hopefully that will fix it. If not...back to the drawin' board!

Thanks, I'll give this a try. The Imperial Dragon 21:56, 8 June 2006 (EDT)


ShadowDancer 22:34, 9 July 2006 (EDT): Did this ever get solved? If not I'll take a swing at it.
Sure, absolutely, feel free to make suggestions and ideas. The Imperial Dragon 22:46, 9 July 2006 (EDT)
ShadowDancer 23:02, 9 July 2006 (EDT): K, I will take a crack at it over the next couple of days. I am getting pretty good at the whole manipulating the Player thing as far as the direction he is facing, including his viewing angle so hopefully that will be pretty simple for me. I will give it a quick try when I get home tonight and see what I can come up with.
Great! I can also give you a link to my work so far if you are interested. The Imperial Dragon 23:23, 9 July 2006 (EDT)