Jump to content
Sign in to follow this  
Walker001

UNA Targets - Realistict target board script

Recommended Posts

First off, this script is fantastic. Must more realistic than just hitting a pop-up target anywhere and getting a 'kill.' Very good for marksmanship.

Now on to the issue, I get this error as well:

Error in expression <scoretable;
};
if (WALK_TARGET_PUBVAR == _target) then { _scoretable = null; >
 Error position: <== _target) then { _scoretable = null; >
 Error ==: Type Script, expected Number,String,Object,Side,Group,Text,Config entry,Display (dialog),Control,Team member,Task,Location

However, I discovered that the error occurs when there is a lot of stuff on the map. The map I'm using it on is a training map, with a couple of various weapon ranges and numerous teamwork scenarios spread out across the map. I made a copy of the map and started deleting areas. I eventually deleted all of the scenario areas and then the script worked perfectly, no error.

Got me thinking; does this script have trouble overcoming script lag? Is the script getting slowed down to the point that it's attempting to call on variables that have not caught up yet? Given that the clear_target.sqf and check_target.sqf are separate from the init_target.sqf, it seems plausible. Either that or it's just a typo or syntax error and I'm over-complicating things.

Edited by Tholozor

Share this post


Link to post
Share on other sites
First off, this script is fantastic. Must more realistic than just hitting a pop-up target anywhere and getting a 'kill.' Very good for marksman ship.

Now on to the issue, I get this error as well:

Error in expression <scoretable;
};
if (WALK_TARGET_PUBVAR == _target) then { _scoretable = null; >
 Error position: <== _target) then { _scoretable = null; >
 Error ==: Type Script, expected Number,String,Object,Side,Group,Text,Config entry,Display (dialog),Control,Team member,Task,Location

However, I discovered that the error occurs when there is a lot of stuff on the map. The map I'm using it on is a training map, with a couple of various weapon ranges and numerous teamwork scenarios spread out across the map. I made a copy of the map and started deleting areas. I eventually deleted all of the scenario areas and then the script worked perfectly, no error.

Got me thinking; does this script have trouble overcoming script lag? Is the script getting slowed down to the point that it's attempting to call on variables that have not caught up yet? Given that the clear_target.sqf and check_target.sqf are separate from the init_target.sqf, it seems plausible. Either that or it's just a typo or syntax error and I'm over-complicating things.

I noticed something similar, on the demo mission it works fine, if I copy that (and the una folder) into my mission it doesn't work. However in a new mission it seems to work fine.

Share this post


Link to post
Share on other sites

Okay, I think I fixed it. This worked for me, so I don't know about anyone else.

I hope Walker doesn't mind, considering this is his script, but this seemed to work, so I thought I'd share with everyone having this problem.

init_target.sqf

if (WALKTARGETPUBVAR) then {
	sleep 0.1;
	_scoretable = null; //[COMBAT]Geo modification
	_scoretable = [];
	_score_table_count_before = 0; //[COMBAT]Geo modification
	WALKTARGETPUBVAR = false;
	publicVariable "WALKTARGETPUBVAR";

clear_target.sqf

hintSilent "Target cleared";
WALKTARGETPUBVAR = true;
publicVariable "WALKTARGETPUBVAR";

Taking out the underscores and making that variable operate directly as a boolean seemed to do the trick. I only did this test with a single target and monitor, so I'm testing to see if multiple works okay.

Share this post


Link to post
Share on other sites

I managed to get it to work hosting on my own machine by myself (I had a few other changes after my last post, more info below*), but I'm still waiting for my map to be uploaded to our dedicated server so I can see it it'll work with latency and other players.

*I found that some of the code in init_target.sqf where it checks if a target has been cleared was attempting to execute too quickly. I added a few hints at specific lines to see how fast the code was firing, and certain variables were not being picked up. I added some sleep 0.1; lines at certain points in the code when a target is cleared to give it some minuscule pauses in order to let everything sync up. I added that line right after it checks if WALKTARGETPUBVAR if true, and one right before and one right after it removes the actions from the target and monitor object.

*After my initial change with WALKTARGETPUBVAR in my last post, I started getting another error (can't remember what the error said). I managed to fix that by pretty much doing the same thing with the names of the actions, I removed the underscores and commented out where they were declared null at the beginning of the script.

I basically changed each action:

_action_cs
_action_ct
_action_csm
_action_ctm

to this:

actionCS
actionCT
actionCSM
actionCTM

Also, I found that the script was adding the actions to a monitor object once the target was cleared, so I commented that code out as well. The target and monitor only get their acitons initially once there have been new hits to the target, so it didn't make sense to me to give the monitor the actions again when they had just been removed a few lines ago, and there have been no new hits since it was just cleared.

So now once a target has been cleared, both target and monitor have no actions. Once the target gets a new hit, the script starts from the beginning and adds them again.

Share this post


Link to post
Share on other sites

Mmhh, could you guys load the complete code up? I tried the changes without success, script seems broken now... (clearing a target doesnt work)

Share this post


Link to post
Share on other sites

I have uploaded my fixed version, based on what Tholozor said. I had to do some more stuff (can't remember what) to get it to work, but it works fine in a hosted environment. Can't possibly tell you if it works properly in MP yet as I have not had time to test it.

Here you go.

(I wouldn't normally edit and re-upload someone else's release but Walker does appear to have disappeared)

Share this post


Link to post
Share on other sites

That was fast, thank you!

I will report back after testing it with multiple players in MP...

Share this post


Link to post
Share on other sites

The map I was working on was uploaded to our dedicated server, and the only problem we ran into was that the monitor actions were duplicating whenever a new hit was made on a target. Clearing the target was only clearing the set of actions associated with that registered hit. Other than that, the script worked, but I'm looking into the code for adding actions when a new hit is made on a target.

I'm thinking the code that removes and re-adds the actions whenever it detects a new hit is trying to execute too quickly for the server, much like the previous issue with monitor actions. It might be a while before I can be able to test this theory though.

Share this post


Link to post
Share on other sites

Tested it on a dedicated server with two shooters. We had no issues except the clear target message was always there after shooting at the target. But clearing it, worked fine. Good to see it working now!

Share this post


Link to post
Share on other sites

I have an error with the script :( Everything looks right to me but it's obviously not. Any help would be great! (I'm new and have to post once before I can post a link...I'll post again with a link in a sec)

---------- Post added at 13:07 ---------- Previous post was at 13:06 ----------

Here's the link to the image http://i1091.photobucket.com/albums/i390/aPRO_SLASHER/7CMBG%20-%20Arma%202%20CO%20Realism%20Unit/Errors/arma2oa2012-07-2012-26-22-48.jpg?t=1342812584

Share this post


Link to post
Share on other sites

appreciate if you could help making this mod, IPSC shooting

5 times World champion Eric Grauffel

it has various targets type, scoring, barrier, popper targets, and timer is needed,

then we can use ArmA2 Editor to create various stages and held a IPSC tournament. that would be great fun.

Share this post


Link to post
Share on other sites

@Walker 001 The recent Betas have revelaed that your neat little Addon is full of undefined Variables, spaming the RPT. Any Chance of fixing those?

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  

×