Problem using NW_FLAG_SPECIAL_CONVERSATION
#1
Posté 30 avril 2012 - 12:47
Thanks.
#2
Posté 30 avril 2012 - 01:57
#3
Posté 30 avril 2012 - 02:19
the constant is dealt with inside that script, or you can just apply it there.
#4
Posté 30 avril 2012 - 07:06
#5
Posté 30 avril 2012 - 07:54
#6
Posté 01 mai 2012 - 12:12
The interesting thing is that when I made a copy of nw_c2_default2 and replaced:
ActionStartConversation(OBJECT_SELF);
with:
SpeakOneLinerConversation();
it worked perfectly! The floater string appeared almost as soon as the PC was perceived. Hmm...
Well almost perfectly. It's using the NPC's tokens rather than the PC's. Guess I'll have to get by without the tokens.
Modifié par rjshae, 01 mai 2012 - 12:24 .
#7
Posté 01 mai 2012 - 12:25
#8
Posté 01 mai 2012 - 01:25
rjshae wrote...
I'm trying to get an NPC to generate a float string when he perceives the PC, so I spawn the NPC with the NW_FLAG_SPECIAL_CONVERSATION flag set to 1. The perception script seems to work okay, calling ActionStartConversation with the object set to itself. However, the floating string doesn't appear, even when I'm not calling nw_d2_gen_check for the condition. The conversation does work because it activates when I click on the NPC. Does anybody know why this isn't working?
The way one sets these flags is confusing. It is not by storing a local int called "NW_FLAG_SPECIAL_CONVERSATION" with value = 1.
Take a look at x0_i0_spawncond. I cannot remember how this traces back to the OnPerceive handler but I seem to recall that it does. This script is where the spawn-in condition constants and functions are defined.
Take a look at GetSpawnInCondition, which is called in the OnPerceive:
// Returns TRUE if the specified condition has been set on the
// caller, otherwise FALSE.
int GetSpawnInCondition(int nCondition)
{
int nPlot = GetLocalInt(OBJECT_SELF, sSpawnCondVarname);
if(nPlot & nCondition)
{
return TRUE;
}
return FALSE;
}
The variable name this checks is defined at the start of the script: "NW_GENERIC_MASTER". Then it checks whether the integer stored in this variable bit-wise contains the flag you are asking about. The value of these flags is set right below NW_GENERIC_MASTER.
So, if you want the creature to have a special combat conversation and no other spawn-in conditions, you set a variable called "NW_GENERIC_MASTER" = 0x00040000 (which the toolset converts automatically to 262144. If you wanted others, you'd add those to 262144.
I'm a little fuzzy on the bitwise math, but everything else here is pretty solid.
#9
Posté 01 mai 2012 - 03:48
#10
Posté 01 mai 2012 - 04:31
SPAWN IN BEHAVIOR HEXIDECIMAL DECIMAL EXAMPLE ------------------------------------------------------------------------------- NW_FLAG_SPECIAL_CONVERSATION = 0x00000001; 1 0 NW_FLAG_SHOUT_ATTACK_MY_TARGET = 0x00000002; 2 0 NW_FLAG_STEALTH = 0x00000004; 4 1 NW_FLAG_SEARCH = 0x00000008; 8 0 NW_FLAG_SET_WARNINGS = 0x00000010; 16 0 NW_FLAG_ESCAPE_RETURN = 0x00000020; 32 0 NW_FLAG_ESCAPE_LEAVE = 0x00000040; 64 0 NW_FLAG_TELEPORT_RETURN = 0x00000080; 128 0 NW_FLAG_TELEPORT_LEAVE = 0x00000100; 256 0 NW_FLAG_PERCIEVE_EVENT = 0x00000200; 512 0 NW_FLAG_ATTACK_EVENT = 0x00000400; 1024 0 NW_FLAG_DAMAGED_EVENT = 0x00000800; 2048 0 NW_FLAG_SPELL_CAST_AT_EVENT = 0x00001000; 4096 0 NW_FLAG_DISTURBED_EVENT = 0x00002000; 8192 0 NW_FLAG_END_COMBAT_ROUND_EVENT = 0x00004000; 16384 0 NW_FLAG_ON_DIALOGUE_EVENT = 0x00008000; 32768 0 NW_FLAG_RESTED_EVENT = 0x00010000; 65536 0 NW_FLAG_DEATH_EVENT = 0x00020000; 131072 0 NW_FLAG_SPECIAL_COMBAT_CONVERSATION = 0x00040000; 262144 0 NW_FLAG_AMBIENT_ANIMATIONS = 0x00080000; 524288 0 NW_FLAG_HEARTBEAT_EVENT = 0x00100000; 1048576 0 NW_FLAG_IMMOBILE_AMBIENT_ANIMATIONS = 0x00200000; 2097152 0 NW_FLAG_DAY_NIGHT_POSTING = 0x00400000; 4194304 0 NW_FLAG_AMBIENT_ANIMATIONS_AVIAN = 0x00800000; 8388608 0 NW_FLAG_APPEAR_SPAWN_IN_ANIMATION = 0x01000000; 16777216 0 NW_FLAG_SLEEPING_AT_NIGHT = 0x02000000; 33554432 0 NW_FLAG_FAST_BUFF_ENEMY = 0x04000000; 67108864 1
#11
Posté 01 mai 2012 - 05:20
if (GetLocalInt(oCreature, "X2_L_SPAWN_USE_SEARCH") == TRUE)
{
SCSetSpawnInCondition(CSL_FLAG_SEARCH);
}
This abstracts back what is going on, from the more advanced methods the computer prefers, to something more convenient for end users. Pretty easy to adjust that script as well, think the specific constant would have to be added to the spawn script. Generally i try to set bits in script and not in the toolset, just because it's hard to read after you come back to it 6 months later. ( even though the first bit being set is always odd which is a nice short cut )
#12
Posté 01 mai 2012 - 07:28
painofdungeoneternal wrote...
It's bit based, the on spawn script sets the bit and translates what the toolset person who has no idea what bits are ( via a function in the onspawn script ). You should look for the on spawn script and see how it's setting things - you figured out what it's doing, but there is a system for getting those bits set up initially.
Yes, that is what I am doing -- setting the special conversation flag by uncommenting an entry in the custom On Spawn script. That part is working okay because it is following the appropriate branch of the standard On Perceive script. I just wonder if there is a problem with the ActionStartConversation routine. I tried customizing it with the various options, but that didn't seem to help.
Modifié par rjshae, 01 mai 2012 - 07:30 .





Retour en haut







