NPC script, incomplete.

Started by DeathCow, Jun 12, 2006, 03:27 PM

Previous topic - Next topic

DeathCow

I'm just working out how i want time related NPC dialog to work.? Just posting this while I work things out.
Example NPC scripts.























Greet Cambrian
Check time, 9a-5p Though he does not seem hostile, the man greets you in a fighting stance.
Else Cambrian bows slightly at your approach.
"Dost thou have a need?" asks Cambrian.
ask Cambrian Cambrian
"Yes I am called Cambrian, Master Cambrian."
ask Cambrian need
"I operate the famous fighting school here in Carnbrigg, the Museum of Heroes. I also run my own training programs for warriors.? But I only train them personally from time to time and only if they show potential."
ask Cambrian potential
If Class 1 "I teach a fighting style of mine own invention. It enables one to gain complete mastery over his opponent. I would require a little demonstration of thy abilities."
Else "Yes, from time to time a warrior will happen to display potential worthy of my efforts.? I pride myself on teaching only the finest students.
ask Cambrian demonstration
"Very well. Let us begin!"
[Skill Test]"I must apologize for the discourtesy, but mine unequaled talents demand that I take on only the most skilled students, your demonstration does not impress me. I Wilt not accept thee at this time."
[not warrior]"Very well, then!" His scowl indicates his displeasure. "If thou must mock me then I shall humilate thee. The Museum of Heroes is not the place for thee."
ask Cambrian Carnbrigg
"This stronghold is ardent to the arts of war. Not mere fawned flashy mystic discipline, but pure violent confrontation. It is a place after mine own heart."
ask Cambrian Museum of Heroes
"It is indeed the true blue-blood of fighting schools. Its history long and proud. Many great warriors have trained within its walls. We teach the finest use off all weaponry.? Our students are given access to our own blacksmiths who craft the best weapons in all the land."
ask Cambrian warriors
If time 9a-5p "I train my students to be fierce and ruthless fighters!"
Else "I do not feel like discussing business at the moment. Some other time perhaps."
ask Cambrian time
"Visit me at the Museum during daylight hours."
ask Cambrian best
Cambrian unsheathes his own sword and shows it to you. The sword has an elaborate elemental pattern engraved in it. "Thou mayest recognize a weapon of the Museum of Heroes by its engraving."
ask Cambrian dagger
checkitem [egraved dagger][You have nothng to show Cambrian]You produce the dagger found at the scene of the murders in Duran. The elemental engraving matches the markings of the Museum of Heroes exactly. Cambrian looks at it and then back at you. He cannot conceal his surprise. "From where didst thou get that dagger?"
ask Cambrian found
Cambrian peers at you, obviously aware of its signifigance. "You're saying you just found it?"
ask Cambrian Duran
You look Cambrian in the eye and tell him that you found it at the scene of the murders in Duran. He gives you a curious look.? "That dagger was stolen from the Museum of Heroes weeks ago. I have no further knowledge of it. Perhapes you should do some more investigation into how it got to Duran."
ask Cambrian Corgan
Quest Check"As thou hast probably seen, a few of our members had a dispute with a local troublemaker over our honor flag. We of the Museum of Heroes have a fierce dedication to our institution. I do not know what exactly happened to this upstart, but I understand that he is now dead. I am not trying to suggest the Museum of Heroes had anything to do with it, of course. Only that it would be wise not to cross us."
Failed Quest Check "Corgan is a teacher here at the Museum of Heroes, His practice is located in the northern most barracks."
Quest Check "I have heard that thou didst kill several of our members while champion of a duel defending the thief of our honor flag." His eyes narrow as he stares at you intensely. "Outstanding! I am a man who values nothing higher than the application of skill. I salute thee on thy victory. Perhaps thou wouldst like to join our group? If not that, perhapes an informal practice session. Consider it a demonstration of my fighting style."
ask Cambrian session
"As my style of fighting is the superior style, I am only interested in training the best. Perhaps thee qualify. We might find out, that is, if thou art courageous enough."
ask Cambrian honor flag
Quest Check "Fortunately for Corgan our honor flag was returned. If it had not been we would have had no choice but to regain our honor with his blood."
Quest Check "When we find the theif, not even the holy prayers of the Maggias Priests can save him."
<leaving>
quest check time check "Thou canst get away so easy without a demonstration, but thou shalt have to return in the morning!"
"May thy stay in Carnbrigg be a memorable one," Cambrian laughs as he turns and walks away.

