Jump to content
ozdeadmeat

getobjecttextures Action Boolean

Recommended Posts

Hi Everyone,

 

I have this little scenario / game mode I am working on and am trying to work out a nice way of having an objects texture of the object that the action is added to be equal to a specific texture for the action to show up. 

 

I am using the holdaction function as anything to get us away from the god awful old action system is a good thing. The boolean I have currently is 

 

((_this distance2d cursortarget < 3) && (getObjectTextures _target select 0 == "CustomTextures\Tutorials\UPGRADE_CRATE_INFO.paa"))

 

now as far as I can see, the issue is that the text that is being returned is the full path to the texture and not just the last 'mission specific' section of the script. (i.e. c:\users etc etc)

 

Any help on this would be appriciated.

 

Cheers,

 

OzDM

Share this post


Link to post
Share on other sites

OK, I solved my own issue. Took a bit of screwing around but got it to work. 

 

For prosperity here is how you do it.

 

Firstly put this line into your description.ext

 

__EXEC (MISSION_ROOT = __FILE__ select [0, count __FILE__ - 15])

 

the contition for the action is 

 

'((_this distance2d cursortarget < 3) && (getObjectTextures _target select 0 == ((parsingNamespace getVariable "MISSION_ROOT") + "CustomTextures\Tutorials\UPGRADE_CRATE_INFO.paa")))'

 

so when the object has the upgrade crate texture on it, and I am within 3 meters of the action object and looking at it, i get the action to show up.

 

Hope this helps someone. (perhaps myself years from now, who knows)

 

 

 

 

Share this post


Link to post
Share on other sites

OK, to make the condtions a little neater I have created a small function.

 

CHECK_PATH = {
//Returns true of false based on a texture path
private ["_obj", "_n", "_TMP", "_fileroot", "_checkpath", "_fullpath", "_return"];
_obj = _this select 0;            //Object (the one with the texture being checked
_n = _this select 1;            //Number
_TMP = toLower(_this select 2); //Texture Mission Path
_fileroot = tolower(parsingNamespace getVariable "MISSION_ROOT");
_checkpath = _fileroot + _TMP;
_fullpath = toLower(getObjectTextures _obj select _n);
_return = if(_fullpath == _checkpath) then {true} else {false};
_return
};

with the new condition as 

 

'((_this distance2d cursortarget < 3) && ([_target,0,"CustomTextures\Tutorials\UPGRADE_CRATE_INFO.paa"] call CHECK_PATH))',// Condition for the action to be shown	

This still requires this line in the description.ext

__EXEC (MISSION_ROOT = __FILE__ select [0, count __FILE__ - 15])

 

Edited by ozdeadmeat
wanted to describe the solution in full by adding comment about description.,ext
  • Like 1

Share this post


Link to post
Share on other sites

this

.
.
.
_fullpath = toLower(getObjectTextures _obj select _n);
_return = if(_fullpath == _checkpath) then {true} else {false};
_return
};

is the same as this:

.
.
.
_fullpath = toLower(getObjectTextures _obj select _n);
(_fullpath == _checkpath)
};

 

  • Like 1

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

×