Aller au contenu

Photo

oPC starts conversatiom with themself?


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

#1
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Here is my script to start conversation with memorycrystal.

#include "x2_inc_switches"
void main()
{
object oPC;
oPC = GetItemActivator();
//The PC will technically start a conversation with himself
//You should add some odd little sound to the first line in the
//conversation file, or the PC will give his normal voicegreeting.
object oTarget;
oTarget = oPC;
AssignCommand(oTarget, ActionStartConversation(oPC, "memorycrystal"));
}
I added sound oPc wont say hello to them seld but the text box that appears has player name ..

My question is ..how do I actually have the conversation with the item instead of oPC themself?Posted Image

#2
Shadooow

Shadooow
  • Members
  • 4 465 messages
you must create invisible placeable under PC and assign conversation to it (you will want to rename its name)

btw that placeable may be static, yet is good idea to destroy it when pc exits conversation

Modifié par ShaDoOoW, 26 juillet 2010 - 11:40 .


#3
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Ok got it to work here it is.

void main()
{
object oPC;
object oTarget;
object oSpawn;
location lTarget;
oPC = GetItemActivator();
oTarget = oPC;
lTarget = GetLocation(oTarget);
oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "invisobj001", lTarget);
AssignCommand(oTarget, ActionStartConversation(oSpawn, "memorycrystal"));
}

How do I destroy the object now ?Posted Image

Modifié par Knight_Shield, 27 juillet 2010 - 01:50 .


#4
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Maybe a DelayCommand?

#5
Shadooow

Shadooow
  • Members
  • 4 465 messages
Its called OnAbortConversation event, but its hidden very well :)



open conversation, in right down corner there are actions for given line, and there is hidden one more "Current File" you must use > arrow near Coments.



Now there is Normal and Aborted field



make new script in aborted which will destroy nearest "invisobj001" and you are fine. (Well might be better to store oSpawn into local variable on player)

#6
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
:blush:
void main()
{
object oPC = GetPCSpeaker();
object oTarget;
oTarget = GetNearestObjectByTag("invisible");
DestroyObject(oTarget, 0.0);
}

This look good to you ?

#7
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
EDIT: :whistle:

void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetNearestObjectByTag("invisible", oPC);
DestroyObject(oTarget, 0.0);
}

You left out one of the parameters for GetNearestObjectByTag. Needed oPC in there.

Modifié par GhostOfGod, 27 juillet 2010 - 03:30 .


#8
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Thank you very much ..I can cut n paste pretty good but making scripts or using the gen I dont do to good.Posted Image

#9
Shadooow

Shadooow
  • Members
  • 4 465 messages
Activate:

void main()
{
object oTarget = GetItemActivator();
object oSpawn = CreateObject(OBJECT_TYPE_PLACEABLE, "invisobj001", GetLocation(oTarget));
SetLocalObject(oTarget,"INVISIBLE_SPEAKER",oSpawn);
AssignCommand(oTarget, ActionStartConversation(oSpawn, "memorycrystal"));
}


Abort:

void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC,"INVISIBLE_SPEAKER");
DestroyObject(oTarget);
}

getnearest will work too, but there is possible gap in script which could do mess...

#10
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
Question: If in the On Actvate script he had oSpawn start the conversation with oTarget(the PC ) would he be able to then just destroy OBJECT_SELF from the conversation?




#11
GhostOfGod

GhostOfGod
  • Members
  • 863 messages

Lightfoot8 wrote...

Question: If in the On Actvate script he had oSpawn start the conversation with oTarget(the PC ) would he be able to then just destroy OBJECT_SELF from the conversation?


I was kinda thinking that too. Should just be able to use if that got changed?:

void main()
{
DestroyObject(OBJECT_SELF);
}

I think.

Modifié par GhostOfGod, 27 juillet 2010 - 04:14 .


#12
Shadooow

Shadooow
  • Members
  • 4 465 messages

Lightfoot8 wrote...

Question: If in the On Actvate script he had oSpawn start the conversation with oTarget(the PC ) would he be able to then just destroy OBJECT_SELF from the conversation?

yea good point

#13
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
OK guys *grabs the football* which way do I run?

#14
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Yeah with my last script in place it is not destroying static object which i made something different so I could see if it was disappearing or not ...so need more help

#15
KooKoo88

KooKoo88
  • Members
  • 151 messages
This is a placeable, yes?

