Jump to content

Why is this script slow to react?


Recommended Posts

Running this scripy on a skeever actor base. It works but when the skeever dies there is a very noticeable time gap between the death and the explosion. Player can literally look at the dead skeever - wait a second (less than a second but feels longer) - explosion - message.

 

 

Actor Property PlayerREF Auto
Explosion Property MyBang Auto
Message Property MyMSG Auto

Event OnDeath(Actor akKiller)
if akKiller == PlayerREF
placeAtMe(MyBang)
Game.GetPlayer().DamageActorValue("Health", 20)
MyMSG.show()

endif
EndEvent

 

Link to comment
Share on other sites

It should be taking 4 frames total but could potentially take longer. A minor improvement would be to use the PlayerREF property instead of the Game.GetPlayer() call because that function is 1/4 of the script's running time, but that still doesn't explain a long delay.

 

The only reason I can think of that this would be slow is that you've already got too much other script activity going on in your game. Each of the functions will require one frame to run, but even at 30 fps that should still be just over 0.1 seconds for the message (with the explosion and health both happening during that time).

Link to comment
Share on other sites

Changed to...

 

Explosion Property MyBang Auto
Message Property MyMSG Auto

Event OnDeath(Actor akKiller)
if akKiller == Game.GetPlayer()
placeAtMe(MyBang)
Game.GetPlayer().DamageActorValue("Health", 50)
MyMSG.show()

endif
EndEvent

 

 

Still runs slow. Player is in an small interior cell and nothing 'taxing' is happening.

Link to comment
Share on other sites

First of all, there isn't a delay, is just the message that interrupts the explosion FX. There is supposed to be small delay when an npc dies about 0.3sec (if i remember correctly the sec), the time for the game engine to do its things (like change container and other....)

Modify the time to what you want, but give it an amount so that it plays the FX.



Explosion Property MyBang Auto
Message Property MyMSG Auto

Event OnDeath(Actor akKiller)
if akKiller == Game.GetPlayer()
self.placeAtMe(MyBang)
Game.GetPlayer().DamageActorValue("Health", 50)
utility.wait(2.0)
MyMSG.show()
endif
EndEvent


Link to comment
Share on other sites

Seen your video again i see that you have already a script running on the skiver that gives it a visual FX, if so, attach the "OnDeath" to the visual script so that it runs only one script.


Don't expect to see an immediate explosion as soon as you see in game the skiver dying, for that you need to difine in the script that when its health reaches 0 the explosion will occur, so you need a completly different scripting approch.


The line up - order of the functions - event you put in the script plays an important role on what you see, the game engine will execute the functions from top to bottom, so if you put the visuals first and then the explosion that's what you are going to see.

For example:


Play.FX on skiver

Stop.FX on skiver

palce explosion


Is different from



Play.FX on skiver

palce explosion

Stop.FX on skiver

Edited by maxarturo
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...