How to pause script execution

MiniDev

Terrarian
Hi again Forum! Today I have tried to make my character stop in air for a small delay, and then execute other part of script. But I tried already Thread.Sleep() (pause all Terraria) and Task.delay() (Don't work without async static Task Main() {}, in that side async static breaks all script) So, who knows how can I pause script without breaking whole Terraria, I would be grateful if you help me with that task. Early thanks!
 
So, the method you are using will be called every update, you use a variable to count up to a number, that is a timer.

 
Thanks for replying! I am so grateful about this solution, but I have a little problem, I need to implement this timer in Shoot() method, and as I know it's not a method that update every tick, so if we can't make timer in that method, we can spawn projectile with timer and do tasks (like change Player.position, Player.gravity etc) in it and, if I can do it, how? Because Projectile. owner is an integer and through it I can't change anything in player, so maybe we have a way to change owner settings through projectile?
 
What exactly are you trying to do? Your explanation is a bit vague but it just sounds like you need a timer for a projectile? You can just have a timer in it's AI() method.
 
What exactly are you trying to do? Your explanation is a bit vague but it just sounds like you need a timer for a projectile? You can just have a timer in it's AI() method.
Thanks for reply! But no, I know how to do timer through AI(), but I want to know, can I change owner settings (position, gravity, etc.) through projectile script?
 
You mean the player? Yes, you can have a projectile change their position, velocity, etc. You just need to get the correct player from the Main.player[] array.
 
Back
Top Bottom