Jump to content

[RELEASE] TradeFromVehicle - Version 2.0 is here!


Csus

Recommended Posts

It doesn;t rely on what the trader actual sells, it relies on you configuring the init so that it only buys what they sell.

So if you tell the script that your wholesaler sells RPGs, your wholesaler will buy them from you XD

 

@T.LEE

 

I reccomend you put this line

systemChat "1";

at the start, end and other places around the center of the init. Increment the number by 1 each time.

now when you get in game it will say 1,2,3,.... at the sdie of your screen.

if you put 10 of these in the init but it only goes to 7 lets say, it pinpoints any errors that maybe there.

 

give this a try and let me know what you find

Link to comment
Share on other sites

okay, go into your mission.sqm file and look for something like this, mine is for Napf but it will look the same.

	class Sensors
	{
		items=10;
		class Item0
		{
			position[]={8246.3184,15.544708,15485.867};
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="Lenz";
			expCond="(player distance Lenz) < 50;";
			expActiv="TitleText[""Now Entering Trader City Lenzburg"",""PLAIN DOWN""]; canbuild = false;";
			expDesactiv="TitleText[""Now Leaving Trader City Lenzburg"",""PLAIN DOWN""]; canbuild = true;";
			class Effects
			{
			};
		};
		class Item1
		{
			position[]={15506.952,6.2226005,13229.368};
			a=100;
			b=100;
			activationBy="WEST";
			repeating=1;
			interruptable=1;
			age="UNKNOWN";
			name="Emmen";
			expCond="(player distance Emmen) < 100;";
			expActiv="TitleText[""Now Entering Trader City Emmen"",""PLAIN DOWN""]; canbuild = false;";
			expDesactiv="TitleText[""Now Leaving Trader City Emmen"",""PLAIN DOWN""]; canbuild = true;";
			class Effects
			{
			};
		};

In the 'Class Sensors' chunk of code find the trader cities you have and change the expActiv and expDesactiv line to have the 'canbuild = true/false' on the end. Just copy the ends of the lines here and everything should work perfect for you :)

 

I believe it's because this script waits for a variable called 'canbuild' to be false,which usually means you're in a trader city. If  one or more of your trader city sensors doesn't stop you from building this script will just keep on waiting.

Link to comment
Share on other sites

new version is now ready, updated the OP with the new files.

if you're not interested in being able to sell magazines to traders, don't bother with these new files.

check the documentation.txt file for info on the new update and how to set it up properly using your current lists of traders, items and prices.

Link to comment
Share on other sites

i'm sure you could implement it very easily into that though

 

simplified, you could do something like.

while {true} do {
    {
        if (player distance _x < 75) then {
            canbuild = false; 
        } else {
            canbuild = true; 
        };
    } forEach _dynamicTraders;
};

just have the positions of the traders be stored into an array on restart.

that is, if i'm presuming correctly, that dynamic traders just spawn in a different place each restart.

Link to comment
Share on other sites

@sisquo007

I could add magazine selling to it, i'll get that out as soon as i can :)

 

@Bambit

After nearly 10 years of using this name in games and generally everywhere online, someone finally knows what it is :D

And, if you know how to adjust it to sell from your backpack, you're more than welcome to do so. Let me know how it goes!

Hehe :D

That's because normal people don't make music :) You can make a nice change from Csus to C. 

I have no bloody idea on how to adjust it to make it a backpack selling script :P as I have no clue about any of it. But I have some great experience with trial and error method, so I might come up with something... or not :D

Link to comment
Share on other sites

trial and error is the way forward! :D

i've only been making things with ArmA for about 2 months and I learned all I know by breaking things XD

 

if I manage to find the time I might work on a proof-of-concept version of a backpack trading variant. maybe

Link to comment
Share on other sites

i'm sure you could implement it very easily into that though

 

simplified, you could do something like.

while {true} do {
    {
        if (player distance _x < 75) then {
            canbuild = false; 
        } else {
            canbuild = true; 
        };
    } forEach _dynamicTraders;
};

just have the positions of the traders be stored into an array on restart.

that is, if i'm presuming correctly, that dynamic traders just spawn in a different place each restart.

that wont work, but thanks anyway. I just dont get what the canbuild is a requirement...

Link to comment
Share on other sites

canbuild is used because, generally it signifies that the player is in a trade zone.

if you look at your mission.sqm file and find the Class Sensors section you will see that on the majority of your trade areas the ExpActv will say canbuild=false and the ExpDesactiv will say canbuild=true;

 

an even simpler method to have this work with dynamic traders, providing the trader models are alwasy the same is just delete the line that says

waitUntil {!canBuild};

it's a little less efficient that way but it will work

Link to comment
Share on other sites

if you could provide me with a link to the script/mod/tutorial of whatever it is that creates the dynamic traders and your TradeFromVehicle\init.sqf file i'll do what I can to help you out with it

Link to comment
Share on other sites

if you could provide me with a link to the script/mod/tutorial of whatever it is that creates the dynamic traders and your TradeFromVehicle\init.sqf file i'll do what I can to help you out with it

nah, the problem is the allowed vehicles it break it... I tested the fixed trader with the default files and worked lol thats why I get confused, now I removed that and now all works.

 

Sad, because I wanted to make people use trucks to do this, to give some sort of functions to the trucks...

Link to comment
Share on other sites

@jackislost

 

I think the problem you're having with the allowed vehicles is actually my fault, I made a typo in the instruction I posted for you on page one.

_isAllowed = (typeOf _vehicle) in tfv_allowedVehicles;

should actually be -

_isAllowed = (typeOf _vehicle) in tfv_ALLOWED_VEHICLES;

if you make that change it should work for you.

 

If that works for you, I'm so sorry for sending you on a wild goose chase just because I can't type properly XD

The originalm posting of this bit of code has been edited to have 100% less typos XD

 

Also, I apologise for all the confusion. I've been very very tired a lot so it's been difficult for me to keep track of what everybody was saying and asking.

Edited by Csus
Link to comment
Share on other sites

@jackislost

 

I think the problem you're having with the allowed vehicles is actually my fault, I made a typo in the instruction I posted for you on page one.

_isAllowed = (typeOf _vehicle) in tfv_allowedVehicles;

should actually be -

_isAllowed = (typeOf _vehicle) in tfv_ALLOWED_VEHICLES;

if you make that change it should work for you.

 

If that works for you, I'm so sorry for sending you on a wild goose chase just because I can't type properly XD

The originalm posting of this bit of code has been edited to have 100% less typos XD

 

Also, I apologise for all the confusion. I've been very very tired a lot so it's been difficult for me to keep track of what everybody was saying and asking.

tested, wont work. :/ but thanks for answer man.

Link to comment
Share on other sites

@AceOfSpades

 

The trader selects the vehicle the player was in the driver seat last. If, during the 5 seconds countdown and the entire trade sequence, someone else gets in the vehicle the trade is cancelled. Although, people cannot enter the vehicle during trading.

 

Basically: you can only sell items from the vehicle you was previously in as the driver and only if the vehicle is empty of any other players.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Advertisement
×
×
  • Create New...