Author Topic: Creating messengers  (Read 3094 times)

Offline Katalyn

  • Planewalker
  • *****
  • Posts: 11
Creating messengers
« on: May 22, 2004, 01:13:44 AM »
I want to be able to spawn a messenger after a specific period of time, much like Terl gets spawned for Anomen's quest.  I've gone over different NPC mods, and I can't figure it out.  How do I create him after a timer has expired, and how do I set the timer?

Offline Bons

  • Global Moderator
  • Planewalker
  • *****
  • Posts: 1237
  • Gender: Female
  • Glad Corvis Isn't Dead Club
Re: Creating messengers
« Reply #1 on: May 22, 2004, 12:07:05 PM »
Say you want to commence your spawning timer when an NPC joins the party, it's a three step process.

1) Set your timer variable. In Anomen's case, this is bundled with replies when the PC agrees to Ano joining the party:
IF ~~ THEN BEGIN 6 // from: 15.0 14.0 11.0 5.0 2.0
  SAY #6135 /* ~Perchance I have found worthy companions. I seek to be knighted in the Most Noble Order of the Radiant Heart and I must prove my worth, first. Have you need of a strong sword, my <LADYLORD>?~ */
  IF ~Gender(Player1,FEMALE)
~ THEN REPLY #6147 /* ~I would be infinitely pleased to have you join me. Welcome!~ */ DO ~RealSetGlobalTimer("AnomenRomance","GLOBAL",2000)
SetGlobal("LoveTalk","LOCALS",1)
SetGlobal("AnomenRomanceActive","GLOBAL",1)
SetGlobalTimer("AnomenJoined","GLOBAL",FIVE_DAYS)
~ GOTO 21
  IF ~~ THEN REPLY #6148 /* ~Regretfully, I must decline your offer. ~ */ GOTO 4
  IF ~Gender(Player1,MALE)
~ THEN REPLY #55350 /* ~I would be infinitely pleased to have you join me. Welcome!~ */
DO ~SetGlobalTimer("AnomenJoined","GLOBAL",FIVE_DAYS)~//This is the key line for the Terl-spawning timer. 
GOTO 21
END


I know this is covered elsewhere, but you can use either SetGlobalTimer(S:Name*,S:Area*,I:Time*GTimes), which measures game time, or RealSetGlobalTimer(S:Name*,S:Area*,I:Time*GTimes), which measures literal seconds on the clock. For example, when you rest the party you can pass 8 hours of game time, but you probably only use 15 seconds of real time. Set your timer length accordingly.

2) Add the spawning to your NPC's script, or if you only want it to occur in a specific area, the area script.The following is from ANOMEN.BCS. I'm highlighting the key parts in green again:

IF
   InParty(Myself)  // If this was in an area script, this would be InParty("Anomen")
   GlobalTimerExpired("AnomenJoined","GLOBAL") // Checks if your timer is up

   Global("SaerkPlot","GLOBAL",0)
   !Global("Chapter","GLOBAL",4)
   !Global("Chapter","GLOBAL",5)
   !Global("Chapter","GLOBAL",7)
   !AreaCheck("AR1900")
   !AreaCheck("AR1100")
   !AreaCheck("AR1300")
   !AreaCheck("AR1400")
   !AreaCheck("AR1404")
   !AreaCheck("AR2500")
   !AreaCheck("AR2600")
   AreaType(OUTDOOR)
   !Exists("Terl")// Have you spawned him already?
   OR(2)
      Global("AnomenRomanceActive","GLOBAL",0)
      Global("AnomenRomanceActive","GLOBAL",3)
THEN
   RESPONSE #100
      CreateCreatureObjectOffScreen("TERL",Myself,0,0,0) // Terl spawns
END



3) Script your spawn approaching and starting dialogue with your NPC. From TERL.BCS, and in this case, I'm adding a variable for whether the dialogue has occurred. The first block accounts for your .cre being spawned off-screen and moves it within range to start talking to your NPC. The second block is what triggers the dialogue.:

IF
   Global("TalkToMeSpawnBaby", "GLOBAL", 0)

   Global("SaerkPlot","GLOBAL",0)
   !Dead("cor") // Cor Delryn
   !See("Anomen")
   InParty("Anomen")
THEN
   RESPONSE #100
      MoveToObject("Anomen") 
END


