Aller au contenu

Photo

Applying permanent petrify effect through plot script


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

#1
Malacola

Malacola
  • Members
  • 18 messages
I'm fairly certain I'm missing something basic about effects, but I can't seem to get this to apply. All I'm looking to do is get a petrify effect on someone that will last until removed through another plot flag. I know that the script is running because the second dialog is getting initiated by the UT_Talk function, but the character does not get petrified. Anyone know what I'm missing here?

Here's the plot code...

                                  
#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "core_h"
#include "effect_constants_h"
#include "blessed_constants"

#include "plt_BLESSEDPLOT"

int StartingConditional()
{
    event eParms = GetCurrentEvent();                // Contains all input parameters
    int nType = GetEventType(eParms);               // GET or SET call
    string strPlot = GetEventString(eParms, 0);         // Plot GUID
    int nFlag = GetEventInteger(eParms, 1);          // The bit flag # being affected
    object oParty = GetEventCreator(eParms);      // The owner of the plot table for this script
    object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
    int nResult = FALSE; // used to return value for DEFINED GET events
    object oPC = GetHero();

    object oGregorin = UT_GetNearestCreatureByTag(oPC, GREGORIN);
    object oFallon = UT_GetNearestCreatureByTag(oPC, FALLON);

    plot_GlobalPlotHandler(eParms); // any global plot operations, including debug info

    if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
    {
        int nValue = GetEventInteger(eParms, 2);        // On SET call, the value about to be written (on a normal SET that should be '1', and on a 'clear' it should be '0')
        int nOldValue = GetEventInteger(eParms, 3);     // On SET call, the current flag value (can be either 1 or 0 regardless if it's a set or clear event)
        // IMPORTANT: The flag value on a SET event is set only AFTER this script finishes running!
        switch(nFlag)
        {
            case GREGORIN_PETRIFIED:
            {
                effect eEffect = Effect(EFFECT_TYPE_PETRIFY);
                eEffect = SetEffectInteger(eEffect, 0, 0);
                ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eEffect, oGregorin, 0.0f, oFallon, 0);
                UT_Talk(oFallon, oPC);
            }
            break;

        }
     }
     else // EVENT_TYPE_GET_PLOT -> defined conditions only
     {

        switch(nFlag)
        {


        }

    }

    plot_OutputDefinedFlag(eParms, nResult);

    return nResult;
}


#2
FalloutBoy

FalloutBoy
  • Members
  • 580 messages
Is there an ApplyEffectOnObject function? I only see an Engine_ApplyEffectOnObject. Do you get errors when you compile this?


#3
Malacola

Malacola
  • Members
  • 18 messages
Nope, compiles fine. I'm getting closer, having realized you can't really just apply a petrification effect straight out of the box like NWN.

So I'm separately applying the Paralyze effect and a kind of stand-in petrification vfx until I can find a better one, but this isn't quite perfect either. Neither of these really have the desired effect. The paralyze effect doesn't seem to do anything, and none of the VFX I've tried seem to be the one used for petrify. Either way, haven't quite found the perfect solution yet.

//::///////////////////////////////////////////////
//:: Plot Events Template
//:: Copyright (c) 2003 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Plot events
*/
//:://////////////////////////////////////////////
//:: Created By: Yaron
//:: Created On: July 21st, 2006
//:://////////////////////////////////////////////

#include "log_h"
#include "utility_h"
#include "wrappers_h"
#include "plot_h"
#include "core_h"
#include "effect_constants_h"
#include "blessed_constants"

#include "plt_BLESSEDPLOT"

