malakdecaen 3 Posted October 16, 2013 Hi everybody , Sorry by advance for my bad english , so i have a question and i don't find the solution yet . I want my player get an addaction when he walk in a forest but how can i do that ? i've try this but that doesn't work : if (_vehicle == player and ("forest","surfacetype") then { player addAction [format["test"], "actions\Wood.sqf",[_unit], 1, false, true, "", ""]; }; Do you know how can i do for designate if the player are in forest or if player designate a tree ? Thanks a lot for you'r time. Share this post Link to post Share on other sites
lappihuan 178 Posted October 16, 2013 private["_surface"]; while (alive player) do { _surface = surfaceType getPosATL player; hintsilent format["%1",_surface]; sleep 1; }; Paste that in a function.sqf and execute the script in the init of your player unit with: Handle = execVM "function.sqf"; Now a hint will dispaly the surface every second from where you are. If you find out the surfaceType of your forest, do a if statement and check for this surface. Share this post Link to post Share on other sites
malakdecaen 3 Posted October 16, 2013 thanks , i get an error on ligne 2 "While" type bolean ... Share this post Link to post Share on other sites
mantls 2 Posted October 16, 2013 private["_surface"]; while {alive player} do { _surface = surfaceType getPosATL player; hintsilent format["%1",_surface]; sleep 1; }; while wants {} Share this post Link to post Share on other sites
lappihuan 178 Posted October 16, 2013 Sry syntacs error. This should work: private["_surface"]; while {alive player} do { _surface = surfaceType getPosATL player; hintsilent format["%1",_surface]; sleep 1; }; E: ninja'd :o Share this post Link to post Share on other sites
malakdecaen 3 Posted October 16, 2013 (edited) thanks , now that work i get #gdtStratisforestpine so if i put this : if (_vehicle == player and ("gdtStratisforestpine","surfacetype") then { player addAction [format["test"], "actions\Wood.sqf",[_unit], 1, false, true, "", ""]; }; that should be work ? how can i test this in editor ? Edited October 16, 2013 by kakarot Share this post Link to post Share on other sites
na_palm 19 Posted October 16, 2013 (edited) if ((_vehicle == player) && ("gdtStratisforestpine" == surfaceType getPosATL player)) then { player addAction [format["test"], "actions\Wood.sqf",[_unit], 1, false, true, "", ""]; }; should do the trick Edited October 16, 2013 by Na_Palm missing bracket Share this post Link to post Share on other sites
Hypnomatic 10 Posted October 16, 2013 If I'm interpreting your question correctly, you want the action to be available when the player is standing on forest terrain and not otherwise. That can be achieved with: player addAction [format["test"], "actions\Wood.sqf",[_unit], 1, false, true, '(vehicle _this == _this) && (surfaceType getPosATL _this == "gdtStratisforestpine")', ""]; Can't test it ATM, but that should accomplish what you're looking for. For a bit more info on how/why I suggest this, this is using the 8th parameter of addAction (referred to as "condition" on wiki): http://community.bistudio.com/wiki/addAction Share this post Link to post Share on other sites
malakdecaen 3 Posted October 16, 2013 (edited) i've try both but no addaction come , i'm desperate . Maybe there is another solution to designate forest ? or designate trees ? or if i shout a tree an addaction come ? Thanks guys for you'r help. // allowed trees list _trees = ["t_BroussonetiaP1s_F.p3d","t_FicusB1s_F.p3d","t_FicusB2s_F.p3d","t_FraxinusAV2s_F.p3d","t_OleaE1s_F.p3d","t_OleaE2s_F.p3d","t_PhoenixC1s_F.p3d","t_PhoenixC3s_F.p3d","t_PinusS2s_b_F.p3d","t_PinusS2s_F.p3d","t_poplar2f_dead_F.p3d","t_PopulusN3s_F.p3d","t_QuercusIR2s_F.p3d"]; Edited October 16, 2013 by kakarot Share this post Link to post Share on other sites
na_palm 19 Posted October 16, 2013 player addAction [format["test"], "actions\Wood.sqf",[_unit], 1, false, true,"", '(vehicle _this == _this) && (surfaceType getPosATL _this == "gdtStratisforestpine")']; Hypnomatic should got it right, only placed the condition in the 7th not the 8th field Share this post Link to post Share on other sites
malakdecaen 3 Posted October 16, 2013 i've try this to see if a hint come when i shout a tree but i get an error private["_trees"]; _trees = ["t_BroussonetiaP1s_F.p3d","t_FicusB1s_F.p3d","t_FicusB2s_F.p3d","t_FraxinusAV2s_F.p3d","t_OleaE1s_F.p3d","t_OleaE2s_F.p3d","t_PhoenixC1s_F.p3d","t_PhoenixC3s_F.p3d","t_PinusS2s_b_F.p3d","t_PinusS2s_F.p3d","t_poplar2f_dead_F.p3d","t_PopulusN3s_F.p3d","t_QuercusIR2s_F.p3d"]; _trees addeventhandler ["hitPart", {hint "hit";}]; Share this post Link to post Share on other sites
lappihuan 178 Posted October 17, 2013 Trees have no classnames, because of that you can't add a eventhandler or a action to them. Share this post Link to post Share on other sites