Aller au contenu

Photo

possible to possess a summoned creature? (like a familiar)


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

#1
Antares

Antares
  • Members
  • 51 messages

hello,

I would like to summon creatures and be able to possess them like I do with familiars. Is this possible?



#2
kevL

kevL
  • Members
  • 4 061 messages

hm, first thing i'd try is adjusting the spellscript. At the end of the summon routine, add them to the Roster / Party (summons *might* get automatically added to the roster -- they show up in the partybar, right?) If so, just add them to the party like a companion ...

I'd consider the procedure experimental, since it's still just a summon_effect. Things could get finicky when the spell times out. And if it dies, then the module's (entirely separate) event scripts kick in,


- might also want to consider swapping out the creature's event slots' scripts; from NPC to companion scripts.


Or you could re-implement summons from scratch, without using the summon_effect at all .....

/ by hook or by crook, as they say


  • Antares aime ceci

#3
Antares

Antares
  • Members
  • 51 messages

hm, first thing i'd try is adjusting the spellscript. At the end of the summon routine, add them to the Roster / Party (summons *might* get automatically added to the roster -- they show up in the partybar, right?) If so, just add them to the party like a companion ...

 

tried this but didn t work. Perhaps I have to give up this time.



#4
kevL

kevL
  • Members
  • 4 061 messages

Antares,

here's a fun proof-of-concept : pastebin



#5
kevL

kevL
  • Members
  • 4 061 messages

ha, gave me a CTD when it died and I respawned in a different area

 

 

edit

yeh .. so the problem stems from the onDeath event.

It looks possible to fix, either by attaching a "deathscript" variable to all summoned creature UTC's. Or by altering the stock 'gb_comp_death' script, which is what I'd do rather than try to pull off the fancy footwork required to swap in & out event scripts on-the-fly.


basically, the death of the pet needs to handle removing it from the party & roster.


Modifié par kevL, 14 juillet 2014 - 12:52 .


#6
kevL

kevL
  • Members
  • 4 061 messages

ok, stopped the CTD with this snippet in 'gb_comp_death' -- near the top, after the early "returns"
 

//- begin PossessiblePets mod:
    if (GetIsPC(OBJECT_SELF))
        SetOwnersControlledCompanion(OBJECT_SELF);

    string sRoster = GetRosterNameFromObject(OBJECT_SELF);
    if (GetStringRight(sRoster, 4) == "_pet")
    {
        RemoveRosterMemberFromParty(sRoster, GetFactionLeader(OBJECT_SELF));
        RemoveRosterMember(sRoster);

        SetRosterNPCPartyLimit(GetRosterNPCPartyLimit() - 1);
    }
//- end mod.

also fixed some things in the main script. [edit] removed redundant condition [edit2] remove unnecessary loop too.


Modifié par kevL, 14 juillet 2014 - 04:43 .

  • Antares aime ceci

#7
Antares

Antares
  • Members
  • 51 messages

wow! thanks for the huge efforts. This will come handy!

:D



#8
kevL

kevL
  • Members
  • 4 061 messages

yeh :)

I figure i'm going to leave it in my project, see how things go and debug it whenever I get into my next big round of NwN2 play.

am glad it sounds like you're going to see what you can do with it too. A couple of things, if it's not too much to get yer head around, is that they can't be dismissed like a normal pet (without quite a bit of a GUI overhaul, that is), and also, if a caster tries to summon another while one is already out, at present, uhhhhh I think the script will just let it happen (!) But that'd lead to massively undefined behavior. Lol

i did some touchups to my custom-Kaedrin summoning script to alleviate this, but it got too complicated to parse out for posting ....


anyway, if you come up with anything interesting Pls post up,


  • Antares aime ceci

#9
Antares

Antares
  • Members
  • 51 messages

yeah, I cannot dismiss the creature, but I believe I can workaound this using  a delayed destroyobject on the creature, when the spell ends.

 

I tried to summon another creature, when one is present. A yellow message appears in the chat that informs I have already a pet and wasted a spell. Sounds right.



#10
kevL

kevL
  • Members
  • 4 061 messages

oh, ok