Author Topic: DelayCommand on Dead Creature.  (Read 344 times)

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
DelayCommand on Dead Creature.
« on: February 07, 2011, 10:15:16 pm »


               I know the answer could be "duh, the creature is dead." , but I've got to ask anyway.

If I add a SendMessageToPC(oPC, "OOh I'm dead..")); on a creatures OnDeath script, I see the message.
But if I add a
DelayCommand(5.00, SendMessageToPC(oPC, "5 sec delay ends now ..")); on the creatures, I don't see it.

What is a way around this, as I would like to set a variable on a waypoint 5min after the creature dies and planned on doing this from the OnDeath of the creature.

ideas?
               
               

               
            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
DelayCommand on Dead Creature.
« Reply #1 on: February 07, 2011, 10:20:53 pm »


               Make sure the creature does not fade after its death so the script can still fire.



FP!
               
               

               
            

Legacy_Buddywarrior

  • Hero Member
  • *****
  • Posts: 512
  • Karma: +0/-0
DelayCommand on Dead Creature.
« Reply #2 on: February 07, 2011, 11:17:04 pm »


               Looks like that fixed it.. Thanks a ton!
               
               

               
            

Legacy_Melkior_King

  • Full Member
  • ***
  • Posts: 234
  • Karma: +0/-0
DelayCommand on Dead Creature.
« Reply #3 on: February 09, 2011, 10:21:10 am »


               I suggest you use AssignCommand to assign the DelayCommand to the module.



AssignCommand(GetModule(),DelayCommand(5.00,SendMessageToPC(oPC,"5 sec delay ends now")));



An alternative is to assign the delayed command to a (possibly invisible) placeable object, or even to the waypoint where you want the variable to be set (although I'm not certain waypoints will run commands - I know the module does).
               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
DelayCommand on Dead Creature.
« Reply #4 on: February 09, 2011, 11:06:25 am »


               If you are planning on using the 'relay' method posted above, it is often a good idea to either

1. Assign the Command to the Module

or

2. Assign the Command to a High AI Level NPC.  AI Level affects priority to a 'n' degree, which might help keep accuracy with DelayCommand actions.



I wouldnt recommend assigning commands to the placeables - in large modules, Placeables get a very low priority as far as Bioware Scripting goes.   Even Shayan's Subrace Engine 3.x  (the subrace clock) fails to work in Modules that are massive, because the Subrace Clock placeable, is unable to fire off its script at the right time. (without using Pseudo-HB's)





Having a Single NPC with a Maximum AI Level set, in an area that is unaccessible, and assigning all your action/commands through them, would be able to accomplish what you need.



I use a similar method for Server Anouncments.



a Function that does



void MakeServerAnnouncement(string sName, string sMessage);



sName - The Function does a 'SetName'  call on the Announcer npc, to make them have whatever name I want.

sMessage - Is Shouted after a 0.5 second Delay - (to allow the SetName to take effect)
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
DelayCommand on Dead Creature.
« Reply #5 on: February 09, 2011, 12:46:02 pm »


               I always Assign to the area the Object is in.  



That way I Don't have to create anything new.  



               
               

               
            

Baaleos

  • Administrator
  • Hero Member
  • *****
  • Posts: 1916
  • Karma: +0/-0
DelayCommand on Dead Creature.
« Reply #6 on: February 09, 2011, 01:26:55 pm »


               True

Areas and Modules have the highest Priority as far as I know - so they are 'almost' guarantee'd to fire when you want/need them.



My example of using a Relay NPC is useful for cases of Shout Messages, because as far as I know, you cant use SetName on the Module or Areas, so changing the name that appears as the 'Shouter' doesnt work.