Aller au contenu

Photo

How to make a "cell phone" item


  • Veuillez vous connecter pour répondre
21 réponses à ce sujet

#1
Graveyard Owl

Graveyard Owl
  • Members
  • 13 messages
I was thinking a silly thought of a cell phone on nwn2 but then I thought that if I were to undergo the proper scripting that that might be possible.  Anyone know what I would have to do or if there is a cell phone item floating around now?  I want it to work by you use it and it starts a conversation and it asks you to choose your speed dial and you select the person.  Upon selecting the person, you will talk to them from different areas.

#2
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
To have a conversation with an object, you have to be in the same area as that object. You could get around this by either

1)Jumping the desired NPC into the same area as the PC.
2)Spawning a new copy of the NPC into the PC's area, maybe with some effects to make the NPC invulnerable and impotent (like a hologram or ghost).
3)Use a generic i-point (or other object)to anchor the conversation, but then load up the specific conversation by resref.

You'd have to be very careful about how the conversations are structured, though. Some conversations reference particular objects in the area, like other NPCs or cameras. Others rely on variables set on the NPC object itself. If you were to make this cellphone thing a basic part of your plot, you might end up writing two separate convos for each NPC, one for face-to-face, and another for cellphone use.

#3
Graveyard Owl

Graveyard Owl
  • Members
  • 13 messages
How would I start a conversation with the item? I am familiar with the toolset but still remain in the newbie section. Would I need to set a variable in place?

#4
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
You would need to use tag-based scripting. Whatever script you write to make the cell phone call happen needs to be named like this:

i_[tag of cell phone item]_ac

You also need to set the item property to Cast Spell - Activate item.


From there, just write a script to start a conversation. To simplify things, I would make all the conversations that you have via the cell phone NWN1 style. This will just make it a little easier.

#5
Dann-J

Dann-J
  • Members
  • 3 161 messages
In SoZ you 'talked' to an inventory item after getting the fire genasi sensate all of his rare materials. If you've got SoZ then you could try to track down the tag-based script that it used (it will have the naming format that M.Rieder mentioned above). I've learned a lot by searching through scripts in the official campaign modules, pulling them apart, and seeing how they tick.

#6
GhostOfGod

GhostOfGod
  • Members
  • 863 messages

Graveyard Owl wrote...

How would I start a conversation
with the item? I am familiar with the toolset but still remain in the
newbie section. Would I need to set a variable in place?


You can just make it so the player starts a conversation with himself when the item is activated. This is how it is usually done:

AssignCommand(oPC, ActionStartConversation(oPC, "res ref of conversation", TRUE));

Modifié par GhostOfGod, 20 juin 2011 - 07:54 .


#7
Graveyard Owl

Graveyard Owl
  • Members
  • 13 messages
Where do I find the "res ref" of the conversation?

#8
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
That's just the name of the conversation as it's displayed in the conversations tab in your toolset.

#9
M. Rieder

M. Rieder
  • Members
  • 2 530 messages

GhostOfGod wrote...

Graveyard Owl wrote...

How would I start a conversation
with the item? I am familiar with the toolset but still remain in the
newbie section. Would I need to set a variable in place?


You can just make it so the player starts a conversation with himself when the item is activated. This is how it is usually done:

AssignCommand(oPC, ActionStartConversation(oPC, "res ref of conversation", TRUE));

 

++

This will save you lots of trouble about how to get the object you are conversing with in the same area as the PC.

#10
kamal_

kamal_
  • Members
  • 5 250 messages
I have a talking item, a "stone of recall", in Path of Evil. I did it with the i_ stuff above. Iirc shaughn helped me out with it. It's not so complicated, just that it's something most builders rarely need to do.

#11
Graveyard Owl

Graveyard Owl
  • Members
  • 13 messages
I think I did something wrong. I made the script provided by GhostofGod and named it i_phone_ac like M. Rieder told me to do. (Tag of cell phone is phone) I filled in the res ref needed for the script and inserted cellphone with quotations. Cellphone is the name of the conversation. I added the activate item on the item. I believe that is all. It didn't work. What went wrong?

#12
Lugaid of the Red Stripes

Lugaid of the Red Stripes
  • Members
  • 955 messages
