Jump to content

Recommended Posts

 

Hello, please help with the coding, namely I need a code for my character, I want him to be able to create a spell, namely that in the place where the cursor will be there strikes 5 lightning but for one use it  3 sanity.

P.S. but that the lightning struck in a row and not at the same time.

I'm asking you for help because I don't know how to code at all.

Link to comment
https://forums.kleientertainment.com/forums/topic/120396-lightning-code/
Share on other sites

try this for when the spell is cast, however it WILL follow the mouse if you do so:

for k=0, 5 do
  GLOBAL.TheWorld:DoTaskInTime(0.5, function() c_spawn("lightning") GLOBAL.ThePlayer.components.sanity:DoDelta(-3) end) --The 0.5 is the amount of time in seconds. The -3 is the sanity subtracted from the player
end

I'm not sure you can move the lightning to make it strike the same place, I could definitely be wrong. I've seen some code spawn things in and then move them to a certain position/shape, but since lightning is immediate, I don't know if you can do that...

  • Like 1
On 7/25/2020 at 12:59 PM, rawii22 said:

try this for when the spell is cast, however it WILL follow the mouse if you do so:


for k=0, 5 do
  GLOBAL.TheWorld:DoTaskInTime(0.5, function() c_spawn("lightning") GLOBAL.ThePlayer.components.sanity:DoDelta(-3) end) --The 0.5 is the amount of time in seconds. The -3 is the sanity subtracted from the player
end

I'm not sure you can move the lightning to make it strike the same place, I could definitely be wrong. I've seen some code spawn things in and then move them to a certain position/shape, but since lightning is immediate, I don't know if you can do that...

Thank you very much!!!

On 25.07.2020 at 12:59, rawii22 said:

спробуйте це, коли заклинання буде передано, проте воно буде слідувати миші, якщо ви це зробите:


     

Я не впевнений, що ви можете перемістити блискавку, щоб вона вдарила там же, я, безумовно, можу помилитися. Я бачив якийсь код, який породив речі, а потім переміщував їх у певну позицію / форму, але оскільки блискавка негайно, я не знаю, чи можете ви це зробити ...

 

And where to insert this code?

That's going to be a little more involved, but you can check out how the star caller's staff works. It lets you cast a spell anywhere the mouse is on screen. Then maybe you can apply that to your character. There are a lot of people trying to do that sort of thing right now, so you can probably find a forum that talks about how to do that.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...