Jump to content
Ilias48rus

Get position after isnull

Recommended Posts

hey, hope someone can help
i need to get position of object (where it was) when the object isnull -
loop which getting the objects position while !isnull is bad option because to much objects need it working for.

Share this post


Link to post
Share on other sites

hey, hope someone can help

i need to get position of object (where it was) when the object isnull -

loop which getting the objects position while !isnull is bad option because to much objects need it working for and variables which the position will be saved to have to much side information.

thats not specific enough to be able to help u... the minimun information is why ur object is getting null. and better were a scipt.

Share this post


Link to post
Share on other sites

for"_cn"from 0 to 5000 do{
_n=0;
_s={
	_n=floor random 1000000;
	if(typename(missionNamespace getVariable (str(_n)+"_pda"))=="array")then{
		call _s;
	};
};
call _s;
missionNamespace setVariable [str(_n)+"_pda",[
		|object|,
		getpos |object|,
		false
],true];
};

(imagine what all objects are different)

need: if any object are becoming null get position where it was in the moment and execute t.sqf .

Share this post


Link to post
Share on other sites
for"_cn"from 0 to 5000 do{
_n=0;
_s={
	_n=floor random 1000000;
	if(typename(missionNamespace getVariable (str(_n)+"_pda"))=="array")then{
		call _s;
	};
};
call _s;
missionNamespace setVariable [str(_n)+"_pda",[
		|object|,
		getpos |object|,
		false
],true];
};

(imagine what all objects are different)

need: if any object are becoming null get position where it was in the moment and execute t.sqf .

 

 

This script snippet doesn't make any sense.

Or am I the only one?

 

If someone is offering to help, like sarogahtyp in that case, at least don't come up with some sort of pseudocode.

 

Cheers

Share this post


Link to post
Share on other sites

This script snippet doesn't make any sense.

Or am I the only one?

 

If someone is offering to help, like sarogahtyp in that case, at least don't come up with some sort of pseudocode.

 

Cheers

What kind of "sence" do you to hell need? I gave all information is needeble

(sorry for the tone, just realy tired of the rediculous posts)

Share this post


Link to post
Share on other sites

Please explain how this is supposed to work:

