Aller au contenu

Photo

Gauntlet PRCSCR script [Solved]


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

#1
Karma

Karma
  • Members
  • 391 messages
I made a mod that adds companions to the game, and I've been trying to recreate the doppelgangers in the Gauntlet using a PRCSCR script (below). I have two issues which I can't quite seem to figure out. I'm sure it must be something simple I'm just failing to see.

(1) The doppelgangers spawn properly if I load a save from within the gauntlet, but they won't spawn if I enter the gauntlet area from the mountain top. The gauntlet is not part of an area list as far as I can tell.

(2) The transparency effect won't work. I've never used effects before, so I merely copied the effect used by the URN_SetupDoppelgangers() function in urn_functions_h.


[dascript]
#include "utility_h"
#include "wrappers_h"
#include "urn_constants_h"

#include "gen00pt_party_kc"


void main()
{
    object oCullen = GetObjectByTag("kc_cir230cr_cullen");
    object oGorim = GetObjectByTag("kc_bdn120cr_gorim");
    object oGilmore = GetObjectByTag("kc_bhn100cr_gilmore");
    object oCullend = GetObjectByTag("kc_urn230cr_cullen");
    object oGorimd = GetObjectByTag("kc_urn230cr_gorim");
    object oGilmored = GetObjectByTag("kc_urn230cr_gilmore");

    //Doppelganger Cullen's position
    vector vCullen = Vector(78.9843f, -6.40222f, 0.000986939f);
    location lCullen = Location(GetArea(GetHero()), vCullen,  90.0f);

    //Doppelganger Gorim's position
    vector vGorim = Vector(78.5242f, -9.47942f, 0.011455f);
    location lGorim = Location(GetArea(GetHero()), vGorim,  90.0f);

    //Doppelganger Gilmore's position
    vector vGilmore = Vector(79.9954f, -5.62986f, 0.000986939f);
    location lGilmore = Location(GetArea(GetHero()), vGilmore,  90.0f);
                                                                            
   
    effect eTransparent = Effect(EFFECT_TYPE_ALPHA);
    eTransparent = SetEffectEngineFloat(eTransparent, EFFECT_FLOAT_POTENCY, 0.5);

    //if (! IsObjectValid(oCullend))
    CreateObject(OBJECT_TYPE_CREATURE, R"kc_urn230cr_cullen.utc", lCullen);
    ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eTransparent, oCullend);
       
    CreateObject(OBJECT_TYPE_CREATURE, R"kc_urn230cr_gorim.utc", lGorim);
    ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eTransparent, oGorimd);
   
    CreateObject(OBJECT_TYPE_CREATURE, R"kc_urn230cr_gilmore.utc", lGilmore);       
    ApplyEffectOnObject(EFFECT_DURATION_TYPE_PERMANENT, eTransparent, oGilmored);
   
    if(GetFollowerState(oCullen) != FOLLOWER_STATE_ACTIVE)
    {
        SetObjectActive(oCullend, FALSE);
    }

    if(GetFollowerState(oGorim) != FOLLOWER_STATE_ACTIVE)
    {
        SetObjectActive(oGorimd, FALSE);
    }

    if(GetFollowerState(oGilmore) != FOLLOWER_STATE_ACTIVE)
    {
        SetObjectActive(oGilmored, FALSE);
    }
}
[/dascript]

Modifié par satans_karma, 30 octobre 2010 - 05:01 .


#2
TimelordDC

TimelordDC
  • Members
  • 923 messages
Do you have your doppelgangers set to the same team ID as the original doppelgangers? If so, you should know that the doppelgangers are deactivated first [edit: to clarify, the team is deactivated] and then activated based on tag.

What I'd suggest is name your doppelgangers according to the OC convention (affix _dplg) to their regular tags, set them to the same team ID as the original and spawn them inside the Gauntlet. The game's script should take care of the rest.

The transparent effect is actually due to AddAbility(oDplg, ABILITY_TRAIT_GHOST), I think.

Edit2: When you load a save game, the area script doesn't fire and the deactivation happens in the area script (which runs when you enter the area). Hence, the problem.

Modifié par TimelordDC, 30 octobre 2010 - 03:39 .


#3
Karma

Karma
  • Members
  • 391 messages
First, I had the script spawn the doppelgangers deactivated and used the condition that if the follower was active to make the doppelganger active and apply the proper effects/ability. The doppelgangers wouldn't spawn (though I hadn't tested it with a save from within the gauntlet; perhaps it works inside the gauntlet). Then I switched to the script from above, which spawns them active and deactivates them if the player is not in the party. It only worked when a save inside the gauntlet was loaded.



There are two effects in play from what I can gather. The ghost effect and the transparent effect. The ghost effect makes the doppelgangers the usual white and clearly visible. The transparent effect seems to make the doppelgangers bluish and significantly more transparent than the ghosts. I originally tried adding the ghost ability with the AddAbility function but to no avail. They weren't becoming ghosts. So I set up the ghost in the creature properties instead. They had the ghost effect but were not transparent.



Same deal with the team id. I tried setting it up in the script just as they do in the URN_SetupDoppelgangers() function, but they wouldn't turn hostile. So I gave them the team id 6 (which supposedly correlates to the doppelgangers team according to the urn_constants_h) in the creature properties, and then they went hostile as they were supposed to.



The original doppelgangers' tags only have the dplg suffix in the area. The original doppelgangers' creature tags don't have that suffix. Does that matter? If I add the suffix to the creature properties (since I can't add the creature to the area directly), will the URN_SetupDoppelgangers() function apply itself to the new doppelgangers? In other words, can I get rid of everything but the CreateObject bits in the script I posted?

#4
TimelordDC

TimelordDC
  • Members
  • 923 messages
Hey, the problems you mention in the first and third paras above are due to the game's area script which fires after the PRCSCR script. You are doing everything correctly.



However, the area script deactivates all members of the doppelganger team (including yours) and sets the team ID to -1. Now, your doppelgangers are screwed because when the area script reactivates them, it searches for them by the companion's tag + _dplg.



The original doppelgangers' tags only have the dplg suffix in the area. The original doppelgangers' creature tags don't have that suffix. Does that matter?


No, the area settings always override the template settings.



If I add the suffix to the creature properties (since I can't add the creature to the area directly), will the URN_SetupDoppelgangers() function apply itself to the new doppelgangers?


I am fairly certain it will - unless there is stuff happening later (haven't looked through all scripts for that area). If you run into an issue using the _dplg tags, it will be easier to debug so I would suggest trying that.



In other words, can I get rid of everything but the CreateObject bits in the script I posted?


Yes.




#5
Karma

Karma
  • Members
  • 391 messages
I switched the doppelgangers back to deactivated upon creation and then had them activate if the follower was in the party. I also changed the tags and removed the ghost effect from the creature properties. It seemed to do the trick on all counts. I'm much obliged.