Script questions
#1
Posté 05 octobre 2011 - 10:33
#2
Posté 05 octobre 2011 - 11:41
Globals can be accessed from anyone at any point in the game (even cross-module, I think).
#3
Posté 05 octobre 2011 - 11:51
#4
Posté 05 octobre 2011 - 12:08
#5
Posté 05 octobre 2011 - 07:59
Barnabas2 wrote...
So for example, if I want that a NPC remembers the playerchar after the 1st conversation, I have to set the local int?
Yes, typically I think that globals are good for plot status tracking; locals are useful for individual or area-specific interactions.
#6
Posté 13 octobre 2011 - 10:11
void main()
{
object oPC = GetLastUsedBy();
string NPC_Tag = GetLocalString (OBJECT_SELF, "NPC_Tag");
string oconversation = GetLocalString (OBJECT_SELF, "oconversation")
if (!GetIsPC(oPC)) return;
object oTarget;
oTarget = GetObjectByTag("NPC_Tag");
oconversation = ?????
AssignCommand(oTarget, ActionStartConversation(oPC, "oconversation"));
}
The problem I have so far is, that I don´t know how to include a variable for the conversation, because I want to use the script on different places with different conversations....
What I do not understand: how can I get the conversationfile, becuse the conversation will be get by the filename and not by the tag...
EDIT: Ok, the script looks like this now:
void main()
{
object oPC = GetLastUsedBy();
string NPC_Tag = GetLocalString (OBJECT_SELF, "NPC_Tag");
string sConversation = GetLocalString (OBJECT_SELF, "sConversation");
if (!GetIsPC(oPC)) return;
object oTarget;
object oconversation;
oTarget = GetObjectByTag("NPC_Tag");
oconversation = GetObjectByTag ("sConversation");
AssignCommand(oTarget, ActionStartConversation(oPC, "oconversation"));
}
I set it as the OnUse script of a door and set the variables NPC_Tag and sConversation in the door properties and as expected it didn´t work :-(
Modifié par Barnabas2, 13 octobre 2011 - 11:21 .
#7
Posté 13 octobre 2011 - 11:32
AssignCommand(oTarget, ActionStartConversation(oPC, "name of conversation file here"));
This will make the object play the convo file specified.
Doors are a bit different than other placeable type things since they default to being opened/closed/transition when used, try putting the script in the OnLeftClick slot instead.
#8
Posté 13 octobre 2011 - 11:40
_Knightmare_ wrote...
First off, a converstaion is not an "object" - objects are those things you can physically place down or manipulate in a toolset area (creatures, placeables, triggers, waypoints, items, etc.). Change you one line to this:
AssignCommand(oTarget, ActionStartConversation(oPC, "name of conversation file here"));
This will make the object play the convo file specified.
Doors are a bit different than other placeable type things since they default to being opened/closed/transition when used, try putting the script in the OnLeftClick slot instead.
Thanks for the fast answer, I´ll try that, but do I have to modify the line
object oPC = GetLastOpenedBy();
too?
And am I able to set the conversation as a variable, so that I can use the script on other doors and with with other conversations too?
#9
Posté 13 octobre 2011 - 10:15
You can have the script use a string variable to define the conversation name. Just make sure you don't enclose the string variable in quotes inside ActionStartConversation. In the script above, it would be:
AssignCommand(oTarget, ActionStartConversation(oPC, sConversation));
#10
Posté 14 octobre 2011 - 07:37
#11
Posté 14 octobre 2011 - 03:01
#12
Posté 14 octobre 2011 - 03:26
#13
Posté 14 octobre 2011 - 06:47
#14
Posté 14 octobre 2011 - 07:05
Then you need to implement a way to block resting entirely, and make an exception when your given flag is set.
How to do this is basically described here
Modifié par painofdungeoneternal, 14 octobre 2011 - 07:06 .
#15
Posté 15 octobre 2011 - 03:47
#16
Posté 15 octobre 2011 - 08:40
Morbane wrote...
You can also put a script in the bed onused event with ForceRest() being called in it
I´m experimenting with this command yet, and it works well, but I´m faced with, what I think, the main problem for everyone, who´s experimanting with sleepable beds. How am I able to place the char into the bed. Until now I´ve made the following script:
void main()
{
object oPC = GetLastUsedBy();
string oWP = GetLocalString (OBJECT_SELF, "oWP");
object oWayP = GetObjectByTag (oWP);
if (!GetIsPC(oPC)) return;
AssignCommand(oPC, ClearAllActions());
AssignCommand(oPC, JumpToObject(oWayP));
DelayCommand(1.0, AssignCommand(oPC, PlayAnimation(ANIMATION_LOOPING_DEAD_FRONT, 1.0, 99999.0)));
AssignCommand(oPC, SpeakString("Ihr ruht euch nun aus."));
DelayCommand(2.0, SetCommandable(FALSE, oPC));
DelayCommand(25.0, AssignCommand(oPC, ForceRest(oPC)));
DelayCommand(25.1, AssignCommand(oPC, SpeakString("Ihr seid nun ausgeruht.")));
DelayCommand(24.8, SetCommandable (TRUE, oPC));
}
With the JumptoObject Command, I tried to place the char onto the bed, but he jumps into the bed and lays down at the floor. Then I tried to place the char on a static object. Unfortunally it doesn´t work neither. No I ask myself if it is possible, to let the player hover?
EDIT:
I got it!
Here
Modifié par Barnabas2, 15 octobre 2011 - 09:41 .
#17
Posté 16 octobre 2011 - 10:13
#18
Posté 17 octobre 2011 - 12:32
#19
Posté 17 octobre 2011 - 01:13
#20
Posté 17 octobre 2011 - 01:46





Retour en haut






