Aller au contenu

Photo

Highlight object until examined


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

#1
DynV

DynV
  • Members
  • 18 messages
Forked from display Localized Description, I need an object to be emphasised until it's examined, either through right-click menu or left-click as its default action is examine.  I haven't found out exactly which effect is called when a usable object is highlighted (when hovered) but I'm trying to have it glow then would create another script applying it On Use then find a way to also call it from On Examine (as the user could right-click it).

The following script named i_inn_room_en and is attached to On Enter Script of the area inn_room. The problem with the script is it doesn't seem to have any effect on the object ; I'm a script newbie and I'm not even sure if oScrollInnNote is created properly (with a successful return from GetNearestObjectByTag() ) neither if eGlow is created properly before wondering if ApplyEffectToObject() functionned.  I'd like to test oScrollInnNote by moving or deleting it (the object associated with it in the area) but I don't know how to that do either.  :blush:  Another concern: do I need #include "ginc_cutscene" now that I deleted the content related to cutscene from the Bare Bones template?

BTW is there a BBCode that I should apply to code to be easier identified?
Thank you kindly :)

// Area OnClientEnter Bare Bones.nss
/*
    Area OnClientEnter event handler template.
    Bare bones, useful to setup cutscene(s) to fire when the party enters via a party transition.
*/
// BMA-OEI 8/08/06

#include "ginc_cutscene"

int StartingConditional()
{
    // Event fired via non-party transition (Load Game, Client Join, etc.)
    if ( FiredFromPartyTransition() == FALSE )
    {
        return ( FALSE );
    }
   
    // Get party leader, force control of owned PC
    object oPC = GetFirstEnteringPC();
    object oLeader = GetFactionLeader( oPC );
    oPC = SetOwnersControlledCompanion( oLeader );
   
    // Based on BioWare Forums: making a placeable glow on enter.... - http://nwn.bioware.c...ml?post=7143001
    object oScrollInnNote = GetNearestObjectByTag("ScrollInnNote", oPC);
    effect eGlow = EffectVisualEffect(VFX_DUR_GLOW_BLUE); // Once blue function, try VFX_DUR_GLOW_WHITE
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGlow, oScrollInnNote);
   
    // No cutscene pending, revert control to original character
    SetOwnersControlledCompanion( oPC, oLeader );
    return ( FALSE );
}

Edit 1:
I tried the script with GetNearestObjectByTag("ScrollInnNote", oLeader) instead in vain.

Modifié par DynV, 20 septembre 2010 - 01:34 .


#2
Guest_ElfinMad_*

Guest_ElfinMad_*
  • Guests
I don't see a main() anywhere. Is this the whole script? If so you should use void main() and not StartingConditional() which is used in conversations. As main() is a void function you should just use "return" and not "return (FALSE)".

#3
DynV

DynV
  • Members
  • 18 messages
I made the area entering script function as following but there's more after.



// Area OnClientEnter Bare Bones.nss
/*
    Area OnClientEnter event handler template.
    Bare bones, useful to setup cutscene(s) to fire when the party enters via a party transition.
*/
// BMA-OEI 8/08/06

int StartingConditional()
{
/*
    // As the script should be launched loading the game, the transition check is harmful
    // Event fired via non-party transition (Load Game, Client Join, etc.)
    if (FiredFromPartyTransition() == FALSE) {
        return ( FALSE );
    }
*/

    // Get party leader, force control of owned PC
    object oPC = GetFirstEnteringPC();
    object oLeader = GetFactionLeader(oPC);
    oPC = SetOwnersControlledCompanion(oLeader);
       
    // Based on BioWare Forums: making a placeable glow on enter.... - http://nwn.bioware.c...ml?post=7143001
    object oScrollInnNote;
    effect eGlow;
   
    oScrollInnNote = GetNearestObjectByTag("ScrollInnNote", oPC);
    if (GetIsObjectValid(oScrollInnNote)) {
        //SendMessageToPC(GetFirstPC(), "Succeded GetNearestObjectByTag\\\\(\\\\)");
        eGlow = EffectVisualEffect(VFX_DUR_GLOW_WHITE);
        ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGlow, oScrollInnNote);
    //} else {
    //    SendMessageToPC(GetFirstPC(), "Failed GetNearestObjectByTag\\\\(\\\\)");
    }
   
    // No cutscene pending, revert control to original character
    SetOwnersControlledCompanion(oPC, oLeader);
    return (FALSE);
}



A note on the previous version EffectVisualEffect() parameter, it was commented I wanted to try replacing blue by white after, in case it wasn't the right syntax, but noticed that entering "VFX_DUR_GLOW_" in the Script Assist tab Globals gave me all the possibilities so no more guesswork.

Now I'm having a problem removing that effect, I've attacthed the following script to ScrollInnNote On Left Click and I suspect that I should be linking it to another event instead...



void main()
{
    // Based on BioWare Forums: making a placeable glow on enter.... - http://nwn.bioware.c...ml?post=7143001
    effect eGlow;
   
    eGlow = GetFirstEffect(OBJECT_SELF);
    while (GetIsEffectValid(eGlow)) {
        if (GetEffectCreator(eGlow) == OBJECT_SELF) {
            // SendMessageToPC(GetFirstPC(),"EffectRemoved");
            RemoveEffect(OBJECT_SELF, eGlow);
        }
        eGlow = GetNextEffect(OBJECT_SELF);
    }
}



Thank you :)

Modifié par DynV, 21 septembre 2010 - 11:15 .


#4
DynV

DynV
  • Members
  • 18 messages
The problem removing the effects was (seen below) the check "if (oEffectCreator == OBJECT_SELF)" as oEffectCreator is the area and OBJECT_SELF is the scroll, I wonder why that check was put there in the first place.

I now have the problem of opening the examine window before/after removing the effect, if you have an idea please help me in display Localized Description.  :)



void main()
{
    ActionExamine(OBJECT_SELF);
    //SendMessageToPC(GetFirstPC(),"script for RemoveEffect started");
   
    // Based on BioWare Forums: making a placeable glow on enter.... - http://nwn.bioware.c...ml?post=7143001
    effect eGlow;
   
//    object oEffectCreator;
   
    eGlow = GetFirstEffect(OBJECT_SELF);
    //SendMessageToPC(GetFirstPC(),"GetFirstEffect");
   
    while (GetIsEffectValid(eGlow)) {
/*
        SendMessageToPC(GetFirstPC(),"GetIsEffectValid");
        oEffectCreator = GetEffectCreator(eGlow);
        SendMessageToPC(GetFirstPC(),"GetEffectCreator");
        SendMessageToPC(GetFirstPC(),"tag OBJECT_SELF: " + GetTag(OBJECT_SELF));
        SendMessageToPC(GetFirstPC(),"tag oEffectCreator: " + GetTag(oEffectCreator));
        if (oEffectCreator == OBJECT_SELF) {
            SendMessageToPC(GetFirstPC(),"GetEffectCreator");
*/
            RemoveEffect(OBJECT_SELF, eGlow);
/*
            SendMessageToPC(GetFirstPC(),"RemoveEffect");
        }
*/
        eGlow = GetNextEffect(OBJECT_SELF);
    }
}

#5
M. Rieder

M. Rieder
  • Members
  • 2 530 messages
Another approach would be to make a light hanging over the object you want to be highlighted. Once the player has done whatever you want to have done to the object, just script the destruction of that object, which is much easier than messing with adding and removing effects.



I have seen this technique used in a module and found it convincing.