Creatures and Special Abilities
#1
Posté 06 mars 2011 - 02:46
Could anyone please help me?
Thank you.
#2
Posté 06 mars 2011 - 02:53
Your problem is in immobility, the AI doesn't use any spell or special ability if the creature is immobilized and tries just to attack in melee. (I'm solving this for my Community Patch project btw)
Even then the usage of the special ability is still not 100%. Mostly if player reach in melee range, creature starts attacking in melee again. The AI is just stupid. In order to make things work exactly as you want you need script. Either you will make a trigger around three and then you assign to cast the spell to the tree, so no invisible creature is needed or you will make special AI for your invisible creature.
I can help you with the AI, just tell me the name of the special ability and I will provide you the AI script and howto set it. (But still first approach would be better and more "clean")
Modifié par ShaDoOoW, 06 mars 2011 - 02:54 .
#3
Posté 06 mars 2011 - 03:31
The abilities I'm trying to use are acid bolts and poison bolts, as well as acid breath and poison breath for close range. My scripting abilites are limited, but I can make scripts with the script generator. I thought of the enter area of a trigger script to cast a spell, but it does not include acid or poison bolts, and since this is for high level characters, the other spells did not have much effect when I tried it. Also the script generator does not make script to keep casting the spell while you're still in the area. I even tried an ondeath script to respawn the tree after ten minutes, but it did not work. That's why I tried the invisible creature.
Modifié par Sadira of Tyr, 06 mars 2011 - 03:35 .
#4
Posté 06 mars 2011 - 04:06
#include "x2_inc_switches"
#include "nw_i0_generic"
void main()
{
SetCreatureOverrideAIScriptFinished(OBJECT_SELF);
object oEnemy = GetNearestEnemy();
if(GetIsObjectValid(oEnemy))
{
ClearAllActions();
float fRange = GetDistanceBetween(OBJECT_SELF,oEnemy);
if(fRange > 8.0)//long distance
{
if(GetHasSpell(SPELLABILITY_BOLT_ACID) && GetHasSpell(SPELLABILITY_BOLT_POISON))
{//has both so choose random one
ActionCastSpellAtObject(d2() == 2 ? SPELLABILITY_BOLT_ACID : SPELLABILITY_BOLT_POISON,oEnemy);
return;
}
else if(GetHasSpell(SPELLABILITY_BOLT_ACID))
{
ActionCastSpellAtObject(SPELLABILITY_BOLT_ACID,oEnemy);
return;
}
else if(GetHasSpell(SPELLABILITY_BOLT_POISON))
{
ActionCastSpellAtObject(SPELLABILITY_BOLT_POISON,oEnemy);
return;
}
}
else//short distance
{
if(GetHasSpell(SPELLABILITY_CONE_ACID) && GetHasSpell(SPELLABILITY_CONE_POISON))
{//has both so choose random one
ActionCastSpellAtObject(d2() == 2 ? SPELLABILITY_CONE_ACID : SPELLABILITY_CONE_POISON,oEnemy);
return;
}
else if(GetHasSpell(SPELLABILITY_CONE_ACID))
{
ActionCastSpellAtObject(SPELLABILITY_CONE_ACID,oEnemy);
return;
}
else if(GetHasSpell(SPELLABILITY_CONE_POISON))
{
ActionCastSpellAtObject(SPELLABILITY_CONE_POISON,oEnemy);
return;
}
}
ActionAttack(oEnemy);
}
}
ok so go into script editor past this script and save it under some name, since I am author it would be kind to use my prefix like "sh_ai_treeimp" and compile it.
so now you must set this script into your "Tree Imp"
X2_SPECIAL_COMBAT_AI_SCRIPT | string | sh_ai_treeimp
now it should work, test it, I tried it and it worked just fine
Modifié par ShaDoOoW, 06 mars 2011 - 04:08 .
#5
Posté 06 mars 2011 - 05:41
#6
Posté 06 mars 2011 - 07:38
I decided that the best solution would be to change the range from 8 to 1. Now it fires the bolts all the time, and kept firing them even at melee range. It works great like this, so I am happy with it.
Thank you very much for your time in helping me Shadooow.
Oh, and I decided to use your full name for naming the script. I called it shadooowtree_ai.
#7
Posté 06 mars 2011 - 08:14
Just BTW, I have tracked this issue down and found out that its a bug in hardcoded function GetCreatureTalent* which doesn't return valid talent if the creature is immobile. Nothing I can do with it... But custom AIs that doesnt use this function Jasperre's probably Tony K ? should work.ShaDoOoW wrote...
Your problem is in immobility, the AI doesn't use any spell or special ability if the creature is immobilized and tries just to attack in melee. (I'm solving this for my Community Patch project btw)
#8
Posté 06 mars 2011 - 08:18
Hmm maybe you used a different breaths?Sadira of Tyr wrote...
Well, I have tested the script, and it worked great at long range. It fired both bolts in random order. However when I moved closer, it did not use the cones, and when I moved even closer, it started to melee. I am not sure why it would not use the cones, since I put 99 of each one.
I set it to check for special ability Cone of acid and Cone of poison. If you are using Dragon breath or Mestils acid breath, or anything else it wont work, but I can adjust it for these, just tell me exact name from toolset.
#9
Posté 06 mars 2011 - 11:07
#10
Posté 07 mars 2011 - 12:32
#11
Posté 07 mars 2011 - 11:00
For some reason, scripts like to mess with me. I have made a lot of scripts, and most of them work fine, but some just don't want to work when they should work. Scripts for spawning placeables or destroying placeables always like to give me troubles, especially when using delay commands.It always seems to frustrate me, but I am getting used to it now. lol





Retour en haut






