Author Topic: Looking for a script or guidance.  (Read 367 times)

Legacy_Rio420

  • Full Member
  • ***
  • Posts: 112
  • Karma: +0/-0
Looking for a script or guidance.
« on: August 30, 2013, 09:46:04 pm »


               Basically, we have immortals in the game that monitor and ref gameplay. I'm trying to find a script that will apply the same affects that a DM would have via disappear and appear. The script would be attached to an item, in my case, a wand. Any ideas how this can be accomplished without having to polymorph into something?
 
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #1 on: August 30, 2013, 10:45:25 pm »


               Have you considered SIMTools? If your immortals are in the role of dms, but logged in as players, it's pretty much exactly what you want and a ton more. dm_invuln gives godmode, and dm_invis makes them invisible.

If that doesn't suit, let me know, and I'll post code for dm_invis as an item instead of a chat command.

Funky
               
               

               


                     Modifié par FunkySwerve, 30 août 2013 - 09:52 .
                     
                  


            

Legacy_Rio420

  • Full Member
  • ***
  • Posts: 112
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #2 on: August 31, 2013, 03:15:14 am »


               Thanks for the reply Funky, yeah I pretty much have to go with option B, the module already has an existing system for immortals (Player DMs), but the way it handles going invisible is almost ludicrous. You basically polymorph into an invisible creature with movement speed increases, but you can't re-appear because you can't use the item that you did to disappear in the first place.  The only work around is to carry around food and rest, which is on a 3 hour (game time) cooldown each time you want to rest.

Basically, I just need a simple script to add to their wand that causes them to go dm_invis and can be used again to make them reappear.
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #3 on: August 31, 2013, 03:49:14 am »


               You can't use items while poly'd, at least in vanilla (sans nwscript). You're right, that system is ludicrous, if that's the only reason it's done that way, which I kind of doubt (but I've seen sillier things). I could make you a potion that'd do that, but you'd be much better served by an item that made them cutscene invis and ghosted, I think - like the wand you're talking about. Are you using tag-based scripting?

Funky
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #4 on: August 31, 2013, 04:30:45 am »


               umm,  I agree that I do not like the system.   But can you not cancel a polymorph  from the radial.  At least that is,  if they are using a polymorph and not just changing the appearance.
               
               

               
            

Legacy_WhiZard

  • Hero Member
  • *****
  • Posts: 2149
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #5 on: August 31, 2013, 04:11:22 pm »


               Setting a potion to plot will make it the equivalent of 1 use per day (rest).  So you could have the potion force rest you (so you can use it again infinitely) in addition to its intended use.
               
               

               
            

Legacy_Rio420

  • Full Member
  • ***
  • Posts: 112
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #6 on: August 31, 2013, 08:19:35 pm »


               

FunkySwerve wrote...

You can't use items while poly'd, at least in vanilla (sans nwscript). You're right, that system is ludicrous, if that's the only reason it's done that way, which I kind of doubt (but I've seen sillier things). I could make you a potion that'd do that, but you'd be much better served by an item that made them cutscene invis and ghosted, I think - like the wand you're talking about. Are you using tag-based scripting?

Funky


Basically, I created the wand through the toolset first then wrote the conversation script. Then, I attached the script by using the module script for OnActivateItem which checks for the Item tag and then loads the appropriate conversation script.  Then I wrote the scripting for each of the item options in the wand.

- Arm
               
               

               


                     Modifié par Rio420, 31 août 2013 - 07:20 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #7 on: September 01, 2013, 07:32:20 pm »


               Here's a script that will do what you want. Just name it for the tag of the item. It assumes only that you aren't using the module as an effect creator for any other effects on the immortals; I did it this way for the sake of simplicity. A better way is to use a specific object as an effect creator, and check it instead of the module, but that requires placing a nonstatic place in an area (preferably plot), and giving it a unique tag you can use GetObjectByTag to find it with. It's better because sometimes other systems will use mod as an effect creator (a particular subrace system comes to mind), but this is simpler, and doesn't require any modifications outside of the script.


#include "x2_inc_switches"

void DoDMInvis(object oPC)
{
    effect eEffect = EffectCutsceneGhost();
    effect eEffect2 = EffectVisualEffect(VFX_DUR_CUTSCENE_INVISIBILITY);
    effect eLink = SupernaturalEffect(EffectLinkEffects(eEffect, eEffect2));
    ApplyEffectToObject(DURATION_TYPE_PERMANENT, eLink, oPC);
}

void main() {

    object oPC, oItem, oMod;

    SetExecutedScriptReturnValue(X2_EXECUTE_SCRIPT_END);

    if (GetUserDefinedItemEventNumber() != X2_ITEM_EVENT_ACTIVATE)
        return;

    oPC = GetItemActivator();
    oItem = GetItemActivated();
    oMod = GetModule();

    effect eEffect = GetFirstEffect(oPC);
    int nAlreadyInvis = FALSE;
    while (GetIsEffectValid(eEffect)) {

        if (GetEffectCreator(eEffect) == oMod) {
            DelayCommand(0.1, RemoveEffect(oPC, eEffect));
            nAlreadyInvis = TRUE;
        }
        eEffect = GetNextEffect(oPC);
    }

    if (!nAlreadyInvis)
        AssignCommand(oMod, DoDMInvis(oPC));
}

Funky
               
               

               


                     Modifié par FunkySwerve, 01 septembre 2013 - 06:33 .
                     
                  


            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #8 on: September 01, 2013, 07:37:03 pm »


               Whup. Forgot to say, that code will have the item toggle between invisibility and uninvisibility - simpler than using two items.

Funky
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #9 on: September 01, 2013, 08:01:20 pm »


               If you have nwnx - I'd recommend using nwnx_cool - for its toggle/mode detection.
Combined with nwnx_func's visibility functions, you can set it up so that when a certain player/subrace/group member toggles stealth, it actually applies a level of stealth that is effectively the same as DM Stealth.
No amount of Perception or True Seeing can penetrate it.
Although - monsters still see through it, but you can remedy that with the addition of Sanctuary at the same time.

Then the toggle mode can be used to remove both effects.
               
               

               
            

Legacy_Rio420

  • Full Member
  • ***
  • Posts: 112
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #10 on: September 01, 2013, 11:32:02 pm »


               Thanks for the script Funky, I'll check into nwnx tonight, I have been so busy on this other script I haven't had time to do anything else today lol..
               
               

               
            

Legacy_FunkySwerve

  • Hero Member
  • *****
  • Posts: 2325
  • Karma: +0/-0
Looking for a script or guidance.
« Reply #11 on: September 02, 2013, 02:34:14 am »


               

Baaleos wrote...

If you have nwnx - I'd recommend using nwnx_cool - for its toggle/mode detection.
Combined with nwnx_func's visibility functions, you can set it up so that when a certain player/subrace/group member toggles stealth, it actually applies a level of stealth that is effectively the same as DM Stealth.
No amount of Perception or True Seeing can penetrate it.
Although - monsters still see through it, but you can remedy that with the addition of Sanctuary at the same time.

Then the toggle mode can be used to remove both effects.


That sounds identical to what mine does, absent client 2da edits. Can you elaborate on the difference? Neither perception nor true seeing can pierce cutscene.

Funky