Aller au contenu

Photo

Cannot I apply a disease to the PC?


  • Veuillez vous connecter pour répondre
38 réponses à ce sujet

#1
andysks

andysks
  • Members
  • 1 645 messages

Through a convo. It drives me nuts at the moment. I tried the ga_effect. Tried lilacs. Tried my own script. Nothing works. The only one that comes a bit close is ga_effect, but doesn't apply it, it only creates the visual effect. I thought it's a way to start, so I played with the params.

So far I tried putting 8 as disease, as well as "DISEASE_SHAKES".

Leaving the target as blank, as well as specifying $PC.

Different types of disease.

Duration temporary with T,600.0f

Too much? , tried T,30.0f

Tried Permanent

 

Nothing seems to work :).

 

Further than that, I wanted to apply it to the whole party. But if the PC doesn't work... well forget about the party, lol.



#2
kevL

kevL
  • Members
  • 4 052 messages
play around with this, if you like

 
// 'ga_disease_kl'
//
// kevL 2014 may 14a
//
// Applies a disease to a Creature and/or its faction.
//      - sTarget:      tag of target. If blank, PCSpeaker is used.
//                      Accepts 'ginc_param_const' strings.
//      - iDisease:     a DISEASE_* constant from nwscript.nss (0..16)
//      - iDuration:    duration in seconds
//      - bFaction:     0= Target only; 1= Target + its faction.

#include "ginc_param_const"
#include "nw_i0_spells"


void main(string sTarget, int iDisease, int iDuration, int bFaction)
{
    object oPC = GetPCSpeaker();
    if (sTarget != "")
        oPC = GetTarget(sTarget);

    effect eDisease = EffectDisease(iDisease);
    eDisease = ExtraordinaryEffect(eDisease);

    float fDuration = IntToFloat(iDuration);

    if (bFaction)
    {
        float fDelay;

        object oFM = GetFirstFactionMember(oPC, FALSE);
        while (GetIsObjectValid(oFM))
        {
            fDelay = GetRandomDelay(0.5f, 2.f);
            DelayCommand(fDelay, ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDisease, oFM, fDuration));

            oFM = GetNextFactionMember(oPC, FALSE);
        }
    }
    else
    {
        ApplyEffectToObject(DURATION_TYPE_TEMPORARY, eDisease, oPC, fDuration);
    }
}

onEdit: made the disease Extraordinary so it can't be dispelled magically.

Modifié par kevL, 14 mai 2014 - 06:01 .


#3
andysks

andysks
  • Members
  • 1 645 messages

Hmm it doesn't work. Don't know why.

Params used: "$PC", "8", "520", "1"

Second test: "", "8", "60", "1"

 

Interestingly, on the same convo one more of the script you provided me seemed to fail which is quite rare for your scripts I have to say :).

The gc_rollsave. If you remember, I have used this script for will saves with great success, but this time for fortitude it failed.

I worked around it by making a constitution check instead. So the real problem is the disease. It creates a headache... Just get sick dammit !



#4
kevL

kevL
  • Members
  • 4 052 messages

just re-tested the script, both on a PC-node and an NPC-node -- both worked ok w/ "", 8, 60, 1

- don't use quotes in dialog fields, right?


the gc_rollsave script is extremely simple and not a whole lot can go wrong there. If both scripts are failing on a single convo, methinks something wrong w/ convo -.-



#5
andysks

andysks
  • Members
  • 1 645 messages

I will test it more later today. I thought something else is wrong, but mainly because as I said, your scripts are extremely reliable. Do you maybe think it matters that no NPC is around to be the onwer and it all happens from an ipoint owner, or maybe that the trigger for the convo fires as such?

 

#include "ginc_trigger"


void main ()
{
    object oPC = GetEnteringObject();


    DoSpeakTrigger(oPC);
    DelayCommand(3.0f, DestroyObject(OBJECT_SELF));
}

 

Will see when I get home. Just a hint. I thought I'd use gtr_speak_node because it's there and easy to place, and the convo forced and non-missable... let's say. It didn't fire, therefore I made the above. Probably a place to start looking :).



#6
kevL

kevL
  • Members
  • 4 052 messages

I wouldn't/ don't think the IPSpeaker is at issue. I mean, PCSpeaker is PCSpeaker ...

the script doesn't refer to Conversation_Owner unless somebody puts in "$OWNER" or "$OBJECT_SELF" -- in which case it'd try to disease the iPoint ... but we're not doin' that.


perhaps a test with a regular NPC with a regular conversation assigned to its Properties>Conversation-slot is in order warrented,



#7
andysks

andysks
  • Members
  • 1 645 messages
That will be my next test. But I don't use ipspeaker just an ipoint placeable as owner.

#8
kevL

kevL
  • Members
  • 4 052 messages

you mean ... there's no NPC *at all* ???

just an iPoint?



#9
andysks

andysks
  • Members
  • 1 645 messages