int StartingConditional()
{
    event eParms = GetCurrentEvent();                // Contains all input parameters
    int nType = GetEventType(eParms);               // GET or SET call
    string strPlot = GetEventString(eParms, 0);         // Plot GUID
    int nFlag = GetEventInteger(eParms, 1);          // The bit flag # being affected
    object oParty = GetEventCreator(eParms);      // The owner of the plot table for this script
    object oConversationOwner = GetEventObject(eParms, 0); // Owner on the conversation, if any
    int nResult = FALSE; // used to return value for DEFINED GET events
    object oPC = GetHero();

    object oGregorin = UT_GetNearestCreatureByTag(oPC, GREGORIN);
    object oFallon = UT_GetNearestCreatureByTag(oPC, FALLON);

    plot_GlobalPlotHandler(eParms); // any global plot operations, including debug info

    if(nType == EVENT_TYPE_SET_PLOT) // actions -> normal flags only
    {
        int nValue = GetEventInteger(eParms, 2);        // On SET call, the value about to be written (on a normal SET that should be '1', and on a 'clear' it should be '0')
        int nOldValue = GetEventInteger(eParms, 3);     // On SET call, the current flag value (can be either 1 or 0 regardless if it's a set or clear event)
        // IMPORTANT: The flag value on a SET event is set only AFTER this script finishes running!
        switch(nFlag)
        {
            case GREGORIN_PETRIFIED:
            {
                effect eEffect = EffectParalyze();
                ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eEffect, oGregorin);
                ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT,EffectVisualEffect(90149),oGregorin);
                UT_Talk(oFallon, oPC);
            }
            break;

        }
     }
     else // EVENT_TYPE_GET_PLOT -> defined conditions only
     {

        switch(nFlag)
        {


        }

    }

    plot_OutputDefinedFlag(eParms, nResult);

    return nResult;

Modifié par Malacola, 28 janvier 2010 - 01:50 .


#4
SuperD-710

SuperD-710
  • Members
  • 130 messages
EFFECT_TYPE_PETRIFY is only a simple effect(aka flag) that is used to check for shattering. Normally it is coupled with paralyze with a VFX to achieve petrify or freeze effect. Check the spell script for Petrify and you should get what you need.

#5
Malacola

Malacola
  • Members
  • 18 messages
Ah, okay. I started out with the spell script, but it has elements I don't quite understand.



eEffect = EffectParalyze(Ability_GetImpactObjectVfxId(stEvent.nAbility));
ApplyEffectOnObject(EFFECT_DURATION_TYPE_TEMPORARY, eEffect, stEvent.oTarget, fDuration, stEvent.oCaster, stEvent.nAbility);



That Ability_GetImpactObjectVfxId doesn't have any documentation, and I'm also not quite sure what's going on with stEvent.Ability either, although I can hazard a guess it's specific to the abilities scripts and wouldn't be of use in my case. It looks like EffectParalyze takes a VFX integer, but plugging in the ID for the Petrify - Duration Crust VFX still doesn't do anything.


#6
SuperD-710

SuperD-710
  • Members
  • 130 messages
Ability_GetImpactObjectVfxId(stEvent.nAbility) just grabs the "vfx_impact1" field of the abilityID passed as argument (in this case stEvent.nAbility) in the ABI_ 2DA. You can plug in 90149 to have the petrify vfx. (That's the same as the spell Petrify). Even if you don't have a VFX, target should still freeze in place. If you don't see anything, you probably messed up one of the parameters since you copy and pasted the code. (Did you set it to pema? If didn't, did you pass the duration correctly?)

Unless you want the petrified creature to be able to be shattered, you can ignore EFFECT_TYPE_PETRIFY altogether.

Here's a short piece of code I tested with, worked for me.

object oPC = GetMainControlled();

effect eEffect = EffectParalyze(90149);
ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eEffect, oPC, 0.0, oPC, 99999);

Modifié par SuperD-710, 28 janvier 2010 - 07:17 .


#7
Malacola

Malacola
  • Members
  • 18 messages
Damn, still isn't working. I can tell the effect is getting called, because I can see the VFX going off, but there's no paralysis or petrification happening. I used the same parameters you've got:

case GREGORIN_PETRIFIED:
            {
                effect eEffect = EffectParalyze(90149);
                ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eEffect, oGregorin, 0.0, oPC, 99999);
                UT_Talk(oFallon, oPC);
            }
            break;

But still no dice. Not really sure what the deal is at this point. Thought maybe it had something to do with the creature himself, like I'd set him to plot or something but he's set up just like a normal combatant, any effects should apply to him fine.

Could you try setting the same effect on another creature rather than the PC? I'm just at a loss as to what's blocking this thing.

EDIT: Whoop, scratch that. Appears it actually is working, it's just being overridden by entering a dialog with him! Guess I'll have to do the floaty text thing so that the dialog pose doesn't drop the paralyze effect. Thanks for the help!

Modifié par Malacola, 29 janvier 2010 - 01:13 .