Aller au contenu

Photo

DelayCommand on Dead Creature.


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

#1
Buddywarrior

Buddywarrior
  • Members
  • 256 messages
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?

#2
Fester Pot

Fester Pot
  • Members
  • 1 394 messages
Make sure the creature does not fade after its death so the script can still fire.



FP!

#3
Buddywarrior

Buddywarrior
  • Members
  • 256 messages
Looks like that fixed it.. Thanks a ton!

#4
Melkior_King

Melkior_King
  • Members
  • 135 messages
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).

#5
Baaleos

Baaleos
  • Members
  • 1 330 messages
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)

#6
Lightfoot8

Lightfoot8
  • Members
  • 2 535 messages
I always Assign to the area the Object is in.



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




#7
Baaleos

Baaleos
  • Members
  • 1 330 messages
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.