ffbj wrote...
I've made things like a catapult shoot to a waypoint. So projectiles can be targeted to a waypoint. to To state that projectiles cannot be targeted to a waypoint is incorrect. Come to think of it I think I made some spells, such as fireballs also target to a waypoint. I suppose that is to an object so not technicaly a location. So if I had an object that I wan't to shoot a fireball too, and then chose to use it's location parameter instead of it's object parameter it would not work?
So you could just do object oTarget =GetWaypointByTag(string sWaypointTag)
and then randomize the waypoints in a specific area just to have some rocks being thrown into a general area, though this won't specifically solve the problem of hurl rocks, it could be done rather easily, without all the heavy alterations in the 2da, and the reqirement of a hackpack. Additionally you could create a waypoint based on the location of the PC and have rocks thrown to that waypoint, then destroying that waypoint and creating another one based on the PC's current location. So standing still would not be a good idea.
Well you could also do this through AI without waypoints.
void main()
{
if(Random(5)) return;//20% chance of firing
int n =1;
object oCreature = GetNearestObject(OBJECT_TYPE_CREATURE);
location lLoc;
while(GetIsObjectValid(oCreature))
{
if(GetIsEnemy(oCreature))
{
if(GetDistanceToObject(oCreature)<= 40.0)//Range of Spell
{
lLoc = GetLocation(oCreature);
ClearAllActions(TRUE);
ActionCastSpellAtLocation(775, lLoc, METAMAGIC_ANY, TRUE);
return;
}
else return;
}
n++;
oCreature = GetNearestObject(OBJECT_TYPE_CREATURE, OBJECT_SELF, n);
}
}
Note for the above you cannot rely on GetCasterLevel() in the spell script, as it will automatically use 10 as the caster level. Also there is the possible issue of this spell being interrupted or countered (by greater dispelling or mords). To prevent this use the talent system rather than the cheat cast above.
This script is simply placed as a custom AI script.
Also this script only prevents NPCs from using the rock throwing animation on a creature. To prevent PCs from using the rock animation on a creature, spells.2da needs to be edited.
Modifié par WhiZard, 21 août 2011 - 08:37 .