Jump to content
Sign in to follow this  
mr_centipede

Dynamically created objects and AddAction Problems

Recommended Posts

I am trying to make an autosave point at a SatPhone created using script

Problem is now fixed. Thank you all :)

sleep 0.1;

_pos=_this select 0;
_dir=_this select 1;

_obj="SmallTable" createVehicle _pos;
_obj setDir _dir;

_objSave="SatPhone" createVehicle _pos;
_objSave setPos [(_pos select 0),(_pos select 1),(_pos select 2)+0.8];
_objSave setDir _dir;

[b]_objSave addAction ["Save Game","SavePoint\saveGame.sqf"][/b];

but the bold part does not work. I tried putting the satPhone in the editor and put the addaction in the initLine and it works.

Does addaction command cannot be used with dynamically created objects?

[edit]

nevermind... the script works, its just that it takes a while to kick in

Edited by Mr_Centipede

Share this post


Link to post
Share on other sites

hehe!

Nice!

I tested your script and it works as you noticed.

I was to write

"Have you tried scrolling your mouse wheel, it can take a while for the game to update the object and display the action"

Share this post


Link to post
Share on other sites

Try using reveal on the object to reveal it to the player. That way the actions should show up sooner (if not right away).

Share this post


Link to post
Share on other sites

add this to the bottom of your script:

group Player reveal _objSave;

That will make it work faster.

Edit: Ok dawg was faster xD

Share this post


Link to post
Share on other sites

I cant help but revealing your "spoiler" from time to time, that will have to be enough. ^^

:cancan::cancan::cancan:

Share this post


Link to post
Share on other sites

Centipede not sure if you figured it out yet. Using reveal might work, but whenever I use addAction I always format it like this and it works for me:

[b]_newAction = [/b]_objSave addAction ["Save Game","SavePoint\saveGame.sqf"];

I don't know if you must, but I THINK you always have to define the new action, which you can do like that as a local variable. In my mission I have a "sabotage" action added to some objects, and my script looks somethin like this:

_newAction = target1 addAction ["Sabotage","killObject.sqf"];
_newAction = target2 addAction ["Sabotage","killObject.sqf"];
_newAction = target3 addAction ["Sabotage","killObject.sqf"];
(etc...)

If you're adding them to multiple objects, doesn't matter if you give the local variables different names, I used the same name in this example, unless you plan to refer to them individually later somehow. I just had removeAction commands scripted though and had no need to refer to the variable name.

Share this post


Link to post
Share on other sites

Which method ended up working for you?

Share this post


Link to post
Share on other sites

I use reveal command, or just wait a while. Then the action will be there in the action menu. Havent got the time to tries yours (JDog) method yet

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  

×