Difference between revisions of "Talking Creatures?"

2,770 bytes added ,  07:31, 10 July 2006
"I say taco, then they say taco." "Taco,Taco,Taco..."
imported>Yarharhar
imported>ShadowDancer
("I say taco, then they say taco." "Taco,Taco,Taco...")
Line 324: Line 324:
*Also, make sure the only clothing that npc has on it is the 'creature' clothing you've made for it.   
*Also, make sure the only clothing that npc has on it is the 'creature' clothing you've made for it.   
*You now have a talking creature
*You now have a talking creature
:[[User:ShadowDancer|ShadowDancer]] 07:31, 10 July 2006 (EDT): And if you don't want to play with the nifskope (which I would say is actually probably the better route to go as far as mechanics in the game go since even the script I polished up (thanks for giving me the staring point [[User:TheImperialDragon|The Imperial Dragon]]) is still a bit rough with regards to zooming in on the goblin's face and anytime he picks an idle where he is waving his arms around wildly.  I am sure you could do an interrupt package on him to do away with the flailing, but it zooms into his face and I haven't figured out a way to fix that.  Anyways, here is the script sans nifskope:
<pre>
ScriptName TalkingCreature
Short DoOnce
Short Hurt
Short Order
Float PCAngleRef
Float GoblinAngleRef
Float Timer
Ref GuyRef
Begin OnMurder
Set Hurt to 1
End
Begin GameMode
  If Hurt == 1
      Return
  End If
  If GoblinPassive.GetDistance Player > 300 && DoOnce == 1
      Set Order to 0
      Set DoOnce to 0
      If GuyRef.Destroyed == 0
        GuyRef.Disable
        GuyRef.Kill
      EndIf
  EndIf
  If GoblinPassive.Get Distance Player <= 300 && DoOnce == 0
      Set Order to 1
  EndIf
  If Order == 1 && DoOnce == 0
      Set DoOnce to 1
      GoblinPassive.MoveToMarker TalkerTalksHere
  EndIf
  If Order == 1 && DoOnce == 1
      Set GoblinAngleRef to GoblinPassive.GetHeadingAngle Player
      Set GoblinAngleRef to GoblinAngleRef / 2
      Set PCAngleRef to Player.GetHeadingAngle GoblinPassive
      Set PCAngleRef to PCAngleRef / 2
      Set Timer to 0
      Set Order to 2
  EndIf
  If Order == 2 && Timer < 2
      GoblinPassive.Rotate Z, GoblinAngleRef
      Player.Rotate Z, PCAngleRef
      Set Timer to Timer + GetSecondsPassed
  EndIf
  If Order == 2 && Timer >= 2
      GoblinPassive.Rotate Z, 0
      Player.Rotate Z, 0
      Set Order to 3
  EndIf
  If Order == 3 && GoblinPassive.Get Distance Player < 110
      Set Order to 4
      Set GuyRef to GoblinPassive.PlaceAtMe TalkingGuy, 1, 60, 1
      GuyRef.SetActorAlpha 0.0
      GuyRef.StartConversation Player GREETING
  EndIf
End
Begin OnHit
  Set Hurt to 1
End
Begin OnActivate
  If Order == 4 && GuyRef.GetDestroyed == 0
      GuyRef.Disable
      GuyRef.Kill
  EndIf
  Set Order to 1
End
</pre>
:However this does nicely at getting him to talk.  At very least, it was an interesting exercise in scripting.  BTW [[User:TheImperialDragon|The Imperial Dragon]], I re-did your cell a little bit in order to test it out properly.  I added 3 512x512 floortiles to the outside of the towers, switched the markers to the opposite places, added a mages portal, and removed the tower door for testing purposes.  Just wanted to let you know how I set up the cell for this script.
Anonymous user