Aller au contenu

Photo

What do I need to do in order to be able to cast a light spell on enemies?


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

#1
andysks

andysks
  • Members
  • 1 650 messages

As the title says. I had a plan for a quest, only to figure out at the end that I cannot cast light at an enemy. I cannot change this. It's already too far ahead. Any solution?

 

Thanks a lot.



#2
Tchos

Tchos
  • Members
  • 5 054 messages

I think you'll need to edit spells.2da, and change the TargetType column of the Light spell to include enemies.  It's a bitwise number, so you add up all of the valid targets and use that total number:

  • 0x01 = 1 = Self
  • 0x02 = 2 = Creature
  • 0x04 = 4 = Area/Ground
  • 0x08 = 8 = Items
  • 0x10 = 16 = Doors
  • 0x20 = 32 = Placeables
  • 0x40 = 64 = Trap triggers (only when detected) and area transition triggers

Well, now that I look at it, I don't see an "enemies" there...

 

Maybe instead the Category needs to be changed to Harmful_Touch?

 

Or HostileSetting changed to 1.



#3
4760

4760
  • Members
  • 1 207 messages

now that I look at it, I don't see an "enemies" there...

 

 

 

Or HostileSetting changed to 1.

When I tried to add weapons firing ammo without overriding the slings and crossbows, I thought about using a spell for the trail, and "creatures" is good for enemies with HostileSetting set to 1.



#4
andysks

andysks
  • Members
  • 1 650 messages

Thanks for the info. I'll test it soon. Uhm, any way I could use this particular setting on the spells.2da only in one module of my campaign? I heard 2da files don't work from module directory. I wonder if a variable could be set there somehow on the modules properties? Or does anyone know if spells2da work from hak? That way I could associate a separate hak on this particular module.



#5
Mad.Hatter

Mad.Hatter
  • Members
  • 165 messages
spells. 2 da works from a Hak. you could associate that Hak with only one module in your campaign.

if it were important that you only be allowed to cast light on one creature in the entire module you could also edit the light script to only create the light effect if cast at the party or a specific npc tag.

#6
andysks

andysks
  • Members
  • 1 650 messages

Thanks MH. Good to know.

 

Alright, sells.2da collumn TargetType, I see what Tchos says, but it get confussing, Why do they add a letter there? Could it be that what makes the difference? For example:

 

Light = 0x2B

Lesser Restoration = 0x2B

 

While,

 

Harm = 0x2A

Greater Spell Breach = 0x2A

 

Some other include 0x2E or 0x2F.

 

All with 0x02 have a letter included. I guess it defines what we're talking about. From a quick search all buffs have the B. While all harmful spells have the A. The documentation about the 2da doesn't state anything about these letters, but I'll give it a shot and try the A on light.



#7
andysks

andysks
  • Members
  • 1 650 messages

Scrap that. If you change the B to A not even the PC can be targeted with the spell.



#8
Tchos

Tchos
  • Members
  • 5 054 messages

The letter is part of the number -- it's a hexadecimal number.  0x2B = 2B = 43 in decimal, which is 32, 8, 2, and 1 added together.  (Self, creature, items, and placeables).



#9
andysks

andysks
  • Members
  • 1 650 messages

Ah, so it shouldn't change anything.

 

Anyway, I did some trial and error.

 

Hostile setting allows indeed an enemy to be targeted. But it doesn't allow friendly target anymore. I changed the category to 2 = Harmful_Ranged, causing the same thing.

 

The category should play some role, right? But the light spell on the 2da has a default setting ****. On the documentation it doesn't state what this is for. Anyone knows?

 

Funny thing I noticed, from the document on spells.2da: "I have no idea how it is decided if one potion is a healing, beneficial or otherwise potion. iprp_spells.2da doesn't help. Speculation:" then goes on guessing. These are ChazM's notes :D. I guess developers had a hard time figuring out stuff as well.



#10
kevL

kevL
  • Members
  • 4 061 messages

http://nwn2.wikia.com/wiki/Spells.2da

category is used by the AI. ... i'd try a custom light script; you'll never get a spell to be targettable on friendlies and hostiles without two separate spells. Or changing the spellscript,

 

 

... even then it won't actually "target" both



#11
Dann-J

Dann-J
  • Members
  • 3 161 messages

Healing spells can target both allies and hostiles (or at least, hostile undead). All the non-mass healing spells seem to have a TargetType of 0x2B, and a Category of 5. They're not flagged as hostile though.

 

However, I notice the following note in the TargetType field description on the wiki:

 

"...certain rows are hard coded to ignore this and do both at once..."

 

I suppose healing spells might be some of those hardcoded spells (the dreaded 'H' word).



#12
kevL

kevL
  • Members
  • 4 061 messages

i wonder if NwNx4 can be used to Liberate some of those issues



#13
andysks

andysks
  • Members
  • 1 650 messages

That's out of my league. I guess I'll go with the solution to only cast on enemies. At least for now. Good thing is that the module I need this is the one that contains only the world map encounters, therefore no really dark areas. Mostly exteriors. Hopefully it won't be a problem. Thanks for the help :).