I have a cutscene which which several characters performing the ambient 'sit' animation take a part. At the end of the scene, they are all moved (and sitting on nothing). I suspect that this is because characters who sit must be placed in a non-safe location (i.e. standing 'in' a couch) to start. My guess as to why they are moved is that when the cut is done, the game returns them to the nearest "safe" location.
But my question is not about cutscenes. It's actually a 2-part question about how I move them back via script:
1. What is the easiest way to move an NPC to a non-safe location? I have the lLocation and the oObject; I'm just not sure how to get oObject to lLocation when LLocation is not 'safe.'
2. The cut is performed from a script in a conversation - the script also sets plot flags and awards XP. However, the cut does not kick off until AFTER the conversation is finished. That means (I think) that I can't do the move in the same script even after the cut commands, as the NPCs will be placed in a safe location by the cut AFTER the script had moved them. I need to move them after the cut completes. So how do I kick off a scrip that will run AFTER the cut, when the cut itself runs after the conversation in which I could put a script?
Any insight would be appreciated.
Moving characters to non-safe locations
Débuté par
BillHoyt
, juil. 11 2010 07:42
#1
Posté 11 juillet 2010 - 07:42
#2
Posté 12 juillet 2010 - 04:46
IIRC a recent developer post mentioned that SetLocation could result in a non-safe outcome.
To start a second script after the cutscene, I've been using the parameters of CS_LoadCutscene to set a plot flag at the end. The plot event script does the business. Works like a charm so far.
To start a second script after the cutscene, I've been using the parameters of CS_LoadCutscene to set a plot flag at the end. The plot event script does the business. Works like a charm so far.
#3
Posté 12 juillet 2010 - 12:59
Thanks, Proleric. I will give that a shot.
#4
Posté 12 juillet 2010 - 04:40
SetPhysicsController to false and use SetPosition. If it's still not working you may need to use a very short delayed event.
#5
Posté 13 juillet 2010 - 01:05
Proleric: that worked great. I have a feeling that's going to come in handy.
Craig: I haven't use SetPosition before and I'm a little confused by the wiki. Can you explain something to me?
//Put sitters back in their places
object oPatrond2 = GetObjectByTag("patrond2",0);
vector vPatrond2 = [1.0, 2.0, 3.0]; // coords from the wiki
SetPhysicsController(oPatrond2, 0); // allow unsafe placement
SetPosition(oPatrond2,vPatrond2,FALSE); //place dwarf patron 2
SetPhysicsController(oPatrond2, 1); // disallow unsafe placement
On setting the vector, the position I'm trying to get my NPC re-placed to is [10.3, -21.0, 0.0] and I had guessed that I merely had to place those in the brackets to get vPatrond2 set properly. However, the -21.0 gives me a "Parsing Constant Vector" error, so obviously I'm barking up the wrong tree, since Y=-21 is a valid location.
Can you or someone give me the quick version of what I'm doing wrong and how to SetPosition my dwarf back to [10.3, -21.0, 0.0]?
Thanks.
Craig: I haven't use SetPosition before and I'm a little confused by the wiki. Can you explain something to me?
//Put sitters back in their places
object oPatrond2 = GetObjectByTag("patrond2",0);
vector vPatrond2 = [1.0, 2.0, 3.0]; // coords from the wiki
SetPhysicsController(oPatrond2, 0); // allow unsafe placement
SetPosition(oPatrond2,vPatrond2,FALSE); //place dwarf patron 2
SetPhysicsController(oPatrond2, 1); // disallow unsafe placement
On setting the vector, the position I'm trying to get my NPC re-placed to is [10.3, -21.0, 0.0] and I had guessed that I merely had to place those in the brackets to get vPatrond2 set properly. However, the -21.0 gives me a "Parsing Constant Vector" error, so obviously I'm barking up the wrong tree, since Y=-21 is a valid location.
Can you or someone give me the quick version of what I'm doing wrong and how to SetPosition my dwarf back to [10.3, -21.0, 0.0]?
Thanks.
Modifié par BillHoyt, 13 juillet 2010 - 01:06 .
#6
Posté 13 juillet 2010 - 05:01
BillHoyt wrote...
vector vPatrond2 = [1.0, 2.0, 3.0]; // coords from the wiki
That's a mistery indeed. Any negative value leads to the Parsing constant vector error. Maybe you can try de following instead:
vector vPatrond2 = Vector(10.3f, -21.0f, 0.0f);
Modifié par _L_o_B_o_, 13 juillet 2010 - 05:04 .
#7
Posté 13 juillet 2010 - 07:59
Thanks, LOBO, that's progress. I got it to compile and run using that...
edit: but it was still calculating a 'safe' location. Anyhow, I switched from SetPosition to SetLocation to test it that way, and while I was testing, managed to make it work:
//Put Patron D2 back in her place
object oPatrond2 = GetObjectByTag("patrond2",0);
object oMainControlled = GetMainControlled();
SetPhysicsController(oPatrond2, FALSE);
location lPatrond2 = Location(GetArea(oMainControlled), Vector(10.4f, -21.0f, 0.0f), -90.0);
SetLocation(oPatrond2, lPatrond2);
I think now the main problem was turning the PhysicsController back on after
placement. So whether SetPosition or SetLocation is better I don't know. But it's working, so I'll leave well enough alone.
Thanks, all, for the help.
edit: but it was still calculating a 'safe' location. Anyhow, I switched from SetPosition to SetLocation to test it that way, and while I was testing, managed to make it work:
//Put Patron D2 back in her place
object oPatrond2 = GetObjectByTag("patrond2",0);
object oMainControlled = GetMainControlled();
SetPhysicsController(oPatrond2, FALSE);
location lPatrond2 = Location(GetArea(oMainControlled), Vector(10.4f, -21.0f, 0.0f), -90.0);
SetLocation(oPatrond2, lPatrond2);
I think now the main problem was turning the PhysicsController back on after
placement. So whether SetPosition or SetLocation is better I don't know. But it's working, so I'll leave well enough alone.
Thanks, all, for the help.
Modifié par BillHoyt, 13 juillet 2010 - 08:51 .
#8
Posté 13 juillet 2010 - 10:22
You weren't doing anything wrong: its a bug (at least as far as I'm concerned).BillHoyt wrote...
Can you or someone give me the quick version of what I'm doing wrong and how to SetPosition my dwarf back to [10.3, -21.0, 0.0]?
A vector literal is more typically used for setting default value of a parameter but there should be no reason (other than this bug) not to use it exactly as you are doing so. I've not checked they byte code but in theory it should be more efficient to use the literal than call a constructor when all the components are literal floats.
Anyway I've reported it as a bug and updated Lex.





Retour en haut






