Scripts / Scipt works only to the first object placed on the scene

Author
Message
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 13th Jan 2017 15:24
i made this script



is attached to a fan entity when i place a secon fan on the scene the secon fan dont animate.
PM
Belidos
3D Media Maker
8
Years of Service
User Offline
Joined: 23rd Nov 2015
Playing: The Game
Posted: 13th Jan 2017 16:17
Why are you even using a script? As we told you on the other thread, don't need to use a script for things like fans, you just tell the FPE to use the animations and it automatically loops them for you.

As to why it doesn't work, it's probably because the variable is being used for both entities, change:



to


i5, NV960 2GB, 16GB memory, 2x 2TB Hybrid, Win10.
i3 , Intel integrated graphics, 6GB memory, 512GB Generic SATAIII Win8.1.
Intel Celeron (duel Core), Radeon integrated graphics, 4GB memory, 180gB Generic SATAII, WinVista.
Q6600, Intel integrated graphics, 8GB memory, 512GB Generic SATAII, Win7.
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 13th Jan 2017 18:31
or try this
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 14th Jan 2017 02:59
I was using scripts in order thave more control over the animation you know if needet stop start etc but i stumbled on a bug i think when a object animating using script bullets pass trough them like they don have collision but if you use play anim in editor the colision with bullets works fine.
PM
smallg
Community Leader
18
Years of Service
User Offline
Joined: 8th Dec 2005
Location:
Posted: 14th Jan 2017 09:20
Collision boxes are based around the origin point of the model but if the animation moves the entity the box won't move with it, this is likely the issue you're seeing.

As for your original all issue, as belidos said, its because you have 1 overall variable controlling all the entities with that script, it will only work for one object as as soon as that first one is run the variable is changed and the rest will not meet the requirements anymore.
You need to change the requirement to an array.
if runanim[e] == 0 then
SetAnimation(0)
LoopAnimation(e)
runanim[e] = 1
end
lua guide for GG
https://steamcommunity.com/sharedfiles/filedetails/?id=398177770
windows 10
i5 @4ghz, 8gb ram, AMD R9 200 series , directx 11
Team wolf
7
Years of Service
User Offline
Joined: 26th Dec 2016
Location:
Posted: 14th Jan 2017 14:24
Yes i am aware with that but i had collision only bullets dindt in any case the entity was not moving some blades inside of it rotating

Attachments

Login to view attachments
PM

Login to post a reply

Server time is: 2024-05-21 23:59:56
Your offset time is: 2024-05-21 23:59:56