Trigger Help
#1
Posté 11 octobre 2011 - 10:38
the first kind is a generic trigger. The trigger should close and lock a door, when the player enters the trigger. For that I set the ga_door_close script OnEnter and set two variables: sTag for the door tag and nLock = 1 in ther properties of the trigger. As Isaid before, the trigger do not work.
The other trigger I used was a start conversation trigger. I wrote a conversation and set the tag for the talking npc and the name of the conversation in the variables in the trigger properties.
That do not work neither. What did I do wrong?
#2
Posté 11 octobre 2011 - 11:04
#3
Posté 12 octobre 2011 - 12:44
To get them to work from a trigger with its own local variables, you'd have to get rid of the input variables from within the main() brackets and redefine them using GetLocalxxx functions.
So instead of this:
void main(string sTag)
{
// do something
}
You would have:
void main()
{
string sTag = GetLocalString(OBJECT_SELF, "VariableName");
// do something
}
#4
Posté 12 octobre 2011 - 07:54
But the second kind of trigger makes me nervous, because I cannot see, where the mistake is.
I placed the SpeakTrigger and unchecked the Onetimetrap (don´t know if this option is right - I use the german version, so I don´t know how to translate) and the trap disarming and checked TrapRecoverable in the properties of the trap. The Onenter script gtr_speak_node is set by default.
Now I put the following variables:
NPC_tag=(the tag of my npc)
Conversation=(Conversationfile name)
Node=0
Run=-1 (thought it would make the NPC stay, where he was placed=
TalkNow=1 (thought it would start the conversation immidiatly, without moving the NPC first)
Cutscenebars =0
OnlyOnce=0
MultiUse=1
CombatCutscene=0
I thought the trigger should be run like this, when the PC enters the trigger: The set conversation starts immidiatly and the NPC stays where he was placed. When the PC enters the trigger again, the conversation starts again, but it runs like this:
When the PC enters the trigger, the NPC moves slowly to the PC, then the conversation starts one time. When the conversation finished, the trigger does not work anymore. The NPC does not move anymore, no conversation starts.
What I wanted to do is, that if the player wants to leave the area and has a special item in his inventory, the conversation starts. For this I placed the trigger in front of the door that leads to the next area.
P.S. I ran the module as a campain, where I set the conversation distance to 999.
Modifié par Barnabas2, 12 octobre 2011 - 08:33 .
#5
Posté 12 octobre 2011 - 01:30
Barnabas2 wrote...
I thought the trigger should be run like this, when the PC enters the trigger: The set conversation starts immidiatly and the NPC stays where he was placed. When the PC enters the trigger again, the conversation starts again, but it runs like this:
When the PC enters the trigger, the NPC moves slowly to the PC, then the conversation starts one time. When the conversation finished, the trigger does not work anymore. The NPC does not move anymore, no conversation starts.
What I wanted to do is, that if the player wants to leave the area and has a special item in his inventory, the conversation starts. For this I placed the trigger in front of the door that leads to the next area.
P.S. I ran the module as a campain, where I set the conversation distance to 999.
If I gather what you are looking to do, it sounds like you need one conversation that will be the one called from the trigger.
The first RED NPC line of this conversation (the Root) should have a conditional check for the special item in the Player's inventory.
Then there should be a second RED NPC line, another Root, under this that would be when the PC enters the trigger without the item, presumably for the first time.
In this way, there will be a "Fall through" because the player doesn't have the item, and it will default to the second NPC Root. It looks like you have the trigger set to Multi-use, so it wil fire again when the PC enters it. And if he has the item, the conversation will fire from the first NPC Root, the one requiring the special item.
Again, these are both part of the same conversation, which will be the one attached to your trigger.
Also, on the NPC Root when the Player enters for the first time, you can also change the node property to "once per game", this way it will not display again, whether the PC has the item of not.
Finally, once you are completely finished with this NPC interaction and do not need the trigger anymore, you can also destroy the Speak Trigger.
Hopefully, that makes some sense.
#6
Posté 12 octobre 2011 - 02:47
With my understanding of the script, this should work with the variables I set.
#7
Posté 12 octobre 2011 - 09:27
#8
Posté 12 octobre 2011 - 11:46
For my initial problem with triggers ( a trigger, that should close and maybe lock a door, when the player enters the trigger) I tried to write a script:
void main (string sTag, int nLock)
{
object oPC = GetEnteringObject();
if (!GetIsPC(oPC)) return;
object oDoor = GetObjectByTag ( sTag );
DelayCommand ( 0.1, AssignCommand( oDoor, ActionCloseDoor( oDoor ) ) );
if ( nLock == 1 ) SetLocked( oDoor, TRUE );
}
I put the script as the OnEnter script of the trigger and set the variables sTag and nLock, but the script does not work. Every door stays open. What did I do wrong with the script?
#9
Posté 12 octobre 2011 - 11:56
/*
This is a basic trigger to allow jumping to locations.
The ladder has an onuse event which this is put in. The variable is put on the ladder trigger with
the name of "TG_LADDER_WP", this contains the tag of a waypoint. Entering the trigger moves the character
directly to the way point. Ideally the waypoint is set so it makes sense ( bottom of a hill, other side of a bridge, etc.
*/
//#include "_CSLCore_Environment"
void main()
{
object oPC = GetEnteringObject();
object oLadder = OBJECT_SELF;
string sWaypointName = GetLocalString( oLadder, "TG_LADDER_WP");
string sMessage = GetLocalString( oLadder, "TG_LADDER_MESSAGE");
object oWayPoint = GetObjectByTag( sWaypointName );
//SpeakString("Taking character to "+sWaypointName);
if ( GetIsObjectValid( oWayPoint ) )
{
location lWaypoint = GetLocation( oWayPoint );
lWaypoint = CalcSafeLocation( oPC, lWaypoint, 10.0f, FALSE, FALSE );
AssignCommand(oPC, JumpToLocation(lWaypoint));
if ( sMessage != "" )
{
SendMessageToPC( oPC, sMessage );
}
// this stuff i never got working properly, the companions just don't listen fast enough :)
object oPM = GetFirstFactionMember( oPC, FALSE );
while ( GetIsObjectValid( oPM ) == TRUE )
{
if ( GetMaster( oPM ) == oPC && GetDistanceBetween(oPM, oPC) < RADIUS_SIZE_ASTRONOMIC )
{
AssignCommand( oPM, ClearAllActions() );
AssignCommand( oPM, ActionForceMoveToLocation(GetLocation(oLadder), TRUE, 60.0f));
//if ( GetIsPlaceableObjectActionPossible(oLadder, PLACEABLE_ACTION_USE) )
//{
// AssignCommand( oPM, ActionInteractObject(oLadder)); // assuming this gets the pets to use the placeable
//AssignCommand( oPM, ActionDoCommand(ExecuteScript("TG_Ladder_OnUse", oPM)));
//}
}
oPM = GetNextFactionMember( oPC, FALSE );
}
}
}
Modifié par painofdungeoneternal, 12 octobre 2011 - 11:56 .
#10
Posté 13 octobre 2011 - 01:11
void main ()
{
object oPC = GetEnteringObject();
object oDoor = GetObjectByTag ( "sTag" );
string sTag = GetLocalString ( oDoor, "" );
int nLock = GetLocalInt (oDoor, "" );
if (!GetIsPC(oPC)) return;
DelayCommand ( 0.1, AssignCommand( oDoor, ActionCloseDoor( oDoor ) ) );
if ( nLock == 1 ) SetLocked( oDoor, TRUE );
}
I know, it won´t work - tried it yet - but I want to understand why.
And what do I have to set, if I want a trigger to fire everytime the PC enters?
#11
Posté 13 octobre 2011 - 03:05
void main ()
{
object oPC = GetEnteringObject();
string sTag = GetLocalString (OBJECT_SELF, "sTag" );// get string variable from trigger
int nLock = GetLocalInt (OBJECT_SELF, "nLock" );// get int variable from trigger
object oDoor = GetObjectByTag(sTag);
if (!GetIsPC(oPC)) return;
DelayCommand ( 0.1, AssignCommand( oDoor, ActionCloseDoor( oDoor ) ) );
if ( nLock == 1 ) SetLocked( oDoor, TRUE );
}
#12
Posté 13 octobre 2011 - 11:38
#13
Posté 13 octobre 2011 - 02:55
#14
Posté 13 octobre 2011 - 10:04





Retour en haut






