Trying to create placeables
Posted: Sat Dec 13, 2003 3:18 am
Alright, I'm having trouble creating a placeable. I'm trying to write a script so that when someone dies, they leave behind a corpse. Why? Because I want to know how to do it! Looking at others' scripts don't help me; I have to do it myself to understand it well.
Here is the bit of script that I am having trouble with:
if (GetCurrentHitPoints() <= -10)
{
location lDying;
lDying = GetLocation(oDying);
PlayVoiceChat(VOICE_CHAT_DEATH);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), OBJECT_SELF);
CreateObject(OBJECT_TYPE_PLACEABLE, "q_pccorpse01", lDying, FALSE, GetName(oDying)+"corpse");
SendMessageToPC(oDying, "Your soul flows out of your body.");
DelayCommand(1.0, AssignCommand(oDying, ClearAllActions()));
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oDying);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oDying)), oDying);
AssignCommand(oDying, JumpToLocation(GetLocation(GetObjectByTag("wp_deathtravel"))));
}
What am I doing wrong? I suspect I am making some sort of mistake on this line:
CreateObject(OBJECT_TYPE_PLACEABLE, "q_pccorpse01", lDying, FALSE, GetName(oDying)+"corpse");
The thing I am trying to create has both a tag and resref of "q_pccorpse01" (without the quotes). Maybe I should use GetObjectByTag("q_pccorpse01"), but that seems like it wouldn't work any better? What am I doing wrong?
Here is the bit of script that I am having trouble with:
if (GetCurrentHitPoints() <= -10)
{
location lDying;
lDying = GetLocation(oDying);
PlayVoiceChat(VOICE_CHAT_DEATH);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectVisualEffect(VFX_IMP_DEATH), OBJECT_SELF);
CreateObject(OBJECT_TYPE_PLACEABLE, "q_pccorpse01", lDying, FALSE, GetName(oDying)+"corpse");
SendMessageToPC(oDying, "Your soul flows out of your body.");
DelayCommand(1.0, AssignCommand(oDying, ClearAllActions()));
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectResurrection(), oDying);
ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectHeal(GetMaxHitPoints(oDying)), oDying);
AssignCommand(oDying, JumpToLocation(GetLocation(GetObjectByTag("wp_deathtravel"))));
}
What am I doing wrong? I suspect I am making some sort of mistake on this line:
CreateObject(OBJECT_TYPE_PLACEABLE, "q_pccorpse01", lDying, FALSE, GetName(oDying)+"corpse");
The thing I am trying to create has both a tag and resref of "q_pccorpse01" (without the quotes). Maybe I should use GetObjectByTag("q_pccorpse01"), but that seems like it wouldn't work any better? What am I doing wrong?