Ir al contenido

Foto

Created PC (On Perceive) Not Firing! - (SOLVED: Typo in the 2da)


  • Por favor identifícate para responder
5 respuestas en este tema

#1
Lance Botelle

Lance Botelle
  • Members
  • 1.480 mensajes

Hi All,

I was doing a little AI tidying when I noticed that two of my companions (that I created/imported) at build time do not appear to fire their attached "On Perceived" script.

The weird thing is, they have the *exact* same set of scripts attached to them as companions who are added during the game. Doing EventHandler debug feedback also confirms these scripts are correctly attached!

However, it is as if the created PCs do not "fire" their On Perceived script. All debug feedback/code is ignored. Even though, they do appear to close for combat when they see an enemy. (This is actually the part I am trying to edit.)

 

As far as I am aware, it is just the On Perceived that is not firing from the set attached to them, as their heartbeat script works OK, and I have not checked/noticed any problems elsewhere at the moment.

 

Any feedback welcome. (Can anybody confirm the same or not in their own module so that I can narrow down my own search.)

 

Cheers,

Lance.
 



#2
kevL

kevL
  • Members
  • 4.052 mensajes
hey Lance,

if you're *controlling* the character that you're debugging, it should not fire any AI-events other than heartbeat and death ... (and userdefined).

Change player-control away from that character and the rest of its AI should fire again, sound right?

#3
Lance Botelle

Lance Botelle
  • Members
  • 1.480 mensajes

hey Lance,

if you're *controlling* the character that you're debugging, it should not fire any AI-events other than heartbeat and death ... (and userdefined).

Change player-control away from that character and the rest of its AI should fire again, sound right?


Hi KevL,

Unfortunately, that's not the problem .... :(

I am talking about the "created PCs" that are tagging along beside me. e.g. I have a party of five, my Main PC, two created at the time of module entry and two other companions that I have picked up since entering the mod.

I understand that the Main PC (the one I am controlling) will not have the scripts fire, but I was expecting all the others to do so. However, even though every other "companion" has the same scripts attached, only the two that joined later (not the ones created at the module entry) will fire their scripts (On Perceived) in the test. The other two don't.

It's really strange, and I cannot determine why these PCs are NOT firing their On Perceived scripts, whereas the other two are.

Cheers,
Lance.

#4
kevL

kevL
  • Members
  • 4.052 mensajes
that *is* odd,

as far as I'm aware a CreatedChar (as a game-object) is identical to a companion-object. Except it has a "created" flag set TRUE ( GetIsPlayerCreated() ).


I'm going to say something completely irrelevant ... you might search around for a script called gr_pc_spawn -- it fires whenever control shifts away from the OwnedPC. The default (in Scripts.zip) simply sets listening patterns, etc. for when the player isn't controlling the main PC.

And, to clear this up, when you say On Perceived ... do you really mean On Perception ? Because i don't think there technically is an OnPerceived event per se.
 

... even though every other "companion" has the same scripts attached, only the two that joined later (not the ones created at the module entry) will fire their scripts (On Perceived) in the test. The other two don't.

It's really strange, and I cannot determine why these PCs are NOT firing their On Perceived scripts, whereas the other two are.


So it doesn't matter what scripts they have, if the *event itself* is not firing. If so that's lower-level than a 'script' problem; did you try attaching test script, such as
 
// 'test_on_perception'
void main()
{
    string sEvent = GetEventHandler(OBJECT_SELF, CREATURE_SCRIPT_ON_NOTICE);
    if (sEvent == "test_on_perception")
        sEvent = ". event fired: this [" + sEvent + "]";
    else
        sEvent = ". event fired: NOT this [" + sEvent + "]";

    SendMessageToPC(GetFirstPC(FALSE), sEvent);
}


#5
Lance Botelle

Lance Botelle
  • Members
  • 1.480 mensajes

Hi KevL,

Thanks for sticking in here with me. :)

I thought that they were identical too ... apart from the variable difference.

I mean the "On Perception Script" hook, which I thought related to when the PC noticed something either by seeing or hearing. Basically, I have a script called "alb_comp_percep", which is attached to the "ScriptOnNotice", when checked in the scriptsets.2da.

Wait a minute!

Aha! While writing this response to you going into more detail, I noticed my mistake (if you pardon the pun). I had "alb_comp_percep" in the scriptsets.2da and NOT "alb_comp_perception". A typo!

I updated the scriptsets.2da to point to the correct script and all now works as expected!

Thanks for sticking with me on this one KevL. The typo would explain it was so difficult for me to notice!

Cheers,
Lance.



#6
kevL

kevL
  • Members
  • 4.052 mensajes

cat4_kittenpounce.jpg
... a typo!


  • A Lance Botelle le gusta esto