Jump to content
Sign in to follow this  
Stubbinz

Help, game logic Server isn't working for me....

Recommended Posts

Hey guys, i've been searching and doing some trail&error work, and for the life of me i can't figure out why my scripts are running for everyone on my lan games.

Even something as simple as spawning a vehicle on a gamelogic position. It spawns at first, but as soon as something interacts with it, another vehicle spawns right on top of it equal to the amount of players playing. My way around this was giving players the option to spawn said vehicle at an ammobox then using modeltoworld etc etc. it will spawn one vehicle.

Likewise with another mission, i have a paradrop script that ejects everyone out of a c-130 yet, it spawns an additional empty parachute per player. I can't figure it out. They are really simple scripts and in each mission i have a game logic named server which to my knowledge is supposed to help combat this exact thing.

:confused::confused::confused:

Any help is appreciated.

Share this post


Link to post
Share on other sites

Hi.

The "Server" Logic is not doing anything. Its used by some user made script/functions but it has no real effect whatsoever.

Your problem here is locality.

Here is some explanation for that:

http://forums.bistudio.com/showpost.php?p=1474511&postcount=8

http://community.bistudio.com/wiki/6thSense.eu:EG

Commands with global effect, like in your case "createVehicle" should only be called and executed on one machine (mainly the server).

For example:

This will create one HMMWV per client + one created by server.

_Test = "HMMWV" createVehicle _Pos;

This will only create one HMMWV at all:

if (isServer) then {
// commands with global effect here
_Test = "HMMWV" createVehicle _Pos;
};

Share this post


Link to post
Share on other sites

Thank you!!!!!!

Was giving me a headache.

Share this post


Link to post
Share on other sites

I gone through the same pain :) We all did, at the beginning of multiplayer mission making.

Its confusing at the beginning. And the editor preview dont give you a real preview of how it will work when theres more than one client.

So you can only test it with your mates.

Share this post


Link to post
Share on other sites

Ha that's what ive been doing. ha.

I also have another problem, i'm spawning west units, that are supposed to be friendly with resistance units, yet when they actually meet up, they shoot it out.

I have the setfriend syntax applied to both sides as 1. Whats the problem with that?

Share this post


Link to post
Share on other sites

Click on the Date on the right bar in the editor.

At the bottom of the following pop up you set this. If that doesn't help, the next question is:

How do you spawn these units?

Share this post


Link to post
Share on other sites

Oh, im not that much of a newb. ha.

I have independents set to opfor friendly in that, and i spawn the units like so.

suv1 = "SUV_TK_CIV_EP1" createVehicle (getpos suv_spawn);
suv2 = "SUV_TK_CIV_EP1" createVehicle (getpos suv_spawn);
suv1 setdir 120;
suv2 setdir 120;
~1



_squad = position SUV_spawn;
_Grp1 = Creategroup WEST;