DeathCow

#1
Ability 188, Used in monsters to create AI scripts; 188:Script parameter value=start textblock
Movement Scripts.
Monster Cambrian will be given ability 188 1.
Textblock 1
12a:
1a:
2a:
3a:
4a:
5a:
6a:
7a:
8a:0:Message 1|10:message 2|20:message 3|30:message 4|40:message 5|50:message 6|59:message 7|
9a:path 2
10a:NPC sparring
11a:NPC sparring
12p:NPC sparring
1p:NPC lunch
2p:NPC sparring
3p:NPC sparring
4p:NPC sparring
5p:0:move 1 6|10:move 1 5|20:move 1 4|30:move 1 3|40:move 1 2|50:move 1 1|59: move 1 0|
6p:Dinner
7p:
8p:
9p:
10p:
11p:

textblock 2
0:move 1 1|10:move 1 2|20:move 1 3|30:move 1 4|40:move 1 5|50:move 1 6|59: move 1 7|

The Crazy Animal

This responce is just to record some of the things that I talked to DC about npc scripts.

Ability 188, Used in monsters to create AI scripts; 188:Script parameter value=start textblock
Movement Scripts.
Monster Cambrian will be given ability 188 1.

Suggested Script functions:
Define= is used to designate a set of commands as a single function call. The call only exists with in the textblock doing the calling.
Define= "Message set <#>" Creates a set of messages
Define= "path <#>" creates a movement set
Walk Path <#> tells the npc to walk a path
Set walk speed <#> value = seconds and alters the amount of time a npc spends before moving to the next room.

I know DC isn't fond of other scripting languages but if we added in a set script style command at the start of a textblock we could have a textblock read both legacy mmud scripts and a new style.

Textblock 1
Define= path 1:0:move 1 1|10:move 1 2|20:move 1 3|30:move 1 4|40:move 1 5|50:move 1 6|59: move 1 7|
Define= Path 2:0:move 1 6|10:move 1 5|20:move 1 4|30:move 1 3|40:move 1 2|50:move 1 1|59: move 1 0|
Define= Message set 1:0:Message 1|10:message 2|20:message 3|30:message 4|40:message 5|50:message 6|59:message 7|
<snip unused time slots>
8a:message set 1
9a:Set walk speed 5:walk path 1
10a:NPC sparring
11a:NPC sparring
12p:NPC sparring
1p:NPC lunch
2p:NPC sparring
3p:NPC sparring
4p:NPC sparring
5p:Set walk speed 5:walk path 2
6p:Dinner
<snip unused time slots>

The other idea that I think might work is if you can have the textblock read megamud style loop or path file by making calls to their filenames and then using that to control npc movement. This would allow the content designer a way to easily record and swap path/loop files between the various npcs in an area.

DeathCow

It occurs to me now that I'm sober that I can really just just call another textblock, and have that textblock be message sets and paths....no need to make new function..

Valentine

Quote from: DeathCow on Jun 13, 2006, 09:38 PM
It occurs to me now that I'm sober ...

Is it just me, or is this the funniest thing ever written?? ;D
"...There was always a minority afraid of something, and a great majority afraid of the dark, afraid of the future, afraid of the past, afraid of the present, afraid of themselves and shadows of themselves..." --Ray Bradbury, The Martian Chronicles

The Crazy Animal

Quote from: DeathCow on Jun 13, 2006, 09:38 PM
It occurs to me now that I'm sober that I can really just just call another textblock, and have that textblock be message sets and paths....no need to make new function..

Bad DC :fish: you need to get un-sober real fast so you can think stright again.

You should never need to call other textblocks to preform functions that can be locally defined in a textblock, its bad script formating... Scripts should be compact, easy to read, easy to learn/understand, and easy to code. A single npc script should not be strune across a multitude of texblocks, doing that is counter productive to improving the scripts functionality.