Aller au contenu

Photo

PC won't face the way I want him to...


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

#1
Clyordes

Clyordes
  • Members
  • 300 messages
Hi folks,
For some reason, I'm having something strange going on that I don't seem to be able to change.

What I want is for the PC, when they walk into a trigger, to turn and face a storm giant statue that's in a cave very close to them & start a conversation with it.

This is the script I have (courtesy of Lilac Soul's gerator):

void main()
{
    object oTarget;

    // Get the creature who triggered this event.
    object oPC = GetEnteringObject();

    // Only fire for (real) PCs.
    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )
        return;

    // Have the PC turn to face "atomas_pool".
    oTarget = GetNearestObjectByTag("atomas_pool", oPC);
    AssignCommand(oPC, SetFacingPoint(GetPosition(oTarget)));

    // The PC holds an inner dialog.
    AssignCommand(oPC, ActionStartConversation(oPC, "atomas_statue_te", FALSE, FALSE));
}

What happens is the convo fires, but whichever way the PC is facing when they walk into the trigger - usually north, but I've tried hitting the trigger from various directions - every time, the PC turns east.

What's going on here?  Any ideas?  Is the PC looking for the rising sun or something?

Notes:
atomas_pool is the tag of a small boulder in the centre of the pool that the petrified giant it standing in - I tried using the tag of the giant itself, but it didn't work - I thought a placeable might - but no such luck.

Atomas_statue_te is the convo that needs to fire - this part works fine.

Any ideas or advice very gratefully received - I'm getting really close to release of this adventure now & this is one of the few things besides a bit of a polish that left to sort out.

Cly.

#2
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Try it like this:

void main()
{
    object oTarget;

    // Get the creature who triggered this event.
    object oPC = GetEnteringObject();

    // Only fire for (real) PCs.
    if ( !GetIsPC(oPC)  ||  GetIsDMPossessed(oPC) )
        return;

    // Have the PC turn to face "atomas_pool".
    oTarget = GetNearestObjectByTag("atomas_pool", oPC);

    AssignCommand(oPC, ClearAllActions(TRUE));
    AssignCommand(oPC, SetFacingPoint(GetPosition(oTarget)));

    // The PC holds an inner dialog.
    AssignCommand(oPC, ActionStartConversation(oPC, "atomas_statue_te", FALSE, FALSE));
}


See if that helps.

#3
Clyordes

Clyordes
  • Members
  • 300 messages
Hi GhostofGod - thanks for the fast response.

Just tested & sadly, my testing PC still appears obsessed with staring over to the right of where my giant is.

I'm sure there's some logical, easy to fix reason - but its foxing me at the moment.

Any other good ideas?

Cly

#4
Morbane

Morbane
  • Members
  • 1 883 messages
// Get the nNth object nearest to lLocation that is of the specified type.
// - nObjectType: OBJECT_TYPE_*
// - lLocation
// - nNth
// * Return value on error: OBJECT_INVALID
object GetNearestObjectToLocation(int nObjectType, location lLocation, int nNth=1);

#5
kevL

kevL
  • Members
  • 4 070 messages
- what if you setFacingPt
after the StartConvo ( perhaps delaycommand ),
or even in the first node of the dialog ?

#6
Morbane

Morbane
  • Members
  • 1 883 messages
also try and make the placeable/creature setabletospeaktononplayercharacters or whatever the tickbox is - you'll know it when u c it

#7
GhostOfGod

GhostOfGod
  • Members
  • 863 messages
Also if you are concerned with efficiency I would just use the "GetObjectByTag()" function. Just make sure whatever you are trying to face has a unique tag that no other object in your module has. Also I wonder if you might need a delay for the conversation line. Give the player time to perform the facing action before the convo start? Just a thought. Those tricky actions.

#8
Morbane

Morbane
  • Members
  • 1 883 messages

kevL wrote...

- what if you setFacingPt
after the StartConvo ( perhaps delaycommand ),
or even in the first node of the dialog ?


this is probably the issue - so try this first....

good one kev

#9
kevL

kevL
  • Members
  • 4 070 messages
.... additional info

this reminds me of a debug item that I use:

AssignCommand(oPC, ActionStartConversation(oPC, "kg_cv_theitem", TRUE, FALSE, TRUE, FALSE));

and it always twists my PC to the east. It seems to be a characteristic of / oPC talk to oPC /. Hence try setFacing after the conversation starts,

#10
kevL

kevL
  • Members
  • 4 070 messages
w/ ClearAllActions somewhere, lulz

#11
Dann-J

Dann-J
  • Members
  • 3 161 messages
You can try starting the conversation with a iPoint instead of having the PC talk to themself. Then the PC should turn towards the object they're talking to.

And as GhostofGod and KevL pointed out - ClearAllActions solves a multitude of problems.

Modifié par DannJ, 13 juin 2012 - 11:19 .


#12
Morbane

Morbane
  • Members
  • 1 883 messages
I have been using variations of gtr_speak_node to start conversations because the object - whatever it may be - does the talking and the objects display name shows in the dialog window too.

#13
Clyordes

Clyordes
  • Members
  • 300 messages
Many thanks folks - using a combination of the advice above, I've now got:

/*
* Script generated by LS Script Generator, v.TK.0
*
* For download info, please visit:
* http://nwvault.ign.c....Detail&id=1502
*/
// Put this script OnEnter.


void main()
{
object oActor;

// Get the creature who triggered this event.
object oPC = GetEnteringObject();

// Only fire for (real) PCs.
if ( !GetIsPC(oPC) || GetIsDMPossessed(oPC) )
return;

// Have "atomas_ip" strike up a conversation with the PC.
oActor = GetNearestObjectByTag("atomas_ip", oPC);
AssignCommand(oActor, ActionStartConversation(oPC, "", FALSE, FALSE));

// Have the PC turn to face "atomas_ip".
DelayCommand(1.0, AssignCommand(oPC, SetFacingPoint(GetPosition(oActor))));
}

& it works a treat!

Many Thanks!

Now onto the next issue....

Cly.

#14
johnbgardner

johnbgardner
  • Members
  • 185 messages
Have you tried ActionOrientToObject()? It's in ginc_actions. Very useful for making NPCs face a certain direction.

#15
Clyordes

Clyordes
  • Members
  • 300 messages
Thanks John - just seen your reply - much appreciated. Since the previous advice given worked fine, I'm really loathe to change anything now!

Besides, I'm scratching my head trying to work out an on acquire script that's refusing to work properly - if you can help - I'd be very grateful - see seperate thread - just submitting....

Cly.