I'm trying to set up a bonfire to deal damage to whomever is within its radius. I guess a heartbeat script would be the way to go, as the damage has to occur at a regular interval.
So, question #1: what should I script to make this happen?
Question #2: should I place the script on the bonfire placeable or in a trigger?
Question #3: is there a better option to make the damage apply at a faster interval?
-UP
Bonfire Damage
Débuté par
UltimaPhoenix
, févr. 25 2011 01:30
#1
Posté 25 février 2011 - 01:30
#2
Posté 25 février 2011 - 03:13
Q2: Put it on a trigger that surrounds the fire.
Q1: I'd have the script OnEnter that checks if any creature is within X distance of the fire and if so, apply fire damage.
Q3: Have the OnEnter fire off a pseudo-heartbeat every 1 or 2 seconds until is detects no creatures within range.
If you need more help/ideas let us know.
Q1: I'd have the script OnEnter that checks if any creature is within X distance of the fire and if so, apply fire damage.
Q3: Have the OnEnter fire off a pseudo-heartbeat every 1 or 2 seconds until is detects no creatures within range.
If you need more help/ideas let us know.
#3
Posté 25 février 2011 - 03:22
In the OC there is a trigger script called nw2_t1_firebaby that applies fire damage.
//::///////////////////////////////////////////////
//:: Baby Fire Trap
//:: nw2_t1_firebaby
//:: Copyright (c) 2005 Obsidian Entertainment.
//:://////////////////////////////////////////////
/*
Does 1d2 damage to all within 5 ft.
*/
//:://////////////////////////////////////////////
//:: Created By: John Lee
//:: Created On: October 6, 2005
//:://////////////////////////////////////////////
//DBR 3/16/6 - restructed, now occurs every set number of seconds
#include "NW_I0_SPELLS"
void DoDamage(object oTarget)
{
effect eVis = EffectVisualEffect(VFX_IMP_FLAME_M);
effect eDam;
int nDamage;
int nSaveDC = 10;
//Roll damage
nDamage = d2(1);
//Adjust the trap damage based on the feats of the target
if(!MySavingThrow(SAVING_THROW_REFLEX, oTarget, nSaveDC, SAVING_THROW_TYPE_TRAP))
{
if (GetHasFeat(FEAT_IMPROVED_EVASION, oTarget))
{
nDamage /= 2;
}
}
else if (GetHasFeat(FEAT_EVASION, oTarget) || GetHasFeat(FEAT_IMPROVED_EVASION, oTarget))
nDamage = 0;
else
nDamage /= 2;
if (nDamage > 0)
{
if (nDamage > 0)
{
//Apply effects to the target.
if (GetIsPC(oTarget))
{
eDam = EffectDamage(nDamage, DAMAGE_TYPE_FIRE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eVis, oTarget);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eDam, oTarget);
}
}
}
}
void InFire(object oTrap, float fPainInterval)
{
object oIter = GetFirstInPersistentObject(oTrap,OBJECT_TYPE_CREATURE);
while (GetIsObjectValid(oIter))
{
if (oIter==OBJECT_SELF)
{
DoDamage(OBJECT_SELF);
DelayCommand(fPainInterval,InFire(oTrap,fPainInterval));
return;
}
oIter=GetNextInPersistentObject(oTrap,OBJECT_TYPE_CREATURE);
}
}
void main()
{
//Declare major variables
object oTarget = GetEnteringObject();
object oTrap = OBJECT_SELF;
if(!GetIsReactionTypeFriendly(oTarget))
{
float fPainInterval=GetLocalFloat(OBJECT_SELF,"PainInterval");
DoDamage(oTarget);
AssignCommand(oTarget,DelayCommand(fPainInterval,InFire(oTrap,fPainInterval)));
//AssignCommand(oTarget,InFire(OBJECT_SELF,fPainInterval));
}
}
Modifié par Kaldor Silverwand, 25 février 2011 - 03:24 .
#4
Posté 26 février 2011 - 09:15
Super simple version. Kinda going with what Knightmare suggested. Put a trigger around the bonfire.
Bonefire's OnEnter:
const float BURN_INTERVAL = 2.0;
const int BURN_DAMAGE = 10;
void Burn(object oObject)
{
if (GetLocalInt(oObject, "NEAR_FIRE") != TRUE) return;
effect eFire = EffectDamage(BURN_DAMAGE, DAMAGE_TYPE_FIRE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eFire, oObject);
DelayCommand(BURN_INTERVAL, Burn(oObject));
}
void main()
{
object oPC = GetEnteringObject();
SetLocalInt(oPC, "NEAR_FIRE", TRUE);
Burn(oPC);
}
Bonfire's OnExit:
void main()
{
object oPC = GetExitingObject();
SetLocalInt(oPC, "NEAR_FIRE", FALSE);
}
That should do it. Hope that helps and good luck.
Bonefire's OnEnter:
const float BURN_INTERVAL = 2.0;
const int BURN_DAMAGE = 10;
void Burn(object oObject)
{
if (GetLocalInt(oObject, "NEAR_FIRE") != TRUE) return;
effect eFire = EffectDamage(BURN_DAMAGE, DAMAGE_TYPE_FIRE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, eFire, oObject);
DelayCommand(BURN_INTERVAL, Burn(oObject));
}
void main()
{
object oPC = GetEnteringObject();
SetLocalInt(oPC, "NEAR_FIRE", TRUE);
Burn(oPC);
}
Bonfire's OnExit:
void main()
{
object oPC = GetExitingObject();
SetLocalInt(oPC, "NEAR_FIRE", FALSE);
}
That should do it. Hope that helps and good luck.
Modifié par GhostOfGod, 26 février 2011 - 09:15 .
#5
Posté 01 mars 2011 - 08:41
I've been sick lately, so I haven't had the chance to thank you guys for the help. GhostOfGod's scripts and idea worked perfectly! Thank you each again!
-UP
-UP





Retour en haut