Jup. It generally works assigning the convo to it. But I cannot recall if I ever used scripts as well in such convos except ga_jump_players.

#10
kevL

kevL
  • Members
  • 4 052 messages

oh, this might be interesting: Are you aware that the default iPoint blueprint has a space at the end of its resource name?

"plc_ipoint "


its tag "PLC_IPOINT" appears to be normal.



#11
kevL

kevL
  • Members
  • 4 052 messages

and can you fill me in on the parameters you're using on the trigger, so i can replicate it



#12
kevL

kevL
  • Members
  • 4 052 messages

and, this might sound silly but, why don't you just use an onenter script..?



#13
kevL

kevL
  • Members
  • 4 052 messages

ok so i set it all up using an iPoint & speakTrigger.

works fine here. For a moment i thought the issue was deleting the trigger, but since it's the iPoint that runs the script, and my using your speakTrigger deletion script still didn't stop things, it's not that. Actually, the first time i ran it this way not even a dialog happened, but when I reloaded the game from scratch it worked flawlessly twice in a row, but it did lead me to think that maybe you've got a sort of rubber-banding issue at your trigger, and sometimes triggers just refuse to fire.

But if your dialog appears then it's not that .....

 

 

Calen talking to invisible iPoint ( pillar marks the trigger )

http://s26.postimg.o...ga_Disease3.jpg



#14
Tchos

Tchos
  • Members
  • 5 030 messages

One thing to know about assigning a generic ipoint as the owner of a conversation is that when it speaks, its name will be "Ipoint", even if you change its name in the Name field, because it has a String Ref attached which overrides what you type in that field.  You would need to clear the string ref from the placed instance, or do as I did and create a copy of the blueprint with the string ref removed (and while you're at it, remove that extra space at the end of the resref).

 

However, I almost never find the need to assign an ipoint as the owner of a conversation, except when it's standing in for an NPC that is dying during the conversation.



#15
rjshae

rjshae
  • Members
  • 4 478 messages

I just do a:

const string EC_NAME = "<c=#8e8e8e>Some name</c>"; // Name to show player
const string IPOINT = "plc_ipoint "; // Note the extra space at the end

object oIpoint = CreateObject( OBJECT_TYPE_PLACEABLE,
  IPOINT, locTarget );

if ( GetIsObjectValid( oIpoint ) ) {
  SetFirstName( oIpoint, EC_NAME );

and it uses that name.


  • Tchos aime ceci

#16
Tchos

Tchos
  • Members
  • 5 030 messages

I'll add that method to my arsenal.  I'd still keep an extra blueprint of the ipoint without the space just in case of any scripts that mistakenly leave it out, though.



#17
kevL

kevL
  • Members
  • 4 052 messages

andy,

is your iPoint non-static, have hitpoints, and all whatever's needed to run a script from?



#18
andysks

andysks
  • Members
  • 1 645 messages

OK work got in the middle but now have some time to reply. For clarification: I use these ipoint, because I just found out that they work. What I do, is build an area, then while populating if I need a simple convo like a DM speaking, saying at the end "What do you do" or "You get sucked through the whole you peeked in" etc, , I place one of these, name it DM and tag it accordingly and trigger the convo. Never failed to trigger a convo. Never.

 

At the problem.

 

An NPC solved it. So I guess I have to eat the "Never" from above :). I don't know why, but script like ga_jump_players has worked in such a convo with the ipoint, gc_rollsave_kl and ga_disease didn't.

The ipoint had hp and non static and generally looks very healthy.

Since this worked, I can place an NPC on a tile outside the picture playing the DM. But still... why did the ipoint worked for you? That's the real question.

 

On a note. If I fail my save KevL, and wait a couple of seconds the PC makes a successful save as well resulting in not getting diseased. If I fail and quickly press continue to get pass the checks he contracts the disease. Didn't test why but as I write I think I know it. For testing purposes I put the rollsave script on both nodes, one with Yes and one with Not. I guess if I only put one with Not for the fail it will work as intended. I remember the previous time I used it this was the reason causing a double roll.



#19
andysks

andysks
  • Members
  • 1 645 messages

Don't need to wait for a reply. Second check was for the disease itself. I set my DC on the script as 25, high enough to kick in anyway and see if it works. Second check is 13 on the chat. So I guess it is from the disease itself. Nothing to do there :).



#20
kevL

kevL
  • Members
  • 4 052 messages

disease.2da has ( its own ) SaveDC and damage info.



#21
andysks

andysks
  • Members
  • 1 645 messages

I figured :).

 

Further testing revealed the actual problem I think. The convo that worked, worked by me talking to a commoner. Then I thought I make this testing commoner the owner and fire it with a trigger. Same trigger as before. Not. Convo worked, scripts didn't fire. I changed the script to such :

 

