None still accessible.

Discussions about Coding and Scripting
Post Reply
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

None still accessible.

Post by PrinceOfFunky »

I have a loop that iterates through all the actors in the map, it stores the last actor into a variable so that the loop can start from that actor instead of iterating through all the actors it already checked, and there is a check if the last actor becomes None, so that the loop will start from a previous non-None actor.
The problem comes when it saves the UTTEleEffect as last actor, it becomes None cause of the LifeSpan, but when my code checks if it isn't None, it returns true and passes the check. Even the logs show the name "UTTEleEffect1", but "cheatview UTTeleEffect" doesn't work, nor "editactor name=UTTeleEffect" nand "editactor class=UTTeleEffect", so why does it still pass the check and log the name of something that is None?
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: None still accessible.

Post by Barbie »

Maybe the wiki article "What happens when an Actor is destroyed" explains it:
When the Destroy() function (or the replication code that cleans up obsolete replicated actors) returns, the actor object is not actually gone, it just becomes unaccessible by other objects in UnrealScript.
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: None still accessible.

Post by PrinceOfFunky »

Barbie wrote:Maybe the wiki article "What happens when an Actor is destroyed" explains it:
When the Destroy() function (or the replication code that cleans up obsolete replicated actors) returns, the actor object is not actually gone, it just becomes unaccessible by other objects in UnrealScript.
:D That's what I needed, thanks!
I guess I can't check if an actor is actually deleted then, unless I make it returns an Accessed None exception lol. Do you think there's a way to use the constant "Deleted" from within Actor.uc, to check the latest deleted actor?
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
Barbie
Godlike
Posts: 2802
Joined: Fri Sep 25, 2015 9:01 pm
Location: moved without proper hashing

Re: None still accessible.

Post by Barbie »

Maybe the property bDeleteMe helps you.
For example:

Code: Select all

function bool ActorValid(Actor A) {
		return ! (A == None || A.bDeleteMe);
}
"Multiple exclamation marks," he went on, shaking his head, "are a sure sign of a diseased mind." --Terry Pratchett
User avatar
PrinceOfFunky
Godlike
Posts: 1200
Joined: Mon Aug 31, 2015 10:31 pm

Re: None still accessible.

Post by PrinceOfFunky »

Barbie wrote:Maybe the property bDeleteMe helps you.
For example:

Code: Select all

function bool ActorValid(Actor A) {
		return ! (A == None || A.bDeleteMe);
}
Already tried it time ago, but it doesn't rly work, seems like bDeleteMe is not actually called :/ Or maybe you cannot check it because when you try doing it(even in a Tick) it's too late.
My code works fine because I know some safe actors that will never be None if my code won't let them, but since I tend to make the code more and more efficent I was trying to find a way to start from the very last actor, instead of a middle actor and repeating the iteration through already checked actors, but well it's oki anyway .o. So thanks, it helped much knowing about those "deleted" actors :D
"Your stuff is known to be buggy and unfinished/not properly tested"
User avatar
sektor2111
Godlike
Posts: 6410
Joined: Sun May 09, 2010 6:15 pm
Location: On the roof.

Re: None still accessible.

Post by sektor2111 »

PrinceOfFunky wrote:Already tried it time ago, but it doesn't rly work, seems like bDeleteMe is not actually called
and it won't be called because is not a function or an event is a bool assigned shortly, see how I did such a deal with it, you might check some snippet.
UnrealScript wrote:

Code: Select all

var Tracker T;
.....
.....
if ( T.Owner==None)
{
	T.Destroy();
	log("Tracker "$T.Name$" pending deletion with bDeleteMe = "$T.bDeleteMe);
}
Then see log. I assure you it do works because it has bDeleteMe until next tick - crap happens if something tries a deal with this actor during this tiny time. Then yes, Accessed None is probably more than self explanatory - None has been Accessed when it should not be. If I recall I have such a check code into some of my Tick trackers for... learning, written in the past.
Post Reply