Jump to content
Sign in to follow this  
Asung

Gathering Material Script [Help]

Recommended Posts

Hello All,

I am trying to get this script to work on a dedicated server (its not working in editor either).

Objective: This script is supposed to create a action on an object, when used it will raise the counter from 1/7 to 7/7. When it reaches 7/7, it is supposed to move an object called satradio to marker pos called baseradio.

Issue: When I use the addaction during testing, it raises the counter as a hint from 1/7-6/7 and then it stops, I am no longer able to use it anymore and the object does not get moved.

Notes

-The object that is used for the action has the following on the init. this addaction " ["Gather materials","baseradio.sqf"];"

-The marker pos is called "baseradio". The object to be moved is called "satradio".

-I have in my init.sqf :

"radiopart=0;

publicVariable "radiopart";"

private ["_target","_caller","_id"];

_target = _this select 0;

_caller = _this select 1;

_id = _this select 2;

[nil,nil,rREMOVEACTION,_id] call RE;

radiopart = Radiopart + 1;

publicVariable "Radiopart";

if (radiopart == 1) then {

hint format [' 1/7 Radio Components Gathered!'];

};

if (radiopart == 2) then {

hint format [' 2/7 Radio Components Gathered!'];

};

if (radiopart == 3) then {

hint format [' 3/7 Radio Components Gathered!'];

};

if (radiopart == 4) then {

hint format [' 4/7 Radio Components Gathered!'];

};

if (radiopart == 5) then {

hint format [' 5/7 Radio Components Gathered!'];

};

if (radiopart == 6) then {

hint format [' 6/7 Radio Components Gathered!'];

};

if (radiopart == 7) then {

satradio setpos (getMarkerpos "baseradio");

satradio setpos [ getPos this select 0, getPos this select 1, (getPos this select 2) +3.5];

hint format ['You have gathered enough components to construct a radio at the Survivors' Hideout!!'];

};

Any assistance from gurus is appreciated.

Share this post


Link to post
Share on other sites

You have a typo in your last line there. You're using single quotes to denote the string, but then have a single quote after Survivors which is breaking that line.

I rewrote it like this and seems to work. Changes marked in red.

private ["_target","_caller","_id"];
_target = _this select 0;
_caller = _this select 1;
_id = _this select 2;

// Remove action for everyone
[nil,[color="#FF0000"]_target[/color],rREMOVEACTION,_id] call RE;

// increase and publicize the variable
radiopart = radiopart + 1;
publicVariable "radiopart";

// Feedback
[color="#FF0000"]hint format["%1/7 Radio Components Gathered!", radiopart];[/color]

// Finished!
if (radiopart > 6) then {
sleep 2;
satradio setpos (getMarkerpos "baseradio");
satradio setpos [ getPos [color="#FF0000"]satradio[/color] select 0, getPos [color="#FF0000"]satradio[/color] select 1,[color="#FF0000"] 3.5[/color]];
hint format [[color="#FF0000"]"[/color]You have gathered enough components to construct a radio at the Survivors' Hideout!![color="#FF0000"]"[/color]];
};

Edited by kylania

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  

×