void main()
{
object oPC = GetFirstPC();
    object oEntering = GetEnteringObject();

    if(oPC != oEntering)
        return;
        
        
    object iPointSpeaker = GetObjectByTag("rw_enter_speaker");
    DelayCommand(2.0f, AssignCommand(oPC, ActionStartConversation(iPointSpeaker, "rw_enter", FALSE, FALSE, TRUE, FALSE)));
    DelayCommand(3.0f, DestroyObject(OBJECT_SELF));
}

 

All scripts fired. So I guess my ginc_trigger is bugged for some reason. I think the DoSpeakTrigger and it's variables? Something. Doesn't fire scripts.

 

p.s: On the above script the object iPointSpeaker is just a placed ipoint. Only the object is called like that so that I know who speaks.



#22
kevL

kevL
  • Members
  • 4 052 messages
note that this line
 
DelayCommand(2.0f, AssignCommand(oPC, ActionStartConversation(iPointSpeaker, "rw_enter", FALSE, FALSE, TRUE, FALSE)));
should be
 
DelayCommand(2.0f, AssignCommand(iPointSpeaker, ActionStartConversation(oPC, "rw_enter", FALSE, FALSE, TRUE, FALSE)));
ie, tell the ipSpeaker to start a conversation w/ PC (though yeh i seem to recall it 'works' either way ) What this means here is that scripts are running with oPC==Object_Self, rather than iPointSpeaker==Object_Self

which may point to the iPoint OBJECT being the culprit rather than scripting. TEST: do my suggested change there and see if the script still fires.

[edit] Object_Self is iPoint either way, looks like.



btw, Good catch on oPC / oEntering. But I don't think it should be formed quite like you have it there. That is, if Player is controlling a companion and dragging the PC along behind, the dialog will try to fire up when the uncontrolled PC enters the trigger. That might or might not work depending ... DoSpeakTrigger() actually looks pretty good at doing the necessary handling however. I'd just go with the standard
 
if (!GetIsPC(oEnter)) return;
/ymmv.

Modifié par kevL, 16 mai 2014 - 03:33 .


#23
andysks

andysks
  • Members
  • 1 645 messages
So the DoSpeakTrigger is the one that could cause problems. This was probably the last time that I would try to usexthe functions of the speak trigger. Better custom scripts.
The change on the entering object you have there... will it cause the triggercto fire with a companion?

#24
kevL

kevL
  • Members
  • 4 052 messages


The change on the entering object you have there... will it cause the triggercto fire with a companion?


( if the companion is controlled ) yep, that's the point. If your NPC + dialog are set up to talk to companions, or your campaign is set to use SoZ dialog, this is what you'd want to happen. Or if using DoSpeakTrigger() then player-control is passed automatically to a character able to talk -- often the Owned PC. If not done right, this gives rise to the warping wizard to the front rank, that we've been complaining about here and there on the forum recently. The engine itself will also handle some of this.

Yes, NwN2 made Conversations very confusing by introducing the ability to control any of several characters. Kaldor and I are at least 2 competent scripters who've banged our heads against it for months. Personally i think I can figure things out on a case-by-case basis, and I believe Tchos vouches for the integrity of many of the stock dialog scripts that handle things, CreateIPSpeaker() in particular. ( so do i ) EE in fact started a whole thread on this, asking for a "bullet proof" dialog startup.

iirc, there was no firm conclusion. So, KISS (and stock scripts) are best until a glitch shows up.


So the DoSpeakTrigger is the one that could cause problems.


yes it could be. But since i can't replicate the problem your module has I'm at a loss. It might be in campaign settings (doubt it highly), it might be a faulty #include in .Hak or Override (doubt it), it might be the iPoint or trigger values (also unlikely -- if the conversation fires up, the script should fire up).

So ... you say the ga_disease script fires up if ActionStartConversation() is called from the trigger itself. That is, bypassing DoSpeakTrigger(). ( note: if you do that you're going to have to be especially careful with the early-return conditions for the trigger's onEnter event, because as I said if the player isn't controlling GetFirstPC() when the party crosses the trigger i think it's going to fail )

( and DestroyObject() isn't the most graceful way to cope with potential future errors; there are numerous other ways, from simply setting it done to flagging it done from the conversation's last node )


This was probably the last time that I would try to usexthe functions of the speak trigger. Better custom scripts.


uh, maybe. If you look at DoSpeakTrigger(), the "!bDoNotChangePlayer" section, and think you can handle that better than they did .....

/shrug.

But what you really want to do is simply find out why DoSpeakTrigger() is failing when ActionStartConversation() isn't

do you want me to paste a copy of the default 'ginc_trigger' on Pastebin? What bothers me is that DoSpeakTrigger() isn't failing afaict. The dialog starts. Try a very simple script:

void main()
{
    SendMessageToPC(GetFirstPC(FALSE), "Script runs on " + GetName(OBJECT_SELF));
}


#25
kevL

kevL
  • Members
  • 4 052 messages

ps. Guess i should be explicit about this:

 

GetIsPC() means Player Controlled.