• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved new effect

Elgenady

Veteran OT User
Joined
Aug 5, 2011
Messages
1,683
Solutions
36
Reaction score
388
how i can do somthing like this im using tfs 0.4-dev
zAa-LZ2Ef.png
 
Last edited by a moderator:
That is interesting, an effect that shoots from X Y Z to X Y Z.
I hope that someone will be able to create it, or rather, will take the time and do it. :)

Kind Regards,
Eldin.
 
Code:
local fromPositions = {
  {x = 10, y = 10, z = 7},
  {x = 16, y = 10, z = 7},
  {x = 10, y = 14, z = 7},
  {x = 16, y = 14, z = 7}
}

local targetPosition = {x = 13, y = 12, z = 7}
for _, fromPosition in pairs(fromPositions) do
  doSendDistanceShoot(fromPosition, targetPosition, CONST_ANI_ENERGY)
end
 
Depense on when it should be executed, if it should be always with a certain interval you can use a globalevent script with function onThink.
 
when use globalevent its crash my oto
<globalevent name="effect" interval="3000" script="effect.lua"/>
 
bq1pFOid.png
its crash my oto wont my oto open and script
Code:
local fromPositions = {
  {x = 1019, y = 995, z = 12},
  {x = 1013, y = 995, z = 12},
  {x = 1019, y = 1001, z = 12},
  {x = 1013, y = 1001, z = 12}
}

local targetPosition = {x = 1016, y = 998, z = 15}
for _, fromPosition in pairs(fromPositions) do
  doSendDistanceShoot(fromPosition, targetPosition, CONST_ANI_ENERGY)
end
 
You need to add function onThink and return true end at the bottom.
Code:
function onThink(interval, lastExecution) -- above for ..
  
    return true -- under end
end

Btw, for TFS 0.3 it should be with event and value.
Code:
<globalevent name="effect" interval="3000" event="script" value="effect.lua"/>
The interval time is in seconds in TFS 0.3.6, so 3000 will be 50 minutes.
 
Last edited:
Code:
local fromPositions = {
  {x = 1019, y = 995, z = 12},
  {x = 1013, y = 995, z = 12},
  {x = 1019, y = 1001, z = 12},
  {x = 1013, y = 1001, z = 12}
}

local targetPosition = {x = 1016, y = 998, z = 12}
function onThink(interval, lastExecution)
end
for _, fromPosition in pairs(fromPositions) do
  doSendDistanceShoot(fromPosition, targetPosition, CONST_ANI_ENERGY)
end
return true
 
Code:
local fromPositions = {
{x = 1019, y = 995, z = 12},
{x = 1013, y = 995, z = 12},
{x = 1019, y = 1001, z = 12},
{x = 1013, y = 1001, z = 12}
}

local targetPosition = {x = 1016, y = 998, z = 12}
function onThink(interval, lastExecution)
end
for _, fromPosition in pairs(fromPositions) do
doSendDistanceShoot(fromPosition, targetPosition, CONST_ANI_ENERGY)
end
return true
end

Thats what @Limos meant.
 
Last edited:
Code:
local fromPositions = {
{x = 1019, y = 995, z = 12},
{x = 1013, y = 995, z = 12},
{x = 1019, y = 1001, z = 12},
{x = 1013, y = 1001, z = 12}
}

local targetPosition = {x = 1016, y = 998, z = 12}
function onThink(interval, lastExecution)
end
for _, fromPosition in pairs(fromPositions) do
doSendDistanceShoot(fromPosition, targetPosition, CONST_ANI_ENERGY)
return true
end

Thats what @Limos meant.

He said "move the end under onThink under return true"

So...

Code:
local fromPositions = {
{x = 1019, y = 995, z = 12},
{x = 1013, y = 995, z = 12},
{x = 1019, y = 1001, z = 12},
{x = 1013, y = 1001, z = 12}
}

local targetPosition = {x = 1016, y = 998, z = 12}
function onThink(interval, lastExecution)
for _, fromPosition in pairs(fromPositions) do
doSendDistanceShoot(fromPosition, targetPosition, CONST_ANI_ENERGY)
end
return true
end
 
Took me .000003 seconds to get the script first posted script to work just fine. If you have problems with something as simple as turning it into a global................You can finish that
 
He said "move the end under onThink under return true"

So...

Code:
local fromPositions = {
{x = 1019, y = 995, z = 12},
{x = 1013, y = 995, z = 12},
{x = 1019, y = 1001, z = 12},
{x = 1013, y = 1001, z = 12}
}

local targetPosition = {x = 1016, y = 998, z = 12}
function onThink(interval, lastExecution)
for _, fromPosition in pairs(fromPositions) do
doSendDistanceShoot(fromPosition, targetPosition, CONST_ANI_ENERGY)
end
return true
end
@Musztang THANKS BRO! LIKE
 
Back
Top