IF
   Global("TalkToMeSpawnBaby", "GLOBAL", 0)

   Global("SaerkPlot","GLOBAL",0)
   !Dead("cor") // Cor Delryn
   See("Anomen")
   InParty("Anomen")
THEN
   RESPONSE #100
      SetGlobal("TalkToMeSpawnBaby", "GLOBAL", 1)
      Dialogue("Anomen")
END


Those three things should cover it, and if not, I'm sure someone will be along presently to correct me. :)
Newt had always suspected that people who regularly used the word "community" were using it in a very specific sense that excluded him and everyone he knew.

             --Neil Gaiman, Terry Pratchett, "Good Omens"

Offline Katalyn

  • Planewalker
  • *****
  • Posts: 11
Re: Creating messengers
« Reply #2 on: May 22, 2004, 10:50:31 PM »
It worked!  Huzzah!  Thank you!

Domi

  • Guest
Re: Creating messengers
« Reply #3 on: May 24, 2004, 01:10:36 PM »
I am trying to do NPC goes away and returns script.

Going away part:

!Global("CoranRomancePath","GLOBAL",7)
Global("CoranMoves","GLOBAL",1)
THEN
RESPONSE #100
SetGlobal("CoranRomancePath","GLOBAL",7)
RealSetGlobalTimer("CoranReturn","GLOBAL",20)
TakePartyItem("X#CBABY")
TakePartyItem("X#CBOOK")
TakePartyItem("X#CMILK")
DestroyItem("X#CBABY")
DestroyItem("X#CBOOK")
DestroyItem("X#CMILK")
EscapeAreaMove("FW0103",368,402,2)
END

Works well, Coran goes where he is told to go, but the "move to player part" does not execute.

IF
Global("CoranMoves","GLOBAL",1)
RealGlobalTimerExpired("CoranReturn","GLOBAL")
Global("CoranBack", "GLOBAL",0)
!See(Player1)
THEN
RESPONSE #100
SetGlobal("CoranMoves","GLOBAL",2)
MoveToObject(Player1)
END

IF
Global("CoranMoves","GLOBAL",2)
Global("CoranBack", "GLOBAL",0)
See(Player1)
THEN
RESPONSE #100
SetGlobal("CoranMoves","GLOBAL",3)
SetGlobal("CoranBack", "GLOBAL",1)
Dialogue(Player1)
END

Can someone give me a tip on what's breaking up the MoveToObject?


Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Creating messengers
« Reply #4 on: May 24, 2004, 08:57:20 PM »
I think MoveToObject() is just a walking thing.  What you want is MoveGlobal().  Coran, having been in the party already, has been added to the saved game file and is thus considered a "Global" object, and can be called from anywhere in the game.  We use that to bring Kelsey back to the party after he's gone off searching for whatshisface and whosherwhatsit.
Earn Money Sleeping.

Domi_S

  • Guest
Re: Creating messengers
« Reply #5 on: May 24, 2004, 11:52:02 PM »
I tried MoveGlobalObject("CORAN",Player1) with the same unsatisfactory result (Coran gladly will run up to you but *after* you drag yor Player1's but to the area where he moved, but will not travel between areas to find Player1.

MoveGlobal probably not exactly what I need, since it moves someone to known location, and I want a spontaneous randezvous.

MoveGlobal(S:Area*,O:Object*,P:Point*)
This action is ONLY useful for NPC's that have already been added to the saved game file. It will jump the given object to the area and point specified. The syntax is pretty straightforward:
MoveGlobal("AREA","MINSC",[x.y])


Hmm... I will try moving offscreen, instead of to the certain area, see if it helps anything.

Offline Ghreyfain

  • Moderator
  • Planewalker
  • *****
  • Posts: 4705
  • Gender: Male
    • Pocket Plane Group
Re: Creating messengers
« Reply #6 on: May 25, 2004, 02:01:14 AM »
234 MoveGlobalObjectOffScreen(O:Object*,O:Target*) exists, so yeah, that's the one you want.
Earn Money Sleeping.

 

With Quick-Reply you can write a post when viewing a topic without loading a new page. You can still use bulletin board code and smileys as you would in a normal post.

Warning: this topic has not been posted in for at least 120 days.
Unless you're sure you want to reply, please consider starting a new topic.

Name: Email:
Verification:
Type the letters shown in the picture
Listen to the letters / Request another image
Type the letters shown in the picture:
What color is grass?:
What is the seventh word in this sentence?:
What is five minus two (use the full word)?: