Scripts / Disappearing bug?

Author
Message
GubbyBlips
3
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 30th Jul 2020 19:06
With CollisionOff, SetPosition, I'm using a script to move objects one time, but
they disappear when moved?! The standard barrel is one of them, some crates,
and a few other items tested. Some items even glitch out where only a few of
them are visible, and others of them (the same extracted item) are invisible after
the move.

I can't figure it out- thought it was influenced by IsImobbile = yes/ no, but tests
don't seem to support that. Strange and baffled. I need the objects to remain
IsImobbile = NO!

Certain objects with the exact same script attached never glitch out and disappear.
So...??

PM
AmenMoses
GameGuru Master
6
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 30th Jul 2020 19:25
Show me the script and I might be able to help.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
3
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 30th Jul 2020 21:40 Edited at: 30th Jul 2020 21:41
Okay AmenMoses. But my tests show strange behavior.
I have a picture to show you, and there doesn't seem to be a way
to post a picture of it here. It is a snapshot of the x,yz, coordinates
in text fashion, and some of the entries have the following;
-(nan)ind

What? Have you ever seen this before?!
This little snipit of code;
for a = 2,30 do
Text(22, (a*3), 3, g_Entity[a]['x'] )
Text(44, (a*3), 3, g_Entity[a]['y'] )
Text(66, (a*3), 3, g_Entity[a]['z'] )
end -- 'a' to get original location
Produces...
-----------Cannot post picture to forums-----------
PM
GubbyBlips
3
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 30th Jul 2020 21:46
BTW AmenMoses, the script would require a map that's setup
a specific way or there will be errors. (I could send you that map
if there was a way, but cannot even post pics here.)

Anyhow- as mentioned, I can post other entities and they do not
disappear, but certain ones do, and even those do not do it all
of the time, so it's a very strange thing.
PM
AmenMoses
GameGuru Master
6
Years of Service
User Offline
Joined: 20th Feb 2016
Location: Portsmouth, England
Posted: 30th Jul 2020 22:37 Edited at: 30th Jul 2020 22:38
Are all entities always active?
Are all entities within 3000 units of the player?

Under the covers GG tries to do some performance cheats and either of these can mean that the global g_Entity list may not get updated for the entities.

Always better to get the position of an entity directly using GetEntityPosAng function, or even better use GetObjectPosAng function with the ObjectId (that's the 7nnnn number) and you can reposition an object with PositionObject as well.

Without seeing your script to see how you are moving the entities I can't offer any other suggestions but you could do worse than look at the pickuppables script to see how I did it.
Been there, done that, got all the T-Shirts!
PM
GubbyBlips
3
Years of Service
User Offline
Joined: 14th Jan 2019
Location:
Posted: 31st Jul 2020 05:00
Thanks AmenMoses. That seems to have been the fix.
I'll let you know for sure when I try some other objects tomorrow!
Apparently another script was conflicting with the move script.
After I move them, I want them to be interactive still by player.
I copied and reused variables from one to another (all local) so no biggy??
So to sum it up maybe my scripting is getting worse than better,
Trying to stay sane in these locked up times... without work lol!
PM

Login to post a reply

Server time is: 2022-08-09 20:27:37
Your offset time is: 2022-08-09 20:27:37