Did you define oPC? Make a script using the on-item-activated template, and it should show you the function for getting the PC that last used the item.

#13
Shaughn78

Shaughn78
  • Members
  • 637 messages
Couple of things:

GhostofGod gave you the line of script to start the converstion, you need to identify the the object oPC.

Another thing you will want to look at is creating an ipoint to start the conversation, specially if you want to use the SOZ conversation. If you have the user of the item start a conversation with themselves they will not be selectable to speak PC nodes.

here is a script I use:
I created a unique ipoint blueprint with ref "dg_ipoint_cage_talk" that is created with this script
Just modify for your needs and it should do the job.

// i_"item_tag"_ac
/*
Template for an Activate item script.
This script will run each time an item's "custom activation" is used.
*/
// Name_Date

void main()
{
object oPC = GetItemActivator();
if(!GetIsPC(oPC))
{
oPC = GetFactionLeader(oPC);
}

location lTarget = GetItemActivatedTargetLocation();
object oDest = GetObjectByTag("dg_ipoint_cage_talk");
location lSpawn = GetLocation(oPC);

DestroyObject(oDest); //if ipoint exist already destroy it

//creates ipoint to start converation
object oSpeak = CreateObject(OBJECT_TYPE_PLACEABLE,"dg_ipoint_cage_talk",lSpawn);



//starts conversation

AssignCommand(oSpeak,ActionStartConversation(oPC,"your_convo_name",FALSE,FALSE,TRUE));
}

Modifié par Shaughn78, 24 juin 2011 - 07:55 .


#14
Graveyard Owl

Graveyard Owl
  • Members
  • 13 messages
Oh my god, I thought this would be simpler. Now I know I need to learn a LOT more. What is ipoint?

#15
kamal_

kamal_
  • Members
  • 5 250 messages

Graveyard Owl wrote...

Oh my god, I thought this would be simpler. Now I know I need to learn a LOT more. What is ipoint?

An ipoint is an invisible placeable object. They exist in the toolset for the express purpose of doing things like this. Other common uses are placing sounds and visual effects.

#16
Graveyard Owl

Graveyard Owl
  • Members
  • 13 messages
Oh, I know what those are. So for the procedure I need to just place one in and add it to the script?

#17
Shaughn78

Shaughn78
  • Members
  • 637 messages
The script spawns in an ipoint.

I was using a unique blueprint. but it could spawn in the global ipoint blueprint and assign it a new tag. Just replace the 2 lines that define the objects oDest & oSpeak

object oDest = GetObjectByTag("Your_NewTag");
object oSpeak = CreateObject(OBJECT_TYPE_PLACEABLE,"plc_ipoint ",lSpawn,FALSE,"Your_NewTag");

Just remember to add a space the end of the ipoint reference before the ". Since for some reason the designers did that...?

Modifié par Shaughn78, 25 juin 2011 - 03:11 .


#18
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
If you just want it so that when the player activates an item it will start a conversation, just make your tag based script like this:


void main()
{
    object oPC = GetItemActivator();
    AssignCommand(oPC, ActionStartConversation(oPC, "name of conversation here", TRUE, FALSE, TRUE, TRUE));
}

You don't need to mess around with ipoints or spawning in any placeable etc.. unless you want to have an actual different speaker.
Just plug in the name of your conversation and make sure you use the right naming convention for the tag scripting.
"i_itemtaghere_ac". Just tested and is working fine

#19
Graveyard Owl

Graveyard Owl
  • Members
  • 13 messages
WOOHOO!!! I now made my own cell phone! Thanks to all who helped me in this accomplishment. Well... now I guess I should make an adventure using the phone...

#20
CID-78

CID-78
  • Members
  • 1 124 messages
I need to be a potential party popper here. The script above would only work in a Single Player enviroment.

if you end up with two or more player in the same area that uses "phones" weird things will start to happen. because you will potentially delete ipoints used by other players.

you need to make sure they remain unique in one way or another, so they can't mess with each others functionality.

#21
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Which script were you talking about CID-78? The one I posted doesn't use ipoints.

#22
CID-78

CID-78
  • Members
  • 1 124 messages
no Shaughn78 script. Yours are player independent, but require consideration when writting the dialogue.