LucidMagic.net

Neverwinter Nights => NwN Building => Script Request => Topic started by: fireknight40 on January 14, 2005, 10:59:20 PM

Title: Uhm a few more questions...
Post by: fireknight40 on January 14, 2005, 10:59:20 PM
Uhm... yeah this is gonna sound completely stupid, but... I'm trying to make a usable placeable (most likely ballista) that will fire magic missile or fireball (either one is fine {kinda prefer the fireball myself}) at random players in the area(yet doesn't fire at anyone using the ballista or in their paryty)? Also I can't find the ResRef of a custom creatue, does anyone know how to?
Title: Uhm a few more questions...
Post by: CleTus on January 15, 2005, 12:02:16 AM
The resref is in the advanced tab in creature properties.. Very top.. Also, could you post the script that you tried? I think it would be better to show you how to fix it rather than making one myself.. If you prefer.
Title: Uhm a few more questions...
Post by: fireknight40 on January 16, 2005, 04:47:36 PM
Code: [Select]
void main()
{


// iDamage is the random amount of damage done to the enemy (2d20)
int iDamage = d20(2);
// oSelf is the catapult (object_self)
object oSelf = OBJECT_SELF;
// fMaxrange is the maximum range for the catapult
float fMaxrange = 25.0;
// eFireball is the damage the cannon does (bludgeoning)
effect eFireball = EffectDamage(iDamage, DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_NORMAL);
// oMonster is the nearest enemy creature (reputation dependant on the faction of the catapult)
object oMonster = GetNearestCreature(CREATURE_TYPE_REPUTATION, REPUTATION_TYPE_ENEMY, OBJECT_SELF, 1, -1, -1, -1, -1);
// This get's the current position of the target to face
vector vMonsterPos = GetPosition(oMonster);


    // Check to see if the monster is an enemy of the catapult (not user)
    if (GetIsEnemy (oMonster, OBJECT_SELF) == TRUE)
    {
        // Check to see if monster is in range
        if (GetDistanceBetween (oMonster, OBJECT_SELF) < fMaxrange)
        // Checks to see if the reload time is finished, or "True"
        if ( GetLocalInt(oSelf, "fire") == TRUE)
        {
            // The actual firing of the cannon, spell effect & damage
            SetFacingPoint(vMonsterPos);
            DelayCommand(1.5, ActionDoCommand(ApplyEffectToObject(DURATION_TYPE_INSTANT, eFireball, oMonster, 0.0f)));
            ActionCastSpellAtObject(SPELL_FIREBALL, oMonster, METAMAGIC_ANY, TRUE, 10, PROJECTILE_PATH_TYPE_BALLISTIC, FALSE);
            SetLocalInt(oSelf, "fire", FALSE);
        }
    }
    // Check if monsters are not in range
    if (GetDistanceBetween (oMonster, OBJECT_SELF) > fMaxrange)
    {
        // If no enemies in range, tell player
        ActionSpeakString("No enemy objects in range!");
    }
    if (OBJECT_INVALID == oMonster)
    {
        // If no enemies in area, tell player
        ActionSpeakString("No enemy objects in range!");
    }
    // Checks to see if the reload time is not finished, or "False"
    if ( GetLocalInt(oSelf, "fire") == FALSE)
    {
        // If still reloading, tell player
        ActionSpeakString("Reloading Magipult....");
    }

}

Okay i got this one off of NWVault. It just doesn't do as much damage as i want it to do. which pretty much is an instant-kill is what I want. It works perfectly other then that.
Title: Uhm a few more questions...
Post by: Illutian on January 16, 2005, 10:58:33 PM
have u tried using the dmg of the Harm(modified if u want) that way it'll cause the same dmg display(Uninjured-Near Death) to all lvl of players
Title: Uhm a few more questions...
Post by: |- Shion -| on January 16, 2005, 11:37:42 PM
u tried the EffectDeath = TRUE command?? cause if ya remove the fireball effect and make a one new variable to that command can kill instatly without doing any damage. Or ya can change that line

// eFireball is the damage the cannon does (bludgeoning)
effect eFireball = EffectDamage(iDamage, DAMAGE_TYPE_BLUDGEONING, DAMAGE_POWER_NORMAL);

that line is using a variable idamage with his roll check and his own respecting types , there u can insert a command between the (  ) after DAMAGE_POWER_NORMAL to any value of damage than ya want . He will do the damage as the script asks
Title: Uhm a few more questions...
Post by: fireknight40 on January 17, 2005, 03:19:30 AM
Thanks but... Khadgar I dunno how to do that and Shion I have no idea what you mean (sorry i'm and idiot)