Author Topic: How do I get the door to talk when the PC tries to open it + Make a monster spawn during converstation.  (Read 354 times)

Legacy_simomate

  • Full Member
  • ***
  • Posts: 162
  • Karma: +0/-0


               
               
               

               
            

Legacy_Builder_Anthony

  • Hero Member
  • *****
  • Posts: 786
  • Karma: +0/-0


               on click.make the script with lilicas script generator if you want.
               
               

               
            

Legacy_simomate

  • Full Member
  • ***
  • Posts: 162
  • Karma: +0/-0


               wtf, all I had writtern disappeared? Can I get an exact script?

The other part of my question was I wanted to make goblins spawn during my converstation with children who would then say something and run back into the forest. Then kids would run after them. Stupid forum messing up my thread >'<img'>
               
               

               
            

Legacy_Builder_Anthony

  • Hero Member
  • *****
  • Posts: 786
  • Karma: +0/-0


               Actually lock the door and put the script in on fail open.The script is easily made with lilacs script genertor all you do is add it to the line you want in your conversation.All that can be done easy in the lilacs script generator.
               
               

               


                     Modifié par Builder_Anthony, 30 mars 2011 - 10:06 .
                     
                  


            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0


               

How do I get the door to talk when the PC tries to open it




// To have the door say something when the PC tries to open it do this.
void main()
{
 
object oPC= GetLastOpenedBy();

  // StopThePCfrom doing anything.
  AssignCommand(oPC,ClearAllActions());

  //Make sure the dore is not trying to do anything.
  ClearAllActions();

  //Make sure the door does not open by having it close itself.
  ActionCloseDoor(OBJECT_SELF);

  // Now if you want the door to just say a single line you would use.
  SpeakString(" Hello, Hello,  I am a talking door.");

  // If you want the door to start a conversation use.
  BeginConversation("ResRef of Convo file", oPC);

}
[\\code]
 


[quote]+ Make a monster spawn during a conversation. [/quote]

You would place a Waypoint where you wanted them to spawn at and  place a script in the Action Taken for the conversation node where you wanted it to happen.

[code]void main()
{
    //Find the Waypoint.
    object oWaypoint = GetWaypointByTag("The Tag You gave the waypoint");

    // get the location of the waypoint.
    location lSpawnPoint = GetLocation(oWaypoint);

    // Create the goblin at the waypoint.
     object oGoblin =  CreateObject(OBJECT_TYPE_CREATURE,"nw_goblina",lSpawnPoint);
}   [/code]
 

 


[quote]The other part of my question was I wanted to make goblins spawn during my converstation with children who would then say something and run back into the forest. Then kids would run after them. Stupid forum messing up my thread &gt;:(  [/quote]

Ok now we are getting a little more complex.  It can all be done with the conversation action taken script.  But a simpler (but more anvanced) methoid would be to set the children to lissen for the command to follow.  First let me expand upon the script above.   For this to work you are going to need  three Waypoints painted in the toolset. 

List Of Waypoints Need to be painted in the Toolset.
[list=1]
 
[*]Tag = "GoblinSpawn"    This is the tag of the waypoint the goblins will spawn at. 
 
[*]Tag = "GoblinSpeakAt"  This waypoint the Goblins will move to Then say there line to make the children follow.
 
[*]Tag = "GoblinForest"      This is the waypoint the Goblins will run to after they say there line.
[/list]

[code]
// This is for the listening pattern.
const string  LURE_KIDS = "LURE_KIDS";
void main()
{

    //Find the Waypoint.
    object oWaypoint = GetWaypointByTag("GoblinSpawn" );
    
   
   // get the location of the waypoint.
    location lWayPoint = GetLocation(oWaypoint);

    // Create the goblin at the waypoint.
     object oGoblin =  CreateObject(OBJECT_TYPE_CREATURE,"nw_goblina",lWayPoint);

    //Create 1 - 3 more goblins and make them follow the first one.
    // first get a number between 1 and 3
    int nRnd = Random(3)+1;

    // second declair a var as a temp holder for the goblins as they are made.
    object oGoblin2;
 

    // Now make a loop that will make our nRand extra goblins and make
    // them follow the first.
    while( nRnd &gt; 0)
    {
      // create a goblin.
      oGoblin2 =  CreateObject(OBJECT_TYPE_CREATURE,"nw_goblina",lWayPoint,FALSE,"G_Follower");

      // Make sure they are friendly.
      ChangeToStandardFaction(oGoblin2,STANDARD_FACTION_COMMONER);

      //Get a Following distance. 0 - 8 meters.
      float nDist = Random(80)/10.0;

      //Make this goblin follow oGoblin at 0 to 10 meters.
      AssignCommand(oGoblin2,ActionForceFollowObject(oGoblin,nDist));

      // take away there option to do anything else.
      SetCommandable(FALSE,oGoblin2);

      //decrease the nRnd for the next check on this loop.
      nRnd = nRnd -1;
    }

    // Now make our leader goblin go the the next waypoint.
    // First get the waypoint.
    oWaypoint = GetWaypointByTag("GoblinSpeakAt"  );

    // Get its location.
    lWayPoint = GetLocation(oWaypoint);

    // Have the goblin move(walking) to that location, the others will follow.
    AssignCommand(oGoblin, ActionMoveToLocation(lWayPoint));

    // After he get there have him say his line.
    AssignCommand(oGoblin,ActionSpeakString("I see the old tree. The ginger bread house was that way!!!!!"));

    // Next silently speak the command that will have the kids that hear follow.
    AssignCommand(oGoblin,ActionSpeakString("LURE_KIDS", TALKVOLUME_SILENT_TALK));

   // get thelast waypoint and location.
   oWaypoint = GetWaypointByTag("GoblinForest");
   lWayPoint = GetLocation(oWaypoint);

   // Have the goblin run to the last waypoint.
   AssignCommand(oGoblin, ActionMoveToLocation(lWayPoint,TRUE));

   // After doing everything we have placed in the goblins action que
   // let him be commandable again.
   AssignCommand(oGoblin,ActionDoCommand(SetCommandable(TRUE)));

   //Stop the Goblin from doing anything else untill he finishes his last action.
   SetCommandable(FALSE,oGoblin);

}

Sorry,  Bed time here.  I will try and get back to the kids part of following tomorow night.
L8

EDIT: Man, The forums can really @%#*$@ you over sometimes when posting.
               
               

               


                     Modifié par Lightfoot8, 01 avril 2011 - 03:45 .
                     
                  


            

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0


               You could use the "Home Town (classic Diablo)" module as a pattern
http://sites.google....gnortheast/home
Download the single-player module from there and then look on level 4 of the Crypt, at the door in the top, left corner.
It activates "Garbad the Weak" and it does everything you asked for plus more.

The door conversation is actually held with an invisible object named Garbad the Weak.  This object is in the same position as the door.
               
               

               


                     Modifié par Melkior_King, 02 avril 2011 - 08:19 .