Jump to content
Sign in to follow this  
bloodxgusher

Small Script

Recommended Posts

I am currently working on a mission where im giving a AI driver way points in bus. My AI unit is named Bill and in his Init line I have

BusDriverBill assignasdriver Chernarus1; [busDriverBill] ordergetin true;

The name of the bus is Chernarus1.

What I want to do is lock the driver seat once Bill has entered the bus. I have in the bus's init line

Chernarus1 lockDriver lock;

also i tried

Chernarus1 sleep 5 then do lockDriver lock;

I'm pretty sure im declaring or starting the script wrong.

This does not seem to lock the driver position because when ever any type of shooting happens the driver briefly gets out and goes prone making the driver slot open for me to enter. The driver will then renter the bus as the driver.

Is there a way to have the driver stay in the vehicle while shooting is going on around him or to actually lock in the driver seat?

Also I wanted to make the fuel infinite or constantly refuel on its own.

I have tried placing

Chernarus1 setfuel -1

That actually empties all fuel.

I have also tried

if (Chernarus1 fuel<0.50) then do (Chernarus1 setfuel 1);

I have had no luck with that either.

Anyone have any suggestions? Thanks in advance and thanks for reading.

Share this post


Link to post
Share on other sites

Chernarus1 lockDriver true;

if (Chernarus1 fuel < 0.5) then {Chernarus1 setfuel 1}; 

:)

Share this post


Link to post
Share on other sites
Chernarus1 lockDriver true;

if (Chernarus1 fuel < 0.5) then {Chernarus1 setfuel 1}; 

:)

Lol I are noooob...Thanks for the info.

Question. does the { } brackets change how the game reads code from the ( ) brackets?

By the way. When I place your correcting of my previous code if (Chernarus1 fuel < 0.5) then {Chernarus1 setfuel 1}; in the init line of Chernarus1 I get the following error "Missing )" Am I missing a symbol?

Edited by BloodxGusher

Share this post


Link to post
Share on other sites

Wow a great little thread, I needed to know this. Too bad the title will be useless for those of us that may use the search to find this solution.

It's a good thing I stumbled across it when I did.

Share this post


Link to post
Share on other sites
There are other methods for unlimited fuel as well. :)

Hey Kylania. I checked out your link and it works great. Thanks for posting. I was wondering if you all could help me farther with the locking of the driver position after a certain amount of time.

In my Chernarus1 Bus Init box I have the following to

nul = this spawn { while {alive _this} do { waituntil lockedDriver false; sleep 2; _this lockDriver Chernarus1; } };

I borrowed the same format from the infinite fuel script. Anyone know another way to go about this?

Share this post


Link to post
Share on other sites

Well, a kludgy way of doing it is simply teleport (guy moveInDriver bus) the poor guy back into the driver spot if he leaves it, via a !(guy in bus) trigger. Set him and the bus to allowDamage false and while he'll stop and jump out when there's gunfire a split second later he'll be back in the bus and driving away.

Share this post


Link to post
Share on other sites
Well, a kludgy way of doing it is simply teleport (guy moveInDriver bus) the poor guy back into the driver spot if he leaves it, via a !(guy in bus) trigger. Set him and the bus to allowDamage false and while he'll stop and jump out when there's gunfire a split second later he'll be back in the bus and driving away.

Lol I just tried this...AI's are stuborn bastards. He gets out...does a circle and then stops looks for about 20 secs then gets back in...

Would setting behavior dictate at all how AI react to gun fire. Also would the unit type matter. The Unit i am currently using is a Civilian Pilot.

Now I got this bit of code from the website you sent me. Any suggestions on how to rework this into making my driver who's name is BusDriverBill the only one who can drive the bus?

_vehicleType = _this select 0;  // "Helicopter" / "Tank"
_crewType = _this select 1;  // "US_Soldier_Pilot_EP1"

//hint format["%1 - %2",_crewType, _vehicleType];
 if (typeof player != _crewType) then {
   private "_v";
   while {alive player} do {
     waituntil {vehicle player != player};
     _v = vehicle player;
     if (_v iskindof _vehicleType && !(_v iskindof "ParachuteBase")) then {
       if (driver _v == player) then {
         player action ["eject",_v];
         waituntil {vehicle player == player};
         hint "We shall leave the piloting to those with the appropriate training.";
       };
     };
   };
 };

Thanks all.

Share this post


Link to post
Share on other sites

You set your trigger wrong than, he should only be out of the bus a split second. The problem isn't people getting in as driver, but instead preventing the guy from getting out constantly. You wanted a civilian bus that keeps driving a preset path through a combat zone right?

Share this post


Link to post
Share on other sites
You set your trigger wrong than, he should only be out of the bus a split second. The problem isn't people getting in as driver, but instead preventing the guy from getting out constantly. You wanted a civilian bus that keeps driving a preset path through a combat zone right?

Yes that is correct. What I want him to do is constantly drive to points on the map, wait for specific times. then head to the next waypoint.

Init of the bus. The bus is named Chernarus1

this allowdamage false; Chernarus1 = this spawn { while {alive _this} do { _this setFuel 1; sleep 10 } }; Chernarus1 lockdriver true;

Init of the Driver. The Driver is named BusDriverBill

this allowdamage false; BusDriverBill assignasdriver Chernarus1; [busDriverBill] ordergetin true; BusDriverBill moveindriver Chernarus1; _combat = behaviour BusDriverBill

Maybe you can see what im may be doing wrong.

Now this will be multiplayer so I wanted two things to happen. No other player who has connected to be able to get in the driver seat of the bus at all and the designated driver of the bus to constantly stay in the bus regardless of what is going on outside of the bus.

Movein order helps but does not instantly put the driver back in once he gets out or is it suppose to act another way?