_leader="TK_Special_Forces_EP1" createUnit [_squad,_Grp1,"this moveindriver 

suv1",0.5,"Corporal"];
bagent01="Functionary1" createUnit [_squad,_Grp1,"this moveincargo 

suv1",0.5,"Corporal"];
_Unit2="TK_Special_Forces_EP1" createUnit [_squad,_Grp1,"this moveincargo 

suv1",0.5,"Corporal"];
_Unit3="TK_Special_Forces_EP1" createUnit [_squad,_Grp1,"this moveincargo 

suv1",0.5,"Corporal"];
_Unit4="TK_Special_Forces_EP1" createUnit [_squad,_Grp1,"this moveincargo 

suv2",0.5,"Corporal"];
_unit5="TK_Special_Forces_EP1" createUnit [_squad,_grp1,"this moveindriver 

suv2",0.5,"Corporal"];
_unit6="TK_Special_Forces_EP1" createUnit [_squad,_grp1,"this moveincargo 

suv2",0.5,"Corporal"];
~1


EAST setFriend [RESISTANCE, 1];
RESISTANCE setFriend [EAST, 1];





_WP1 = _grp1 addWaypoint [position suv_route_1, 0];
_WP1 setWaypointType "MOVE";
_WP1 setWaypointBehaviour "safe";
_WP1 setWaypointCombatMode "YELLOW";
_WP1 setWaypointDescription "Truck Secure Team.";
_WP1 setWaypointSpeed "NORMAL";

_WP2 = _grp1 addWaypoint [position suv_route_2, 0];
_Wp2 setWaypointType "MOVE";
_WP2 setWaypointBehaviour "safe";
_WP2 setWaypointCombatMode "YELLOW";
_WP2 setWaypointDescription "Truck Secure Team.";
_WP2 setWaypointSpeed "NORMAL";

_WP3 = _grp1 addWaypoint [position suv_route_3, 0];
_WP3 setWaypointType "MOVE";
_WP3 setWaypointBehaviour "safe";
_WP3 setWaypointCombatMode "YELLOW";
_WP3 setWaypointDescription "Truck Secure Team.";
_WP3 setWaypointSpeed "Normal";

_WP4 = _grp1 addWaypoint [position suv_getout, 30];
_WP4 setWaypointType "GETOUT";
_WP4 setWaypointBehaviour "aware";
_WP4 setWaypointCombatMode "YELLOW";
_WP4 setWaypointDescription "Truck Secure Team.";
_WP4 setWaypointSpeed "Normal";
_wp4 setwaypointstatements ["true","fox_1 sidechat 'HQ, targets have stopped and are 

proceding to search the area. Advise.'; suvdrop = true"];

_WP5 = _grp1 addWaypoint [position suv_town_center, 10];
_WP5 setWaypointType "SAD";
_WP5 setWaypointBehaviour "aware";
_WP5 setWaypointCombatMode "YELLOW";
_WP5 setWaypointDescription "Truck Secure Team.";
_WP5 setWaypointSpeed "Normal";
_WP5 setWaypointformation "Diamond";
_wp5 setwaypointstatements ["true AND ? ! alive warlord_shadi","bagent01 globalchat 

'Where is Shadi? Look for him!'"];

exit;

That's the script i have right now. And when the suv's are following the path, when they run into the first resistance patrol, they get out and fire away and of course the resistance shoots back. Basically i'm trying to make it seem like another nation or group of people are doing a deal with someone that the players previously captured.

---------- Post added at 01:20 AM ---------- Previous post was at 01:18 AM ----------

Yup im a retard, i see that i had creategroup west haha so disregard......

*facepalm*

---------- Post added at 01:22 AM ---------- Previous post was at 01:20 AM ----------

Gah i hate scripting sometimes because it can always be something as small as that. ha

Share this post


Link to post
Share on other sites

Change this:

EAST setFriend [RESISTANCE, 1];
RESISTANCE setFriend [EAST, 1];

to:

WEST setFriend [RESISTANCE, 1];
RESISTANCE setFriend [WEST, 1];

Btw the script doesn't look healthy because its mixed up SQS and SQF. Which is a bad thing...

Change:

~1

to:

sleep 1;

Then you have complete SQF. Just make sure you start it with nul = execVM "script.sqf"; instead of [] exec "script.sqf"; which is for SQS.

...and delete the exit; at the bottom, scripts exit them selfs, when their done. :)

Share this post


Link to post
Share on other sites

Ah, see there is thing i don't know very much about at all, the difference between .sqs files and sqf.

Sqf seems very complicated to me. :/

---------- Post added at 01:33 AM ---------- Previous post was at 01:29 AM ----------

P.S. I'm still used to scripting for Operation Flashpoint. never had a chance to do the first arma, then i got ARMA II and sqf is still very foreign to me.

Share this post


Link to post
Share on other sites

No they have the same commands. There's not so much different.

Important for SQF is just the ; at the end of each command.

If your file is called .sqf and you have the ~1 without the ; at the end the script will stop at this line with an error.

And the if then else stuff looks a bit different. But SQF makes more sense when you ask me.

SQS:

? (_counter >= 10) : do this code

SQF:

if (_counter >= 10) then { do this code };

Its more neatly arranged then sqs.

Share this post


Link to post
Share on other sites

I can already tell i'd have a problem with the {brackets} ha

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  

×