Hey dudes,
I want to create triggers that force specific camera angles at specific momentsof my module (I want to force the camera to be behind the player at certain moments). I came out with this script, using lillacs soul, but it isnt working. I even put a floattextstring at the end of the script to check if the script is been read. The message is displayed, but the camera doesnt go where I need it to go. I directed the script to a waypoint named "forefront", put where I want the player to look at.
The script is the following
/* Script generated byLilac Soul's NWN Script Generator, v. 2.3
For download info, please visit:http://nwvault.ign.com/View.php?view=Other.Detail&id=4683&id=625 */
//Put this script OnEntervoid main(){
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
object oTarget;oTarget = GetObjectByTag("forefront");
AssignCommand(oPC, SetFacingPoint(GetPosition(oTarget)));
FloatingTextStringOnCreature("its been read", oPC);
}
Any idea?
Problem with script - script to make player face waypoint
Débuté par
el.sombrero
, mai 16 2012 09:21
#1
Posté 16 mai 2012 - 09:21
#2
Posté 16 mai 2012 - 09:31
Try GetWaypointByTag("forefront")
Also you never mentioned if this was for a cutscene or not - that is pretty much the only time the camera can be controlled.
Also too, you never "Get" the camera. If you simply just want the player to face a certain direction then the first suggestion might help...
Lastly you might even try to use a placeable iPoint rather than a waypoint - then it would be GetObjectBYTag("forefront"); (I think)
Also you never mentioned if this was for a cutscene or not - that is pretty much the only time the camera can be controlled.
Also too, you never "Get" the camera. If you simply just want the player to face a certain direction then the first suggestion might help...
Lastly you might even try to use a placeable iPoint rather than a waypoint - then it would be GetObjectBYTag("forefront"); (I think)
Modifié par Morbane, 16 mai 2012 - 09:33 .
#3
Posté 16 mai 2012 - 11:24
You can also try the 'golden rule' of assigning a creature or PC an action - ALWAYS ClearAllActions() first. Otherwise your scripted actions are likely to succeed only some of the time.
#4
Posté 18 mai 2012 - 07:09
Where and how do I input the "Clear AllActions"? Would it be something like:
OnEntervoid main(){
ClearAllActions()
object oPC = GetEnteringObject();
????
OnEntervoid main(){
ClearAllActions()
object oPC = GetEnteringObject();
????
#5
Posté 18 mai 2012 - 07:15
By the way, it isnt a cutscene... cant I force the camera to rotate (so its positioned behind the players avatar) outside a cutscene?
#7
Posté 18 mai 2012 - 07:32
Hey, problem solved. Kevl (thx dude!) helped out with this script.
void main()
{
if (GetLocalInt(OBJECT_SELF, "bDone")) return;
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
// from 'x0_inc_generic' GetIsFighting()
object oAttack = GetAttemptedAttackTarget();
object oSpellTarget = GetAttemptedSpellTarget();
if (GetIsObjectValid(oAttack) || GetIsObjectValid(oSpellTarget)) return;
AssignCommand(oPC, ClearAllActions());
SetLocalInt(OBJECT_SELF, "bDone", TRUE);
object oTarget = GetObjectByTag("kg001_ct_dov");
// from 'ginc_cutscene' SetCameraFacingPoint()
vector vPC = GetPosition(oPC);
vector vTarget = GetPosition(oTarget);
// this gives us a vector pointing from PC to Target
vector vDifference = vTarget - vPC;
// we just need the angle of that vector
float fDirection = VectorToAngle(vDifference);
AssignCommand(oPC, SetFacingPoint(vTarget));
AssignCommand(oPC, SetCameraFacing(fDirection, 6.f, 85.f,
CAMERA_TRANSITION_TYPE_FAST));
SendMessageToPC(GetFirstPC(FALSE), ". Camera facing theDove, done");
}
void main()
{
if (GetLocalInt(OBJECT_SELF, "bDone")) return;
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
// from 'x0_inc_generic' GetIsFighting()
object oAttack = GetAttemptedAttackTarget();
object oSpellTarget = GetAttemptedSpellTarget();
if (GetIsObjectValid(oAttack) || GetIsObjectValid(oSpellTarget)) return;
AssignCommand(oPC, ClearAllActions());
SetLocalInt(OBJECT_SELF, "bDone", TRUE);
object oTarget = GetObjectByTag("kg001_ct_dov");
// from 'ginc_cutscene' SetCameraFacingPoint()
vector vPC = GetPosition(oPC);
vector vTarget = GetPosition(oTarget);
// this gives us a vector pointing from PC to Target
vector vDifference = vTarget - vPC;
// we just need the angle of that vector
float fDirection = VectorToAngle(vDifference);
AssignCommand(oPC, SetFacingPoint(vTarget));
AssignCommand(oPC, SetCameraFacing(fDirection, 6.f, 85.f,
CAMERA_TRANSITION_TYPE_FAST));
SendMessageToPC(GetFirstPC(FALSE), ". Camera facing theDove, done");
}





Retour en haut







