Aller au contenu

Photo

Respawn object help?


  • Veuillez vous connecter pour répondre
2 réponses à ce sujet

#1
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
I have a statue ..with this script in the ondeath.
question: If a PC smashes the statue it respawns ....BUT if it is destroyed by my other script when someone clicks on a door it does not respawn .
I need this statue to respawn after being destroyed .....




void RespawnObject(string sResRef, int iType, location lLoc) {
CreateObject(iType, sResRef, lLoc);
}
void main()
{
string sResRef = GetResRef(OBJECT_SELF);
int iType = GetObjectType(OBJECT_SELF);
// For creatures, save the location at spawn-time as a local location and
// use it instead. Otherwise, the creature will respawn where it died.
// No changes are required for placeables as they do not move (usually ;-)
location lLoc =GetLocation(OBJECT_SELF);
float fDelay = 10.0;  // 5 minute delay; adjust as desired
AssignCommand(GetModule(), DelayCommand(fDelay, RespawnObject(sResRef, iType, lLoc)));
}
 

#2
420

420
  • Members
  • 190 messages

Knight_Shield wrote...

I have a statue ..with this script in the ondeath.
question: If a PC smashes the statue it respawns ....BUT if it is destroyed by my other script when someone clicks on a door it does not respawn .
I need this statue to respawn after being destroyed .....
 

I don't think the DestroyObject() function triggers a placeable's OnDeath event. You'll have to use something like this to destroy the statue:
object oStatue = GetObjectByTag("StatueTag");
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(GetCurrentHitPoints(oStatue)), oStatue);

-420

#3
Knight_Shield

Knight_Shield
  • Members
  • 444 messages
It works really good ...thnx 420 ! ! ! This is for my exploding Monster Statues muwahaha