for"_cn"from 0 to 5000 do{
_n=0;
_s={
    _n=floor random 1000000;
    if(typename(missionNamespace getVariable (str(_n)+"_pda"))=="array")then{
        call _s;
    };
};

Share this post


Link to post
Share on other sites

What kind of "sence" do you to hell need? I gave all information is needeble

(sorry for the tone, just realy tired of the rediculous posts)

^^^ Same here. Could you please be polite or stop posting?

  • Like 3

Share this post


Link to post
Share on other sites

When you do setVariable, set not only the object, but the object and its position separately. E.g. an array element like [object, pos]. Then if object suddenly is null you have the position in the second array element.

However, I'm not sure about what you try to achieve. What kind of object is it, and why is it suddenly null?

  • Like 1

Share this post


Link to post
Share on other sites

When you do setVariable, set not only the object, but the object and its position separately. E.g. an array element like [object, pos]. Then if object suddenly is null you have the position in the second array element.

However, I'm not sure about what you try to achieve. What kind of object is it, and why is it suddenly null?

The objects will move, i need their position at time of begining null

(half of objects in game, can be delited (by 3-4 ways))

Share this post


Link to post
Share on other sites
for"_cn"from 0 to 5000 do{
_number=0;
_s={
	_nnumber = floor random 1000000;
	if(typename(missionNamespace getVariable (str(_number)+"_pda"))=="array")then{              //str(_number)+"_pda"==(e. "1544_pda") , typename working with unexisting variables (missing the line);
		call _s;      //will be if the variable exist (repeting _s)
	};
};
call _s;
missionNamespace setVariable [str(_number)+"_pda",[
		|object|,
		getpos |object|,
		false
],true];
};

if it easier ?

Share this post


Link to post
Share on other sites

 

for"_cn"from 0 to 5000 do{
_number=0;
_s={
	_nnumber = floor random 1000000;
	if(typename(missionNamespace getVariable (str(_number)+"_pda"))=="array")then{              //str(_number)+"_pda"==(e. "1544_pda") , typename working with unexisting variables (missing the line);
		call _s;      //will be if the variable exist (repeting _s)
	};
};
call _s;
missionNamespace setVariable [str(_number)+"_pda",[
		|object|,
		getpos |object|,
		false
],true];
};

if it easier ?

 

 

Easier? Are you kidding me? The nonsensical random iteration through randomly generated missionNamespace variables?

Don't you know which variables you're looking for? This is a very weird and performance costly way to iterate through variables...

Also you can't define _s and call it from within itself, since _s is nil at this point.

  1. _number is nil outside of the for "_cn" from 0 to 5000 do scope
  2. _s is nil outside of the for "_cn" from 0 to 5000 do scope
  3. missionNamespace setVariable will throw an error because of this:
|object|

Why not use:

object

The usage of:

|

Should give you script errors, but you probably knew this already...

You should take a look at this if you're unsure about variable scope.

 

Other than that I fail to see how out of all possible solutions (enigmas solution, Eventhandler, waituntil {!alive object} etc) for your problem you came up with this abomination.

 

Cheers

Share this post


Link to post
Share on other sites

 

Did i said even once what i need the variables outside of that?

|object| - mean some object, what ever object, d..  it will not looks like that, the code for show number of the variables which will need to work with, how they looks like and will be saved

Share this post


Link to post
Share on other sites

Did i said even once what i need the variables outside of that?

|object| - mean some object, what ever object, d..  it will not looks like that, the code for show number of the variables which will need to work with, how they looks like and will be saved

 

No you didn't, which doesn't help to solve the problem.

You are using "call _s" right outside the from n to n scope, where it is nil.

If your script doesn't look like that in the end, why give it as an (non functional) example in the first place?

Maybe someone else can make some sense out of it.

 

Cheers

Share this post


Link to post
Share on other sites

No you didn't, which doesn't help to solve the problem.

You are using "call _s" right outside the from n to n scope, where it is nil.

If your script doesn't look like that in the end, why give it as an (non functional) example in the first place?

Maybe someone else can make some sense out of it.

 

Cheers

it doesn't null at call

and i said what i need to do

Share this post


Link to post
Share on other sites

it doesn't null at call

thats correct. maybe grumpy missed a bracket.

 

and i said what i need to do

thats correct too but u r not helping to help you and u r not using fair words for your posts and for me it seems that u r not thankfull. and these r the reasons why i not try to help since my first post here.

notice plz: this post is in fact help!

Share this post


Link to post
Share on other sites

 

I am always thankful if someone helping with something, here i already 2-3 times explained all i could, i just don't even know how else could i explain it

Share this post


Link to post
Share on other sites

Ok, I understand here that you want to basically get the last known position of an object prior to it going null, that I understand. What Grumpy and sarogahtyp are getting pissed about is your're giving no context on what exactly is going on with the object, as you said there are multiple ways the object can go null, so that means there are probably multiple ways of catching the object's last known position prior to it going null. So it's not that we don't get what you want to do, we just can't help you without any extra insight into the issue other than a garbage code snippet.

  • Like 2

Share this post


Link to post
Share on other sites

jshock

I know hat i could add handling before they going null on the ways, i'm do not writing it because (pretty evidently) its not an option, the system should handle it unconnected to ways it becoming null.

Share this post


Link to post
Share on other sites

Well without prior montioring, I honestly don't believe there is a solution, so there's your answer. Cause null objects don't have a reference anymore because, well, they're null...

Unless I'm missing something....

  • Like 1

Share this post


Link to post
Share on other sites

Well without prior montioring, I honestly don't believe there is a solution, so there's your answer. Cause null objects don't have a reference anymore because, well, they're null...

Unless I'm missing something....

options i have now is:

--- loop getting positions of objects from all variables (of the kind) from missionnamespace and if object in the variable becoming null execute..

(to big position mistake),

-- foreach [ [ |i|,|o|,|p|,|st| ],[ |i|,|o|,|p|,|st| ] ] ;

(to difficult to change object),

- create object, hide, disable damage and attach to object which's position need to get, check for 'attached' (-if objnull get position, delete and execute)

(not sure how heavy it will be for server).

Share this post


Link to post
Share on other sites

This is a relatively new event handler, I've never messed with it, and it's EntityKilled, but going null may as well be "killed", so worth a shot (not sure if it works for objects either, but eh):

https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#EntityKilled

Cool, will try to think it-here, but even if it will not help here, its very nice thing,

huge thank you,

i already know where to use it.

Share this post


Link to post
Share on other sites

jshock

Holy crab, (tested it,) it's so cool, it working with absolutely everything even map objects, explosives ) , triggering on all mahines, so much options how to use it, want to give more likes ) , thanks again

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now

×