ADRIFT Forum


The place to discuss the ADRIFT Interactive Fiction toolkit

Giving commands to NPCs demo [5.0.24]

This forum is the place to learn about and discuss ADRIFT 5. Feel free to mention any bugs you find here, but please also add these to the Bugs & Enhancements list.

Please also refer to the ADRIFT 5 Wiki for more information.

Giving commands to NPCs demo [5.0.24]

Postby ElliotM » Thu Jul 26, 2012 10:25 pm

One thing I wanted to do with conversation tasks was be able to give commands to npcs, and now I've figured out how it can work using a simple general task patterned after the say something tasks.

Syntax: %character%{,} %text%
Restrictions: The player must have seen referenced character AND The player must be in the same location as referenced character.
Action: Say %text% to referenced character.
Task is repeatable.

To create commands for npc's to follow, you will need to make conversation items for them. Check the box for general commands and leave the rest unchecked. In the command field, type the syntax of the instruction as the player would type it.

For example, "take crate" would be in the command field and in game the player could tell the npc to take the crate by typing "say take crate to robot" or "robot, take crate". While both would work, the latter is more natural and follows the syntax for giving commands to npc's that I've seen in other games.

Attached is a demo. If you like paradoxes and want to reach "Nowhere", do the following: Tell the robot to take the crate, then sit on it yourself, and tell the robot to sit on the crate too. Viola, you are nowhere and can't see either the crate or the robot.

Obviously, one would need to be careful to add the necessary restrictions to avoid such scenarios. I used conversation actions for the robot command but didn't use them to execute tasks. For example, having the robot take the crate using one of the general commands just wouldn't work, because Adrift will become confused (at least when I tried with a generic %object% reference). If your npc's have several commands in common, it might be worth it to make tasks for them, probably of the system type.
Attachments
Test_Chamber 2.taf
Added a second NPC. Can now have npc's give commands to each other.
(12.64 KiB) Downloaded 45 times
Test_Chamber.taf
The original, with just one NPC. You can give it some commands, look in the Conversation topics to see what they are.
(12.48 KiB) Downloaded 46 times
Last edited by ElliotM on Tue Jul 31, 2012 2:20 am, edited 2 times in total.
ElliotM
 
Posts: 507
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Giving commands to NPCs demo [5.0.24]

Postby saabie » Fri Jul 27, 2012 4:08 am

Thanks, this works wonderfully :bravo:
You should add it to the How do i ? section of the wiki so it doesn't get lost,
or you could submit an enhancement request to add this to the standard library.
saabie
 
Posts: 292
Joined: Fri Aug 12, 2011 2:07 am
Location: Adelaide, South Australia

Re: Giving commands to NPCs demo [5.0.24]

Postby ElliotM » Fri Jul 27, 2012 4:20 am

Unfortunately I don't have editing permissions on that page, but I can certainly add an enhancement request. :)


*edit* And done: http://www.adrift.co/cgi/adrift.cgi?pag ... ugid=18517
ElliotM
 
Posts: 507
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Giving commands to NPCs demo [5.0.24]

Postby Po. Prune » Fri Jul 27, 2012 7:32 am

That wasn't very nice Elliot! :x
Now I have to rethink D-Day all over again. This allows for some great interaction between characters. 8)
D-Day V.5 in progress 79Kb so far (slowly getting there)
The Inheritance (Annual Adrift Comp. entry) in progress
User avatar
Po. Prune
Moderator
 
Posts: 3418
Joined: Mon Jun 24, 2002 8:18 am
Location: Denmark

Re: Giving commands to NPCs demo [5.0.24]

Postby ElliotM » Fri Jul 27, 2012 3:27 pm

"Po, rethink everything" :whistle:

Glad you guys find this useful. :)

I've attached the demo now so you can see how it works. The new task is pretty simple, but the instructive part would be the conversation topics in the robot character.

The big question for your game, though, Po, is how many NPCs you have. In my demo, I created all of the commands out of actions, without executing tasks, and this probably wouldn't scale very well for lots of npc's if it takes multiple actions to complete a command that you want all of them to have. In this case, you may need to create specific task or new general tasks, but I can help with that if you need ideas.
ElliotM
 
Posts: 507
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Giving commands to NPCs demo [5.0.24]

Postby Po. Prune » Fri Jul 27, 2012 6:19 pm

There wasn't any specific number of NPC's in my game. The player would be leader of a squad more because it would seem weird that anyone during D-Day would be roaming the landscape by himself (Unless a paratrooper of course who were scattered all over creation.)
But after having found out about your "Giving orders to NPC's I realize that the player would/should be able to order his men, or an individual, to perform a certain action.
D-Day V.5 in progress 79Kb so far (slowly getting there)
The Inheritance (Annual Adrift Comp. entry) in progress
User avatar
Po. Prune
Moderator
 
