Jump to content
Sign in to follow this  
RyanTurner

" addction, dragObject, attachTo, setVariable, getVaraible, detach" - Help

Recommended Posts

I'm trying to a object move and it keeps showing the same error could anyone help me?
 
 

shield addaction ["Pick up Shield",{call S_dragObject}];

S_dragObject = {
	_object = (_this select 0);
	
	_object attachTo [NATO_BIS_5, [0,2,0]];
	
	NATO_BIS_5 setVariable ["object",_object];
	NATO_BIS_5 Addaction ["Deploy Shield",{call S_dropObject}];
	
};

S_dragObject = {
_id = (_this select 2);

	NATO_BIS_5 removeAction _id;
	_object = NATO_BIS_5 getVariable "object";
	
	detach _object;


};
	

and in-game Erros comes (sorry if i program it wrong i'm a Python Programmer not an SQF one

 

 

'..ATO_BIS_5 getVaraible "object";

 
detach |#|_object;
 
File c:\Users\Augus.DESKTOP-6975015\Documents\ArmA 3- Other Profiles\Ryan%20Turner%20\missionsMP_PVP_BOMB_Day_SAS_01.altis.sqf line
 
];
 
,
 
Error Undefined varaible in expression: _object
19
 
Thank you
-Ryan
 

Share this post


Link to post
Share on other sites
_object = NATO_BIS_5 getVariable ["object", objNull];

If the Object doesn't have it's variable set properly you should add a default (objNull).

Just a guess.

 

EDIT: Both functions are named "S_dragObject" that just a typo right?

Share this post


Link to post
Share on other sites
shield addaction ["Pick up Shield",{call S_dragObject}]; ///you are calling the function without input. change to: _this call S_dragObject

S_dragObject = {
	_object = (_this select 0); ///and here you are using input
	
	_object attachTo [NATO_BIS_5, [0,2,0]];
	
	NATO_BIS_5 setVariable ["object",_object];
	NATO_BIS_5 Addaction ["Deploy Shield",{call S_dropObject}];
	
};

S_dragObject = { ///why does this function have the same name as the one above? you are basically overwriting the old one
_id = (_this select 2);

	NATO_BIS_5 removeAction _id;
	_object = NATO_BIS_5 getVariable "object";
	
	detach _object;


};

just some things i noticed

Share this post


Link to post
Share on other sites

Oky if i did the ObjNull it doesnt work, i change the last S_dragObject to SS_dragObject, it picks the object but it doesnt drop it

 

"'call |#|S_dropObject'

Error undefined varible in expression s_dropobject"
 
shield addaction ["Pick up Shield",{call S_dragObject}];

S_dragObject = {
	_object = (_this select 0);
	
	_object attachTo [NATO_BIS_5, [0,2,0]];
	
	NATO_BIS_5 setVariable ["object",_object];
	NATO_BIS_5 Addaction ["Deploy Shield",{call S_dropObject}];
	
};

SS_dragObject = {
_id = (_this select 2);

	NATO_BIS_5 removeAction _id;
	_object = NATO_BIS_5 getVariable "object";
	
	detach _object;


};
 
 
i dont have that much a clue in SQL/SQF Scripting, i wanted to make an object only picked up by an "X Person" who can be drop and carried and it stays as a Physical object when picked up, i suck at SQL
 
EDIT: I was trying to follow this video i was tryign to to the first part he does i know it old does that make a diference? ( https://www.youtube.com/watch?v=MXNW-dnelDs&index=17&list=PLhzMalhNo64W3iG_97ncmUGEXhPAvEhJd ) 

Share this post


Link to post
Share on other sites

SS_dragObject needs to be renamed to S_dropObject.

 

You have a call in S_dragObject that is referenced to a non existent procedure, hence the error.

  • Like 1

Share this post


Link to post
Share on other sites

try to be more conscious about what you are doing. you can't just refer to a variable that isn't there.

 

that's why i only hinted at things instead of fixing your code. you will save a lot of time by reading your code line by line making sure you actually know/understand what you are doing.

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
Sign in to follow this  

×