Jump to content
Sign in to follow this  
Tweetdezweet

Civi AI disregards waypoint on dedicated server (works in non-dedicated)

Recommended Posts

Hi, I have been struggling for hours with the following problem:

I build a checkpoint where 2 civilians drive to and put 3 waypoints there, allmost on top of each other:

1) move (towards checkpoint)

(condition: civi1 getVariable ["GetOut", false] && civi2 getVariable ["Getout", false])

2) getout

(condition: civi1 getVariable ["clearToGo", false] && civi2 getVariable ["clearToGo", false])

3) getInNearest

4) move (away from checkpoint)

I have added an action to the vehicle they use called "Order get out" and an action called "Cleared to go" to both civilian units

As you guessed, the "Order get out", basically does setVariable ["GetOut", true,true] and ofc "Cleared to go" does setVariable ["clearToGo", true, true] for both civilians

When I test this in SP it works like a charm, when I host a server myself (internet or LAN), it also works like a charm...

but on the dedicated server, they get out, run off to a random point in the hills to just return after a while to the waypoint they were supposed to be at

I am seriously clueless, I tried everything I can think off :(

Any help is greatly appreciated.

grtz Tweet

Share this post


Link to post
Share on other sites

I honestly don't know how this is working at all because you are using getVariable incorrectly. It should be:

civi1 getVariable "GetOut" && civi2 getVariable "GetOut"

and

civi1 getVariable "clearToGo" && civi2 getVariable "clearToGo"

I have no idea how getVariable deals with arrays, so this may be the root of the problem. Try it this way and see if the problem persists.

Share this post


Link to post
Share on other sites
I honestly don't know how this is working at all because you are using getVariable incorrectly. It should be:

civi1 getVariable "GetOut" && civi2 getVariable "GetOut"

and

civi1 getVariable "clearToGo" && civi2 getVariable "clearToGo"

I have no idea how getVariable deals with arrays, so this may be the root of the problem. Try it this way and see if the problem persists.

http://community.bistudio.com/wiki/getVariable

the syntax I use is the one where if the variable doesnt exist it returns the default value, so the issue is not that command :)

Share this post


Link to post
Share on other sites

Interesting. I've never seen that syntax before.

It looks to me like the public parameter of your setVariable statements isn't working. According to the Biki, only object- and group-type data can be broadcast in this way, and you're trying to broadcast boolean-type data. This wasn't a problem when you were testing as the host or solo because the action script was local to the server (you) anyway, but with a dedicated server, it isn't. The easiest way to circumvent this issue, I think, would be to scrap using object variables and just make a couple of global variables instead; publicVariable will be able to broadcast the change of just about any data type, boolean included. But if you insist on using those object variables, you could probably get them to work using setVehicleInit, like so:

civi1 setVehicleInit "this setVariable [""GetOut"",true]";processInitCommands

This will globally set the variable to true, and you can do the same thing for your other object variables. If you want to change more than one, you only have to use "processInitCommands" once at the end.

Share this post


Link to post
Share on other sites

I am using the globalExecute function from CBA to change those values, so it should work, also they stop at the waypoint so the initializing isnt the problem as well

hmz I am gonna try global variables but the issue doesnt seem related to the locality of the variables since they actually do start on their next waypoint, they just run off in a random direction and then return to do their next waypoint, which they cant do if the variable values are wrong since they are in the waypoint condition

really confusing tbh :s

Share this post


Link to post
Share on other sites

I tried using global variables but the exact same behaviour happens as I suscpected.

The condition for the waypoint is met through setting the variables required for the waypoint condition, however they first run off to a random spot in the hills before moving to their next waypoint...

really annoying since there seems to be no logical explanation for this odd behaviour :s

could it have something to do with AI skill settings on the server I am testing this on?

Share this post


Link to post
Share on other sites

That really is strange. If it's not a locality issue, then it must be a problem with the dedicated server software itself. Perhaps you could try using a different method to see if the dedicated server deals with that any better. For example, try a normal Get In waypoint rather than a Get In Nearest. If that doesn't work, try a scripted solution instead, i.e.:

civi1 assignAsDriver car1;civi2 assignAsCargo car1;[civi1,civi2] orderGetIn true

There's no good reason I can see why your original method doesn't work, but sometimes the dedicated server client doesn't operate in exactly the same way as a normal client. One of these alternative methods may work.

Share this post


Link to post
Share on other sites

unfortunately that was how I started off so that also doesnt work, will see if I can run my own dedicated server using six-updater, if that also works like a charm I need to talk to one of our server admins

but thx for your help :)

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  

×