D - Your question doesn't make any sense to me. Each spell has a predetermined target area. Take Cone of Cold for instance. These things are decided by the spells. The players then place the targeting cone so the spell can be cast. The NPC can't place the targeting cone, so what the engine does is place the targeting cone where it feels is the most effective (i.e. hits the most targets), but it doesn't anchor the cone to the NPC. I have tried changing the radius, changing the range, changing the targeting flags, but the problem is that the engine will not anchor the cone to the NPC. Thus no matter how you change the specifics of the cone the engine will place the cone in the most effective way. The engine picks a target, the engine determines an area of effect, and the engine then places the targeting pattern. It places this targeting pattern based on the target and not on the caster, which is different than the way a PC does it. So the problem is that the cone is anchored to the initial target and not to the caster, thus the cone will often cover an area that is behind the caster. Does that make sense? This is exactly the way all area of effect spells are done in the computer. They work okay because they are round area of effects, the cone is not round and thuse causes all sorts of problems (same with the ray). As I said in my earlier post the funniest area effect spells cast by NPCs are rays. A ray is basically a straight line. The engine does not draw this line from the NPC to the target, but instead creates this line on the target going in whichever direction will hit as many targets as possible. Here is a diagram. caster = x the ray = -------- targets = y Normally it would look like this x--y---y---y--- but the engine doesn't anchor the ray to the NPC so the line is drawn independent of the caster and you instead get... --y--y--y--- x Also, please note the spell graphics for the spell will look correct, but the area of effect will be whack. So you get lots of targets that are NOT in the spell graphics area getting hit by the spell. It just looks wrong. - Livonya PS: I think my solution is to duplicate all the Cone spells for NPCs so that they are area of effect spells that are round. This way the are targeted makes some sense. I added Cone of Cold to Ice Lizards. But when they fire the Cone it goes in front of them, in back of them, all over the place. The Cone is SO MASSIVE that it pretty much hits every single item in the combat area. It just looks stupid. So the fix would be to have the Ice Lizard spit a ball of cold.... or just leave it as is... There is one other solution that I know of, but it would take some expert math skills. In theory it would be possible to write an equation that would calculate the location of the caster, the location of the main target, the area of effect, and then check to see if all targets hit by the spell are within this area... if they were not in this area then the spell would just pass over them. This sort of equation is beyond my skills at math. It would be pushing the limits of the scripting code, and would be extremely complicated, and I just can't do it. I'm not that smart. In my testing I was able to make it so that creatures outside of the sight of the caster were not effected by the spell (the were still targeted, but they get a free pass), however the downside is that invisible creatures are also given a free pass.
One other thing... By "ray" I do not mean a spell type like Ray of Enfebelement or Ray of Cold, etc, etc... those are actually spells that have procetiles. By "ray" I am talking about spell targeting like Chain of Lightning where you pick a long narrow area of effect. Instead of a Triangle (cone) or Circle (round) you get a Rectangle (ray). There are basically 3 types of area effects in TOEE: 1) round -- most common. Like Fireball, Silence, Web, Stinking Cloud, etc... 2) cone -- not so common. Like Cone of Cold, Burning Hands (yes, this is a cone as well) 3) ray -- not common. Like Chain Lightning - Livonya
Try looking at... ...how the 3rd level spell 'lightning bolt' does it. Targeting slews a beam about the caster in a 360 degree arc until released as a bolt of energy...about 5' wide, and as long as it can reach.
Livonya: I will try and get the math and target_list check done tomorrow. How would you like to exchange the py file for testing? -Firestrand
Firestrand - You think you can write an equation to do this? You would need to figure out the facing of the caster. I am not sure how to do that, but I am sure it can be done. If I recall there is a way to change an NPC's facing so there must be a way to call their facing direction. And from there you just extend the targeting area... I guess you get the idea or you wouldn't have said you can do it... I am not very good with using the locations in game and doing math from them... About all I can do is add or subtract from the location, I have a hard time writing a calculation that will seperate the x and y accurately. Anyway, if you can write the calculation all you need to do is post it in the body of your e-mail. I can then cut and paste it into the spell py and see if I can make it work. Or you can just attachee it to a Private Message and send it to me... If you can write this code and if I can get it working in the spell it will be a big improvement for NPC targetting. I can fix 3 or 4 spells that can work goofy when NPCs use them. That would be great... These sorts of advanced calculations are where I get lost... I am really good with scripting code but the math part really goes over my head at times... it has been nearly 20 years since I took any advanced math classes in college... since then I have become dependent on calculators. - Livonya
It sounds like the spell effects are done a lot differently than I would have expected. I (wrongly) presumed that cone of cold's affects were being calculated by a python script, using the obj_list_cone() call, centered on the npc and (automatically) cast out the direction the npc is facing; much as the different "Detect X" spells are done. I was hoping that it was simply a misunderstanding about how that call works, in that it MIGHT be presumed that the two arguments to the call that determine the arc actually refer to a set cardinal, or two spots on the cardinal, when in fact that represent an offset angle from the obj's facing vector (representing the "left" vector of the arc), and a rotation about the obj to arrive at the other limit (the "right" vector). Darn. I wonder if you couldn't "simulate" the right effects using a script, though. (betcha could ) -- dul
The facing of a "critter" (pc/npc) should be available with the obj.rotation property (it's settable and gettable). [side note: as Liv points out, it's settable relative to a second obj with the obj.turn_towards(obj2) call] I came in late, there's context lacking to your conversation, but it almost sounds like you're trying to rewrite the effects of the obj_list_cone() call? Or is this something else? -- dul
I actually have never seen this: obj_list_cone() This is not something that is within the py. script anywhere. The way the target flags and area effected are determined are by the spell rules file which is contained in the spells folder in the rules folder. Each spell has it's own file and that explains how the targeting works. The problem is that the engine was only really designed to have the PC determine the actual placement of the targetting area. When the NPC does it the placement does not make "sense" to me as a player. The mechanics behind this are hidden away and are not actually in the spell script or any other script that I know of. - Livonya
Take a look at the detect spells for obj_list_cone() I have something almost worked out. I will post tomorrow is someone else hasn't already finished something. If that doesn't work I can always do the math. -Firestrand
Hmm... See: Spell110 - Detect Chaos.py Spell111 - Detect Evil.py Spell112 - Detect Good.py Spell113 - Detect Law.py Spell114 - Detect Magic.py Spell117 - Detect Secret Doors.py Spell120 - Detect Undead.py Spell508 - True Seeing.py Syntax is: game.obj_list_cone(obj, t, r, a, theta) The call creates a list of objects of the specified type t, such as OLC_CRITTERS -- a list of all critters in the cone; based off the object obj, within radius r, starting at angle a (0 is along the vector of the direction obj is facing) relative to 0, rotated through angle theta. For example, crits = game.obj_list_cone( spell.caster, OLC_CRITTERS, spell.range_exact, -45, 90 ) creates a list crits, of all the critters in the cone defined starting at the spell-caster's location, extending out "spell.range_exact" from the front of the spellcaster (along the direction s/he's facing), a cone that's 90 degrees "around", 45 of them to the left of his/er line of sight, and 45 to the other side. Code: _x_ _-- | --_ \ | / \ | / \ | / \ | / c c is the caster, the distance from c to x is the spell's range (spell.range_exact), and the cone is -45 degrees off c's line of sight, and extends 90 degrees around in total. note that a =0 and theta = 360 makes the operation into a circle (and one of the scripts does this) If you want to control how the cone is "aimed", you might have the npc do a turn_towards() on the pc he's casting at before casting the spell (and add a .py script to cause the effects of the spell), and it'll do exactly what you'd want, I'd think. HTH, -- dulcaoin
D - The only thing that concerns me is that none of these spells work properly. These detect spells are not done the way other spells are done, and they only work if you cast the spell on your PC before you enter a new map. If you cast the spell after you enter a map it won't actually do anything. But it is an intersting idea, and I will see if I can't use it to solve my problem. thanks - Livonya
I tried using this, but couldn't get it to do anything. Not sure what the problem is... I am attaching my test spell script... Any help you can give me would help? I am sure it is something simple, or it will be something that doesn't work... Who knows... - Livonya
Issue 1) You have this line: for obj in game.obj_list_cone( target_item.obj, OLC_CRITTERS, range, -45, 90 ): That's forming a cone off of the target of the spell. Why do that? That's kinda been your complaint, that the cone isn't being doing properly. Why did you use target_item.obj instead of spell.caster? Issue 2) You exempt object 14309 from the effects. I'm presuming this is the NPC who can cast Petrifying Breath? Well, you're locking in this spell so it's not general purpose by doing this. If that's what you're trying to do, then you should compare obj (from your for command) to spell.caster, to make sure that it's simply not affecting the spell caster, not any object that happens to be 14309. Also, the argument (if, again, I'm right, and you're trying to exempt 14309, or the spell caster) to spell.target_list.remove_target( ) should simply be "obj" -- that's commented out, of course, I'm just being thorough. 3) you should comment out "spell.target_list.remove_list( remove_list )", you're passing it a non-existent list (all other remove_list operations have been commented out) -- dul P.S. Side note: I know you're just modifying existing code, but it's funny to see all these print statements everywhere. I REALLY wish we had a way to capture and display those darned things. :-/
Dul - Actually, I don't think this is going to work at all... at least that is my hunch. The cone created for this spell is an actual spell effect, and not an area of effect, but maybe that won't matter. I used the cone code as it was in the original spell, but I will try your suggestions and see if anything works... - Livonya