Jump to content
Tankbuster

group returned by fnc_spawngroup. Am i doing this right?

Recommended Posts

_smgrp1 = [_deliverypos, west, (configfile >> "CfgGroups" >> "West" >> "Guerilla" >> "Motorized_MTP" >> "IRG_Technicals")] call BIS_fnc_spawngroup;

{
	if ((vehicle _x) isKindOf "LandVehicle") then 
	{
	(vehicle _x) setfuel 0};
	};
} foreach (units _smgrp1);

I don't want the technicals to drive off, but they are spawning with fuel. Am I doing this right?

Share this post


Link to post
Share on other sites

Is it my bracketting that making the script not work?

 I assumed it was the way I was iterating through the group and picking the vehicle out of that

Share this post


Link to post
Share on other sites
13 minutes ago, Tankbuster said:

Is it my bracketting that making the script not work?


I assume you are not a huge fan of -showScriptErrors?

Share this post


Link to post
Share on other sites
5 minutes ago, killzone_kid said:


I assume you are not a huge fan of -showScriptErrors?

You assume wrong.

Share this post


Link to post
Share on other sites
17 minutes ago, das attorney said:

They're ok, but pointless imo.  Anyway, is this SP or MP???

This is serverside, MP. They are AI for players to interact with.

Share this post


Link to post
Share on other sites

When they are spawned, they are local to the server, where the script is running. They never get grouped with a player - I should have said that earlier.

Share this post


Link to post
Share on other sites

Oh, and there's no headless clients involved.

Share this post


Link to post
Share on other sites
8 minutes ago, Tankbuster said:

When they are spawned, they are local to the server, where the script is running. They never get grouped with a player - I should have said that earlier.

edit nvm

Share this post


Link to post
Share on other sites

It doesnt happen in that order. The players don't (well, they needn't) get in the vehicles for a number of minutes after the spawngroup and script runs.

 

Players actually arrive in a helicopter with a slingloaded huron box underneath. Their task is to put the box on the ground near the ai group, so most times, they aren't going anywhere near them

Share this post


Link to post
Share on other sites
15 minutes ago, Tankbuster said:

You assume wrong.


Strange, your script gives me a bunch of errors, but I'm glad it doesn't do this for you. 

Share this post


Link to post
Share on other sites

I'm a huge fan of your work and am always grateful for your contributions (my mission is littered with your stuff), but while you're taking the time to post, would you be good enough to actually help rather than be an arse?

  • Like 1

Share this post


Link to post
Share on other sites
4 minutes ago, Tankbuster said:

I'm a huge fan of your work and am always grateful for your contributions (my mission is littered with your stuff), but while you're taking the time to post, would you be good enough to actually help rather than be an arse?


What the hell? Run your script yourself with -showScriptErrors, it fails with a bunch of errors, what else there to help with? Check your script and amend it until it doesn't produce an error and come back. There, helpful?

Share this post


Link to post
Share on other sites

Perhaps the underlying question is;

 

The group that is returned by fnc_spawngroup - given that the optional parameters the function can accept include stuff like ammo, position, skill and direction, but not fuel, whats the best way of picking out a spawned vehicle so I can do something like setfuel?

Share this post


Link to post
Share on other sites
2 minutes ago, killzone_kid said:


What the hell? Run your script yourself with -showScriptErrors, it fails with a bunch of errors, what else there to help with? Check your script and amend it until it doesn't produce an error and come back. There, helpful?

I'm not at the mission development machine right now. I got the code from my repository.

 

I have a server with a dozen megabytes of RPT, I can assure you I'm familiar with the little black box showing errors too. I've been doing this since 2005.

Share this post


Link to post
Share on other sites

Since you didn't get KKs hint from his first answer I'll give you another:

{
	if ((vehicle _x) isKindOf "LandVehicle") then 
	{
	(vehicle _x) setfuel 0};
	};
} foreach (units _smgrp1);

Count the curly brackets.

Does the amount of opening and closing brackets match?

Spoiler

It doesn't.

:yay:

Cheers

  • Like 2

Share this post


Link to post
Share on other sites

Just remove the extra } in your condition and the code works. You can remove this condition as well.

  • Like 1

Share this post


Link to post
Share on other sites

 

Oh cock. Why is there an extra curly close after setfuel? That extra bracket isn't in the code in the repo but is in the OP. I think it got added when I added tabs and indentation.

It works now, thanks all. :)

 

Line 40 in show diffs;

https://app.assembla.com/spaces/coop40-authority-altis/subversion/commits/1556

 

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

×