I’m trying to do stuff again that NWN2 wasn’t supposed to do, I think.
I have a target (a placeable) that’s too far away for the characters (the companions and maybe the PC depending on if he has spells that you can cast over a long distance) to cast a spell upon. Is there some way to fool the game that the target is closer and let the companions cast a spell on that object anyway, so that it is destroyed? Or maybe that would mess with animations casting spells and stuff? I think that probably doing something like this would normally include modifying a 2da file, but I just want this to be a temporary thing.
how are you ‘telling’ the companions to cast a spell at the placeable? eg Conversation?
it can be scripted (dialog action script). But then, yes you gotta do the casting animation and essentially copy relevant code from the spellscript ( vFx etc. )
then decrement the spell in the caster’s memorized spells …
Well, it’s like this. The PC and the companions get imprisoned. I wanted to have some kind of puzzle or something for them to get out without just having to pick the lock. So there is a “device” that shoots a beam onto the lock. In my custom world it is supposed to look like some kind of magic lock. The player then has to figure out to throw a spell at the target that damages it so that they can get out. It might be a bit lame, but that was all that I could come up with that felt at least a tiny bit original. The unfortunate part in this is that there are only two spell casters in this part of the module and it’s a favoured soul and a warlock. They don’t have spells that are long distance. So the spells won’t be cast through a conversation since then I will spoil the “puzzle”.
EDIT: I actually found a way to move the placeable closer. I have another problem now, though. If the player doesn’t choose any attack spells when leveling up the favoured soul character throughout the module, we have a problem because then they will be stuck. I’ll have to think about this.
Usually, a scroll hidden behind a loose brick fits the bill And the scroll doesn’t have to be the required spell (it could be a “summon creature” type, and the creature can be asked to destroy the device etc…)
Good idea, 4760. I might actually go with something like this.
My original idea was to tell the player that he has to have a certain companion in the party but it would have been nice to have a way around that. Not everyone can use a “Summon creature” spell though, I think? But maybe there’s a way around that by making something custom? Maybe that’s what you meant…
I could also do that you have to search the area to find the scroll, something that the player might realize after being stuck for a short while.
I tried what you suggested @4760 but it seems when you have a summoned creature (I actually just used a copy of Summon Creature III) you can’t (I think) make the summoned creature bash the placeable. Maybe the summoned only attacks other creatures that are hostile to the party…
Well, the “summon creature” could just be a custom scroll (item from NWN2 point of view), as you said (right-click, activate → anybody will be able to use it), and when used/activated (then the script i_specialscrolltag_ac will be fired - assuming of course you tag of the scroll is “specialscrolltag”) you could probably have some cutscene where the summoned creature attacks the device. You’ll solve both issues that way.
Or, if you don’t want the cutscene part, the scroll will summon a unique creature, which will have a custom script when talked to that makes it attack the device (something like “after a few moments, the creature understands you want it to attack the device” or, if the PC is not a druid, “after a few moments, the creature is so angry of being disturbed that it tries to attack you, and not being able to do so it destroys the device in frustration”).
I’m thinking of maybe just have the creature attacking the placeable. But, as it is now, the scroll uses the Cast Spell: Summon Creature III. When using that cast spell thing, is that the same as acitivating the scroll? In that case I could do a i_specialscrolltag_ac that makes it attacking the placeable perhaps?
EDIT: Urrgh, this wasn’t easy. I have to know the tag of the summoned creature to have it attack the placeable and I don’t think there’s a possiblity to know that, is there?
EDIT2: If I’m to summon a unique creature I will have to script the whole thing then won’t I? It would have been so nice to make use of the effect and everything that comes with the Summon Creature III spell.
EDIT3: I would rather not have to script the whole thing of what creature is to be summoned and then have it do the task of attacking. Why? Since then it will just appear without any flashes and bangs (I’m not good at creating effects similar to what happens ingame when summoning a creature) and the player might not even understand it was he who summoned it. (Why does NWN2 always have to be so hard as soon as you do something a tiny bit outside of what it usually does. It’s so frustrating).
As long as NwN 2 inherited all of NwN’s script functions there’s
string GetTag(object oObject);
Why not have a unique wand with just a single charge left, hidden behind a loose stone in the cell then? Only activatable via conversation and just script the lock blowing up?
This function exists, but I don’t know how this would help me in this case since I don’t know the summoned creature’s tag.
On the scroll’s item properties there’s the Cast Spell: Summon Creature III (5) which usually summons a dire wolf of some kind, but I don’t know the tag of this particular dire wolf, I’m afraid.
EDIT: I tested doing a i_summoncrscroll_ac when using the scroll (it has the tag summoncrscroll) since it seems (but I’m not sure) that when you summon the creature, you activate the item (at least it’s the same symbol ingame, I believe) but the script won’t run (I even did a SendMessageToPC to confirm that it doesn’t run). I guess this means you’re not activating the item; you’re instead casting a spell.
EDIT2: Alright, I might have found something. The function EffectSummonCreature seems to do what I want. I’ll fiddle around with it.
EDIT3: I have no what’s going on anymore. I changed the whole Cast Spell: Summon Creature III (5) to Cast Spell: Unique Power(Single Use) but when I activate the item now, the i_summoncrscroll_ac is not running even though it should. I get no message so I know that script isn’t running (and nothing’s happening for some odd reason). I’m so tired of this.
Got the script to (finally!) run. Don’t know exactly what was wrong before. However, nothing happens that I have scripted so the content of the script is wrong (even though the script in itself is running):
The resref of the object to create from the pallet
lLocation
The location to create the object at
bUseAppearAnimation
If TRUE, it will play EffectAppear() when created - the creatures appear animation will play
(Default: FALSE)
sNewTag
If this string is not empty, it will replace the default tag from the template (Default: “”)
Couple of things to note about that function (just in case you missed them) -
You can set the tag of the creature to something other than the creatures default one.
You can set it to use it’s default appearance animation on spawn in, so you do.
@Tarot_Redhand What you are saying here I already know. It seems that we are talking about different things. Again I quote myself:
When creating this creature I cast the spell
that’s why this thing is complicated. I’m not doing a script using CreateObject (I’ve used the CreateObject functions many times before so I know what it’s all about)
All this is irrelevant now though since, as you see in my latest post, I went from just using the Cast Spell: Summon Creature III (5) spell on the creature to instead using Cast Spell: Unique Power(Single Use). And with that I could use the i_summoncrscroll_ac spell that is run when using that Unique Power spell. I guess I could have used the CreateObject function in my i_summoncrscroll_ac script, but if you have read my previous posts, you would know I wanted to have all the effects (not sure you know about them if you haven’t played NWN2) that comes with summoning a creature. That’s why I instead in my script used EffectSummonCreature since - according to the explanation of the function in the script assist in the toolset - seemed like it would create an object/creature with all the shebangs (just like the CreateObject function does but without shebangs) but nothing happens when running my script, so that doesn’t seem to be the case.
EDIT: I also want the summoned creature to be just that, to be part of the party so to speak. EffectSummonCreature is said to do that but…well, nothing happens
Perhaps @kevL_s or @travus would know anything about this function? Maybe I’m using it wrong in my script somehow? Maybe I can’t do a ApplyEffectAtLocation with this effect?
EDIT2: I just noticed this in the NWNLexicon. It actually explains a few things about EffectSummonCreature: “Can only be applied from creature objects (PC or NPC), no other objects.”
I’ll probably be able to solve it now. But that will have to wait until later tonight.
i haven’t been following this much but I think what Tarot is getting at is that, if you do go with CreateObject() you can specify a unique tag for the created object – like “tag_of_object_that_i_want_later” → GetObjectByTag()
Have a mad old prisoner tied up in the cell having been there for years and forgotten, get him some nice juicy insects to chew on and let him do the spell because he was a mage and got put there for some sort of magic crime.
You can then use fake spells and effects to destroy the object when he finally stops chewing his beetles and does the spell.