Castle Paradox Forum Index Castle Paradox

 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
 Gamelist   Review List   Song List   All Journals   Site Stats   Search Gamelist   IRC Chat Room

Make an NPC say something different each time you chat

 
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP!
View previous topic :: View next topic  
Author Message
Alphazero15
Guest






PostPosted: Sun Mar 21, 2010 11:29 am    Post subject: Make an NPC say something different each time you chat Reply with quote

There's a crazy hyper little NPC I want to say random stuff each time you talk to him, but I want it to go through a cycle of 10 or so phrases. For example, you talk to him once he says "corn!", the next time he says "baseball!", then "frogs!", and then back to "corn!" How would I do that?
Back to top
Pepsi Ranger
Reality TV Host




Joined: 05 Feb 2003
Posts: 493
Location: South Florida

PostPosted: Sun Mar 21, 2010 11:51 am    Post subject: Reply with quote

Create a global variable. Call it "hyperkid" or something you'll remember.

Set it to a plotscript that increments by 1 for every time the player talks to him.

Set a conditional that checks for whenever the variable "hyperkid" reaches 10. When it hits ten, reset the variable to 0.

Have each number 0-9 represent another text box.

If you want it simplified, change the first global to the number of the first textbox in the queue.

So, it could look like this (I write in old style, so you'll want to make your syntax adjustments if you write in new style):

Code:
global variable (1,hyperkid)

#the first script assumes that you previously assigned the first textbox, let's say text 1000, to the global variable "hyperkid" at the beginning of the game.

script,Speaking to the Hyper Kid,begin
show text box (hyperkid)
wait for text box
increment (hyperkid,1)
if (hyperkid>=1010) then(
set variable (hyperkid,1000)
)
end

#the second version assumes that you're doing things the hard way.

script,Speaking to the Hyper Kid Hardtype,begin
if (hyperkid==0) then(
show text box (1000)
wait for text box
)
if (hyperkid==1) then(
show text box (1001)
wait for text box
)
.
.
.
if (hyperkid==9) then(
show text box (1009)
wait for text box
)
increment (hyperkid,1)
if (hyperkid>=10) then(
set variable (hyperkid,0)
)
end


Make sure you assign the NPC the "Speaking to the Hyper Kid" script and not the textbox.

Hope this helps.
_________________
Progress Report:

The Adventures of Powerstick Man: Extended Edition

Currently Updating: General sweep of the game world and dialogue boxes. Adding extended maps.

Tightfloss Maiden

Currently Updating: Chapter 2
Back to top
View user's profile Send private message AIM Address Yahoo Messenger MSN Messenger
Alphazero15
Guest






PostPosted: Sun Mar 21, 2010 5:02 pm    Post subject: Reply with quote

Yeah, I'm really new to this and am not sure how to do that... if someone could explain it step by step that would be great. But if not, I'm sure I could poke around and figure it out somehow.
Back to top
TMC
On the Verge of Insanity




Joined: 05 Apr 2003
Posts: 3240
Location: Matakana

PostPosted: Thu Mar 25, 2010 2:59 am    Post subject: Reply with quote

OK, here's a modified version of one of Pepsi's scripts to make it even easier: a complete script file that can be compiled as it is. You only need to change "1234" to the number of the first textbox. It assumes all the other textboxes follow after it. (If you need more flexibility, use Pepsi's second script.) "10" is the number of textboxes.

For a tutorial on compiling, importing, and attaching scripts to NPCs, see the 'Plotscripting Tutorial'. You can obviously skip all the parts about writing scripts if you don't want to learn (skip the "Your First script" section).

Code:
include, plotscr.hsd

global variable (1, hyperkid)

plotscript, Speaking to the Hyper Kid, begin
  show text box (hyperkid + 1234)
  wait for text box
  hyperkid += 1
  if (hyperkid >= 10) then (hyperkid := 0)
end

_________________
"It is so great it is insanely great."
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    Castle Paradox Forum Index -> HELP! All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group