Go to properties, In the advanced tab, put the conversation you want.  Make the placeable useable.  In the script tab, go to the 'On Used' event and add this script:

void main()
{
object oPC = GetLastUsedBy();
ActionStartConversation(oPC);
PlaySound("al_mg_crystalnt1");
}

That should work the way you want it to. The placeable will start its conversation and most don't have a default hello, so you should be fine. (writing this at work, so if I make a mistake, I apologize)
The sound is a neutral magic crystal.  You can look in the Lexicon for other sounds.  You can also place the sound on the first thread of the conversation in the other actions tab. :)

good gaming.  Posted Image

Modifié par KooKoo88, 27 juillet 2010 - 02:01 .


#16
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Just tried your scripts ShaDoOow ...but they are not detroying the object either.

Just seen yuor post KooKoo88.. Im not clicking on the object ..Im activating object and spawning the invisobject to automaticly start conversation. I dont want to click on the spawned object to start conversation.Hope I explained it properly.:blink:

Modifié par Knight_Shield, 27 juillet 2010 - 02:17 .


#17
KooKoo88

KooKoo88
  • Members
  • 151 messages
I see. I misunderstood. :(

#18
KooKoo88

KooKoo88
  • Members
  • 151 messages
Try unclicking the static button. if that doesn't work, try SetIsDestroyable(TRUE); on it before you destroy it.

#19
Shadooow

Shadooow
  • Members
  • 4 465 messages

Knight_Shield wrote...

Just tried your scripts ShaDoOow ...but they are not detroying the object either.

I believe it does, but your placeable is static. Static placeables are loaded once per player when he enters area (which is their advantage, server dont send informations about them to the clients until they reenter area). So it may look your placeable is still there however its not, its destroyed. Try removing static flag, if you see it works then you can set it back and use invisible placeable to totally hide how it works from PC.

#20
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Ok checked box usable . Did converstion..then left area ..came back in a minute later and still seen it .Should I wait longer?

#21
KooKoo88

KooKoo88
  • Members
  • 151 messages
Hmmm, nope. It should be destroyed instantly.



*ponders*

#22
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
Here is the ABort conversation script so far .

void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC,"INVISIBLE_SPEAKER");
SetIsDestroyable(TRUE);
DestroyObject(oTarget);
}

I set it to usable to see but not plot .


Just was looking at lexicon ..it says something abut it works better with the Delay function. Does this make sense?

Modifié par Knight_Shield, 27 juillet 2010 - 03:56 .


#23
AndarianTD

AndarianTD
  • Members
  • 701 messages

Knight_Shield wrote...

Here is the ABort conversation script so far .

void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC,"INVISIBLE_SPEAKER");
SetIsDestroyable(TRUE);
DestroyObject(oTarget);
}

I set it to usable to see but not plot .


Just was looking at lexicon ..it says something abut it works better with the Delay function. Does this make sense?


Yes, it does. DestroyObject is often better done with a short delay, like this, on a terminal node of the conversation:
  • DelayCommand(2.0,DestroyObject(oTarget));
(EDIT: As lighftoot8 reminded me there's a delay parameter built into the DestroyObject command itself, so you don't need to use DelayCommand. I just checked the Lexicon and discovered that object destruction via DestroyObject automatically waits until the script completes anyway. So the delay precautions I've been taking weren't needed after all. Learn something new every day. :)

When you start a conversation between the PC and a character or object, the conversation's scripts run on that character or object (as OBJECT_SELF). You don't want to run a script that immediately destroys the object that's running the script and the conversation until you give both a chance to end gracefully first.

Modifié par AndarianTD, 28 juillet 2010 - 12:39 .


#24
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
all DestroyObject commands are already delayed. There is not reason for the delay command.

// Destroy oObject (irrevocably).
// This will not work on modules and areas.

void DestroyObject(object oDestroy, float fDelay=0.0f)



But i can see reason to increase the delay to longet then the script just ending.

Modifié par Lightfoot8, 27 juillet 2010 - 08:41 .


#25
Shadooow

Shadooow
  • Members
  • 4 465 messages
Try this in Abort

void main()
{
object oPC = GetPCSpeaker();
object oTarget = GetLocalObject(oPC,"INVISIBLE_SPEAKER");
SendMessageToPC(oPC,"OnConversationAbort script fired, oTarget: "+GetName(oTarget)+", id: "+ObjectToString(oTarget));
DestroyObject(oTarget);
}

and tell us if you get any message