Posts: 3418
Joined: Mon Jun 24, 2002 8:18 am
Location: Denmark

Re: Giving commands to NPCs demo [5.0.24]

Postby ElliotM » Fri Jul 27, 2012 6:40 pm

Sounds neat, I hope you manage to do something cool with this then.
ElliotM
 
Posts: 507
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Giving commands to NPCs demo [5.0.24]

Postby ElliotM » Tue Jul 31, 2012 2:17 am

Just figured out how to have an npc give a command to another npc. I created a new npc in my demo, a research assistant named Cindy, and then I created this conversation topic for her so she could give commands to the robot.

Summary: Say Something to Someone
Type of topic: General Command
Command: tell Robot to %text%
Conversation: "Sure thing, Boss."

Restriction: Character 'Cindy' must be in the same location as character 'Robot'
Actions: Enter conversation with character 'Robot' ((might be unnecessary?))
Say %text% to character Robot


This worked pretty well, but revealed an authoring flaw on my part: I included the player's end of the conversation into Robot's responses, and these are unchanged if Cindy is the one giving robot instructions. However, since I don't have any he said or she said phrases in there, it still works, so its just something to keep in mind. You can download the second version of the demo up above at the end of the original post.
ElliotM
 
Posts: 507
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Giving commands to NPCs demo [5.0.24]

Postby DazaKiwi » Sat Aug 04, 2012 7:01 am

This is pretty neat.

I've just been messing around with your demo and i wanted to try something a little different, adding more npc and see if you could tell everyone in the room to move to another room, but i don't think there is a %location% function to be used as a referenced location. I think it would be handy to be able to do move npc(s) to a specific location of players choosing. I hope this isn't going off topic, but does relate to giving commands to npc's.
User avatar
DazaKiwi
 
Posts: 233
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand

Re: Giving commands to NPCs demo [5.0.24]

Postby Lazzah » Sat Aug 04, 2012 7:06 am

DazaKiwi wrote:This is pretty neat.

I've just been messing around with your demo and i wanted to try something a little different, adding more npc and see if you could tell everyone in the room to move to another room, but i don't think there is a %location% function to be used as a referenced location. I think it would be handy to be able to do move npc(s) to a specific location of players choosing. I hope this isn't going off topic, but does relate to giving commands to npc's.

F.Y.I., I have requested a %location% reference as here: http://www.adrift.co/cgi/adrift.cgi?pag ... ugid=18331
I am hoping Campbell will implement this for v.5.25.
"Why me?"

WIP: "The Axe of Kolt". Remake of the award-winning original Spectrum adventure: 350kb @ 22/5.

"The Fortress of Fear" - OUT NOW! Download it at: http://www.adrift.co/game/1366
User avatar
Lazzah
 
Posts: 989
Joined: Thu Mar 31, 2011 4:54 am
Location: London, England

Re: Giving commands to NPCs demo [5.0.24]

Postby DazaKiwi » Sat Aug 04, 2012 8:29 am

Lazzah wrote:F.Y.I., I have requested a %location% reference as here: http://www.adrift.co/cgi/adrift.cgi?pag ... ugid=18331
I am hoping Campbell will implement this for v.5.25.


I've added my vote too, hopefully this will be implemented in the next update :welldone:
User avatar
DazaKiwi
 
Posts: 233
Joined: Thu Oct 21, 2010 9:05 am
Location: New Zealand

Re: Giving commands to NPCs demo [5.0.24]

Postby ElliotM » Sat Aug 04, 2012 5:24 pm

Not off topic at all. If you wanted a single flexible conversation topic for it, you would need a %location% reference. Right now some of my commands are just hard-coded, but there are %object% and %character% references I could attempt to get working.

Getting every npc to respond to a single command would require being in conversation with all of them - or having each npc have the same command which triggers a shared npc task that moves every character in the room?
ElliotM
 
Posts: 507
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA

Re: Giving commands to NPCs demo [5.0.24]

Postby Po. Prune » Sat Aug 04, 2012 6:44 pm

Maybe being able to create a group of npc's, like you can create a group of rooms?
D-Day V.5 in progress 79Kb so far (slowly getting there)
The Inheritance (Annual Adrift Comp. entry) in progress
User avatar
Po. Prune
Moderator
 
Posts: 3418
Joined: Mon Jun 24, 2002 8:18 am
Location: Denmark

Re: Giving commands to NPCs demo [5.0.24]

Postby ElliotM » Sat Aug 04, 2012 8:17 pm

In the actions there is the possibility of using a "move everyone in group ___" but without a %location% reference you'd need to remake it for each location in game the npc's were supposed to be able to go.
ElliotM
 
Posts: 507
Joined: Tue Apr 17, 2007 8:04 pm
Location: The Midwest in the USA


Return to ADRIFT 5.0

Who is online

Users browsing this forum: No registered users and 2 guests