Author Topic: NPC Spawns Unconscious and Near Death  (Read 339 times)

Legacy_Souldry

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
NPC Spawns Unconscious and Near Death
« on: June 29, 2011, 01:40:55 am »


               Can someone make an on spawn script where the npc spawns laying down and near death? Thank you.
               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
NPC Spawns Unconscious and Near Death
« Reply #1 on: June 29, 2011, 06:43:02 am »


               void main()
{
    object oRespawner = GetLastRespawnButtonPresser();
    ApplyEffectToObject(DURATION_TYPE_INSTANT,EffectResurrection(),oRespawner);
    AssignCommand(oRespawner, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_BACK, 1.0, 10000.00));
}
               
               

               
            

Legacy_Xardex

  • Sr. Member
  • ****
  • Posts: 414
  • Karma: +0/-0
NPC Spawns Unconscious and Near Death
« Reply #2 on: June 29, 2011, 10:17:34 am »


               EffectResurrection only works if the creature is dead, and killing it first might launch some unwanted OnDeath scripts. Also, GetLastRespawnButtonPresser only works in module 'on pc death' script for players who actually press the respawn button on the death gui

void main()
{
    object oNPC = OBJECT_SELF;
    ApplyEffectToObject(DURATION_TYPE_INSTANT, SupernaturalEffect(EffectDamage(GetCurrentHitPoints(oNPC)-1)), oNPC);
    AssignCommand(oNPC, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_BACK, 1.0, 10000.00));
}


               
               

               
            

Legacy_GhostOfGod

  • Hero Member
  • *****
  • Posts: 1490
  • Karma: +0/-0
NPC Spawns Unconscious and Near Death
« Reply #3 on: June 29, 2011, 11:08:34 am »


               Doh...it's just me trying to do things while sleepy and not paying attention. I was thinking PC instead of NPC when I first read it. Yeah..Xardex's script is what you want for NPC. Sorry bout that.':whistle:'
               
               

               


                     Modifié par GhostOfGod, 29 juin 2011 - 10:10 .
                     
                  


            

Legacy_Souldry

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
NPC Spawns Unconscious and Near Death
« Reply #4 on: June 30, 2011, 05:27:22 pm »


               Is there any way the script could allow the NPC to stay laying down after the PC clicks on him? I've noticed he stands back up when clicked.
               
               

               
            

Legacy_Snarkblat

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
NPC Spawns Unconscious and Near Death
« Reply #5 on: June 30, 2011, 10:04:16 pm »


               In that case you want to add this line in your NPC's script:

SetCommandable(FALSE);
               
               

               
            

Legacy_Snarkblat

  • Full Member
  • ***
  • Posts: 104
  • Karma: +0/-0
NPC Spawns Unconscious and Near Death
« Reply #6 on: June 30, 2011, 10:05:37 pm »


               Or modify their OnConversation script to have them lie back down again AssignCommand(OBJECT_SELF, ActionPlayAnimation(ANIMATION_LOOPING_DEAD_BACK, 1.0, 10000.00));

This also works if you want a sitting NPC to remain sitting for the duration of the conversation without them hopping back up when you click on them.
               
               

               
            

Legacy_Souldry

  • Newbie
  • *
  • Posts: 16
  • Karma: +0/-0
NPC Spawns Unconscious and Near Death
« Reply #7 on: July 02, 2011, 04:11:03 pm »


               Thanks guys good help here
               
               

               
            

Legacy_Green_Dragon123

  • Newbie
  • *
  • Posts: 22
  • Karma: +0/-0
NPC Spawns Unconscious and Near Death
« Reply #8 on: July 04, 2011, 09:33:38 am »


               

In that case you want to add this line in your NPC's script:

SetCommandable(FALSE);


Exactly where do I put this? In the OnSpawn-script?