Skip to content

EffectSummonCreature

on activate code -
// Rod of the Bone Golem
    oPC = GetItemActivator();
    object oUsed5 = GetItemActivated();
    if (GetTag(oUsed5) == "ROD_B_GOLEM")
    {
        effect eSummon = EffectSummonCreature("gulgotha", VFX_NONE);
        ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSummon, GetItemActivatedTargetLocation(), 1800.0);
    }

Trying to have the player summon a golem with a magic rod. My code does squat. Nothing. No golem appears. I'm uncertain as to whether or not my expectations are realistic or not. Is the function supposed to "summon" a critter to be placed into the PC's faction? That's what I'm looking for. As for now, nothing happens???
Any help? Well, you know the drill...

Comments

  • TarotRedhandTarotRedhand Member Posts: 1,323
    To quote the lexicon -
    Can only be applied from creature objects (PC or NPC), no other objects.
    and you are trying to summon it using an item - the rod. Maybe that is the problem?

    TR
  • ProlericProleric Member Posts: 1,122
    Are you sure that gulgotha is the resref of the golem (not the tag)?

    The final parameter should be the duration in seconds - 30 minutes might seem a little brief - I notice that official code tends towards 24 hours or more - not sure whether that makes any difference.
  • MelkiorMelkior Member Posts: 71
    To quote the lexicon -
    Can only be applied from creature objects (PC or NPC), no other objects.
    and you are trying to summon it using an item - the rod. Maybe that is the problem?

    TR

    As I understand it, it depends what the script is running on (from the module's point of view) so if it's running on the PC, it should work. My first guess would be that Proleric has it right and the ResRef is incorrect, so the creature is not being summoned because nothing with that ResRef exists.
  • ZephiriusZephirius Member Posts: 379
    Using the rod as an item was the problem. Now I've got it set up so that an NPC gives you the option for a summoning dialog. Problem is that when gulgotha appears, he's not in the PC's party/faction. How do I remedy this?

    Code I'm using now -
    void main()
    {
        object oPC = GetPCSpeaker();
    
        PlayAnimation(ANIMATION_PLACEABLE_ACTIVATE);
    
        location lLoc = GetLocation(GetWaypointByTag("GULGOTHA"));
    
        effect eSummon = EffectSummonCreature("gulgotha", VFX_FNF_SUMMON_UNDEAD, 1.5);
        ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSummon, lLoc, 1800.0);
    }
    
  • TerrorbleTerrorble Member Posts: 151
    Assuming your resref/tag stuff is correct, I suspect the code isn't running at all.
    Do you have tag-based scripting enabled and is the name of the script the same as the tag of the item?

    If you don't do this already, I have a creature placed in my module tagged "SCREAMER" and anytime my code doesn't work I put this line all over in to have it shout as each step occurs.
    /*DEBUG*/AssignCommand(GetObjectByTag("SCREAMER"),ActionSpeakString("Item activated script fired.",TALKVOLUME_SHOUT));/*DEBUG*/
    


    I thought I had an example of exactly what you're doing here, but it turns out I put the item property Cast Spell: Summon Creature (1 use/day) on it, then edited nw_s0_summon to create the creature.
        if(GetSpellCastItem() != OBJECT_INVALID)
        {
            if( GetTag(GetSpellCastItem()) == "GYROBOT" )
            {
                SummonGyrobot(OBJECT_SELF);
                return;
            }
    

    My function to summon the creature does some other things but essentially looks just like what you wrote above to summon yours.
  • ZephiriusZephirius Member Posts: 379
    edited November 23
    Terrorble wrote -
    Do you have tag-based scripting enabled and is the name of the script the same as the tag of the item?

    I tried this OnActivateItem script with no luck.
    // Rod of the Bone Golem
        oPC = GetItemActivator();
        object oUsed5 = GetItemActivated();
        if (GetTag(oUsed5) == "ROD_B_GOLEM")
        {
            effect eSummon = EffectSummonCreature("gulgotha", VFX_NONE);
            ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSummon, GetItemActivatedTargetLocation(), 1800.0);
        }
    

    I
  • TarotRedhandTarotRedhand Member Posts: 1,323
    edited November 24
    @Zephirius you might want to try the SetIsTemporaryFriend() function. (slightly edited to make it more readable) From the lexicon -
    SetIsTemporaryFriend(object, object, int, float)

    Causes a creature to consider another creature a friend indefintely or for a fixed time.
    void SetIsTemporaryFriend(
        object oTarget,
        object oSource = OBJECT_SELF,
        int bDecays = FALSE,
        float fDurationInSeconds = 180.0f
    );
    
    Parameters

    oTarget - The object whose reputation will be altered.

    oSource - The creature whose opinion will change (Default: OBJECT_SELF)

    bDecays - If this is TRUE, the friendship decays over fDurationInSeconds; otherwise it is indefinite. (Default: FALSE)

    fDurationInSeconds - This is only used if bDecays is TRUE, it is how long the friendship lasts. (Default: 180.0f)

    Description

    Make oSource into a temporary friend of oTarget using personal reputation. This will fail if oTarget and oSource are in the same faction or party (Check with GetFactionEqual()) as they can never be considered tempoarily anything but what the faction in general tells them to think.

    Note: If bDecays is TRUE, the personal reputation amount decreases in sizeover fDurationInSeconds. Friendship will only be in effect as long as (faction reputation + total personal reputation) >= REPUTATION_TYPE_FRIEND.

    TR
    Post edited by TarotRedhand on
  • ProlericProleric Member Posts: 1,122
    Another way to get the creature into the PC's faction would be to AssignCommand the summon effect to the PC.

    That should work with an item, too.
  • MelkiorMelkior Member Posts: 71
    Proleric wrote: »
    Another way to get the creature into the PC's faction would be to AssignCommand the summon effect to the PC.

    That should work with an item, too.

    That was going to be my suggestion too. Code fragment:
    AssignCommand(oPC,ApplyEffectAtLocation(DURATION_TYPE_TEMPORARY, eSummon, lLoc, 1800.0));
    
Sign In or Register to comment.