Share this post


Link to post
Share on other sites

I posted the method to get him back in instantly above.

Have a trigger with condition of:

!(BusDriverBill in Chernarus1)

And onAct of:

BusDriverBill moveInDriver Chernarus1

Share this post


Link to post
Share on other sites
I posted the method to get him back in instantly above.

Have a trigger with condition of:

!(BusDriverBill in Chernarus1)

And onAct of:

BusDriverBill moveInDriver Chernarus1

Hmm this helps somewhat. They definitely get in faster. Im still suffering from other players able to enter the driver seat once in the bus. Even with "Chernarus1 LockDriver true;" in the init of the bus, players can still switch into the driver position. Im guessing now that is not a ability that can be scripted into the game?

Share this post


Link to post
Share on other sites

That's odd, I'm not able to get in as driver if it's lockDriver set. From outside or inside the bus. Even if the guy isn't in it.

Share this post


Link to post
Share on other sites

Lol your playing right? Isn't that what we have been trying to solve for? Lol.

Well if this works. Much thanks to you. I still have yet to test it out.

I ask one more questions of you.

On this bus route I have created. I have used waypoints and on everyway point has the option of using a effect or trigger.

What I want to do is have text pop up on the screen saying such phrases like.

"You have reached the Gas Station, Next stop the Library"

The problem with this is, when I add those effects in, everyone on server can see the text. The effect is the "Plain" formate that fades after a set time.

Is there any other way to go about achieving this.

So far I have thought of using Triggers but that is about the same...everyone will see it once they pass the marked area's.

I also thought about maybe having the bus generate some text in the vehicle chat but was unsuccessful in executing that......I know it goes something like Chernarus1 vehiclechat "You have reached the Gas Station. Next stop the Library" ..but I hear this does not broadcast so maybe a event handler will make this possible?

Share this post


Link to post
Share on other sites

I believe you should be able to have the waypoint execute a script and just check for whoever is in the bus and hint for them. Then again, my last attempt at using hints failed miserably, so don't listen to me... :(

Share this post


Link to post
Share on other sites

player in Chernarus1

That will limit the hints.

Share this post


Link to post
Share on other sites
I believe you should be able to have the waypoint execute a script and just check for whoever is in the bus and hint for them. Then again, my last attempt at using hints failed miserably, so don't listen to me... :(
player in Chernarus1

That will limit the hints.

So is it Chernarus1 lockDriver set or Chernarus1 lockDriver set; ?

I was unsuccessful in using this in my mission. Apparently this only works in the editor seeing that is the only place I got this command to work.

So now im thinking maybe i can try a random script possibly something like...

if (player == driver) then {player moveIncargo chernarus1};

I know that is like awful but do you guys think you can take that somewhere?

Onto the chat... Player in Chernarus1...Is that all I write? Is this the command for the Hint system only? How does this work if you dont mind giving me a a example.

Edited by BloodxGusher

Share this post


Link to post
Share on other sites
Will do when I get home if no one else has. :)

Rgr that. Ill standy by for your reply.

Share this post


Link to post
Share on other sites

Here's your demo mission. The secret is you cannot use a civilian! :) Make BusDriverBill a BLUFOR unit with all the restrictions we've given him in this thread, and then some, and he'll happily pass through combat without a care in the world. If he's a civie though, he'll stall and stop and be a PITA...

So, you can either go with having a driver no one will ever really look at looking like a dude and dealing with all his problems, or have an unarmed Marine driving people around while off duty without any problems. :)

Share this post


Link to post
Share on other sites
Here's your demo mission. The secret is you cannot use a civilian! :) Make BusDriverBill a BLUFOR unit with all the restrictions we've given him in this thread, and then some, and he'll happily pass through combat without a care in the world. If he's a civie though, he'll stall and stop and be a PITA...

So, you can either go with having a driver no one will ever really look at looking like a dude and dealing with all his problems, or have an unarmed Marine driving people around while off duty without any problems. :)

Thanks dude. I was in the editor came to the conclusion that I may need a Blufor driver like 10 mins before looking at this. Lol

Much help. Thanks again.

Share this post


Link to post
Share on other sites

Since there are a lot of 'waitUntil's in the script, can someone tell me what the 'opposite' of this is...

waitUntil {player in HeloTransport};

[HeloTransport_pilot] join player;

(Now, of course, I then tell the pilot to go somewhere, but that should not matter.)

waitUntil {player action "eject"};

[HeloTransport_pilot] join helo_group;

I have been working on that red line for hours. I cannot get it. I have the pilot waiting for me to get in, how do I have him wait till I get out (after we move). I have tried all kinds of waitUntil lines.

Of course, I still have to get him to hover and set another waypoint, and some more stuff, but hell, I cannot even get this line to work.

TIA

Share this post


Link to post
Share on other sites
waitUntil {!(player in HeloTransport)};

kylania, thank you, but, you know, ;), I am going to ask you to explain that.

I tried so much stuff I cannot remember it all, like:

waitUntil {player !=in HeloTransport};

waitUntil {player not in HeloTransport}; (heh)

anyway, then, this would be better...

waitUntil {player [color="Red"]([/color]in HeloTransport[color="Red"])[/color]};
[HeloTransport_pilot] join player;
waitUntil {!(player in HeloTransport)};
[HeloTransport_pilot] join helo_group;

Sheeesh, that one !, and the parentheses? The prentheses are really needed? :confused:

Share this post


Link to post
Share on other sites
parentheses? The prentheses are really needed? :confused:

You can never have too many parenthesis. :P

You can try it without though:

!player in HeloTransport

Either the game engine understands to check the whole thing, or it just checks if the variable player is true/false.

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  

×