Jump to content

problem with NPC spell casting


icecreamassassin

Recommended Posts

Alright so I have this NPC enemy, who talks to you when you get close, his disposition is modified and he attacks you.

 

this is the script on him, the disposition condition is set by his greeting when he sees you

scriptname CRdrakeburndeathscript

Short talkstate
short caststate

Begin GameMode

If Talkstate == 0
if CRdrakeburnREF.getdistance player < 200
	StartConversation player
	set talkstate to 1
endif
endif

If caststate == 0
If CRdrakeburnREF.getdisposition player < 1 && CRdrakeburnREF.getav aggression == 50
	CRdrakeburnREF.cast CRdrakeburnsummon CRdrakeburnref
CRDrakeburnREF.placeatme CRCreatureSkeleton2 2, -200, 1
CRdrakeburnREF.placeatme CRCreatureSkeleton3 1, -200, 1
	set caststate to 1
endif
endif
end

Begin OnDeath

setstage CRdarkwizardhouse 50

end

 

I have him casting a spell (CRDrakeburnsummon as listed above) which runs the following script:

 

ScriptName CRraisedeadscript

short state

Begin GameMode

if state == 0
CRDrakeburnREF.placeatme CRCreatureSkeleton2 2, -200, 1
CRdrakeburnREF.placeatme CRCreatureSkeleton3 1, -200, 1
set state to 1 
endif

end

 

I just want one set of the skeletons placed by him, and for some reason the spell doesn't not do it on it's own, and if I leave the spell out, he doesn't do the motion and sounds for casting and they just appear. Also it seemed that if I engaged him in conversation before he engaged me, the condition would change and he wouldn't summon at all. So I can't figure out where the hangup here is. It seems that sometimes he summons 1 group, sometimes he summons 2 and sometimes he summons none, which is a problem because one of his henchmen has a quest item needed. :P

Link to comment
Share on other sites

PlaceAtMe as been banned by the Geneva Convention and is not used in mainstream mods. It can eventually cause enough bloat to ruin savegames so that people have to abandon their old characters and start new ones. To get the same effect as PlaceAtMe, mainstream mods generally enable initially disabled references or use MoveTo so that they can avoid having pariah status and reduced download count.

 

Why don't you place your trigger in a dialog info result script like the way the Shivering Isles Court Healer is set up? So you would set it up sort of like:

 

Dialog result script:

Set AAQuest.CastNow to 1

(Where AAQuestScript is attached to quest AAQuest.)

 

Quest script:

SCN AAQuestScript

Short CastNow

Begin GameMode
  If CastNow == 1        
       CRdrakeburnREF.cast CRdrakeburnsummon CRdrakeburnref
       CRDrakeburnREF.placeatme CRCreatureSkeleton2 2, -200, 1
       CRdrakeburnREF.placeatme CRCreatureSkeleton3 1, -200, 1
       Set CastNow to 2        
  Endif
End

Edited by David Brasher
Link to comment
Share on other sites

I think I'm just going to use the moveto function since that's what I use for the player version of the summon spell, but I am curious why placeatme has gotten so much guff, how does using placeatme for 5 items cause more save bloat than adding 5 references in the mod and enabling them or by using the additem player function? what is it mechanically that causes placeatme to cause so much more system load, it doesn't make sense. I did read up on it a bit but saw the workaround was a pain in the butt and just stopped reading. I guess I need to look at it again.

 

FG I will try the scripteffectstart function, thanks

Link to comment
Share on other sites

Basically, using MoveTo and the Enable/Disable functions would be recycling a reference. Using PlaceAtMe would be creating a new reference every time.

 

So, using MoveTo would only require 1 reference even if you use it a million times. Using PlaceAtMe would be creating 1,000,000 references if you use it a million times. Although if you're okay with using OBSE, the DeleteReference function solves that problem.

Link to comment
Share on other sites

The PlaceAtMe controversy is sort of another case of people jumping on the band wagon and thinking with their hearts and not with their heads. MoveTo and Enable/Disable do indeed create persistent references and cause savegame bloat. (Just like having traps, switches, scripts that refer to references, and NPCs with interesting AI packages causes savegame bloat, but nobody ever preaches against mods that include those things.)

 

But like fg109 says, it is a matter of degree. If your mod creates 5 PlaceAtMe references in a savegame, that is no big deal and does less damage than a lot of mods that do not use the command. But if a mod uses PlaceAtMe for a summoning spell that the player may use every 60 seconds while in combat, then you could get thousands of persistent references added to a savegame. So the most important thing would be to never use PlaceAtMe in a summoning spell that the player is given to use whenever he or she feels like it.

Link to comment
Share on other sites

Ya the pkaceatme is only used for those 3 references. The player summon spell that's learned after the fight brings between 3 and 6 creatures from a holding cell and moves, kills, ressurects, enables, disables as needed. So sounds like it's all just blown out of proportion, we just have to use it smartly and sparingly.
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...