Jump to content
maggot31

Help me with setWeaponReloadingTime for tanks please

Recommended Posts

I tried a lot of different things but it seems not to be working.  I want a 140k to reload twice faster so I paste "vehicle setWeaponReloadingTime [gunner (vehicle player), currentMuzzle (gunner (vehicle player)), 0.5]; " and it doesn't work. It always says "Missing ;" 
It's my 3rd time pasting scripts to the vehicles so I have no idea how to fix this.

Share this post


Link to post
Share on other sites

vehicle is a command, not a user variable name.

vehicle player setWeaponReloadingTime [gunner vehicle player, currentMuzzle (gunner vehicle player), 0.5];

or

_vehicle == anExistingVehicleVariableNameInYourMission;  // or a spawned one

_vehicle setWeaponReloadingTime [gunner (vehicle player), currentMuzzle (gunner (vehicle player)), 0.5];

 

Welcome to the forum btw.

Share this post


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

vehicle is a command, not a user variable name.

vehicle player setWeaponReloadingTime [gunner vehicle player, currentMuzzle (gunner vehicle player), 0.5];

or

_vehicle == anExistingVehicleNameInYourMission;  // or a spawned one

_vehicle setWeaponReloadingTime [gunner (vehicle player), currentMuzzle (gunner (vehicle player)), 0.5];

"vehicle player setWeaponReloadingTime [gunner vehicle player, currentMuzzle (gunner vehicle player), 0.5];" for this I have the same error "Missing ;"

Also the 2nd variant is not working for me too https://prntscr.com/tstr9v
 

Share this post


Link to post
Share on other sites

That's a problem of copy paste the code (probably from BIKI, then Forum).

So if you paste it in Notepad++, UTF-8 and all characters visible, you'll read:

v?ehicle player setWeaponRe?l?oadingTime [gunner vehicle player, currentMuzzle (gunner vehicle player), 0.5?]

? as 4 extra, unwanted, boring,well-known,invisible characters.

Delete them or write your line by hand.

Share this post


Link to post
Share on other sites
25 minutes ago, pierremgi said:

That's a problem of copy paste the code (probably from BIKI, then Forum).

So if you paste it in Notepad++, UTF-8 and all characters visible, you'll read:

v?ehicle player setWeaponRe?l?oadingTime [gunner vehicle player, currentMuzzle (gunner vehicle player), 0.5?]

? as 4 extra, unwanted, boring,well-known,invisible characters.

Delete them or write your line by hand.

Now it says "Type Bool,expected Nothing" in both variants

As I just looked up I tried
call {
vehicle player setWeaponReloadingTime [gunner vehicle player, currentMuzzle (gunner vehicle player), 0.5];
};
and 
0 = vehicle player setWeaponReloadingTime [gunner vehicle player, currentMuzzle (gunner vehicle player), 0.5];
and it is not working
UPD: Downloaded CBA_A3 from the workshop so now I won't have any dumb mistakes and it appears that scripts are not working for some reason.

Share this post


Link to post
Share on other sites

You need to start with basics. In init field of a unit/object, you can't use a _local variable.

Some editor fields (like init or trigger activation code) must return nothing. 

I don't know what you are trying exactly but your setWeaponReloadingTime will never work this way.

 

I suggest you to write in the init field of the vehicle:

this addEventHandler ["Fired",{
 _this#0 setWeaponReloadingTime [_this#0,_this#2,0.5];
}];

 

 

Share this post


Link to post
Share on other sites
11 minutes ago, pierremgi said:

You need to start with basics. In init field of a unit/object, you can't use a _local variable.

Some editor fields (like init or trigger activation code) must return nothing. 

I don't know what you are trying exactly but your setWeaponReloadingTime will never work this way.

 

I suggest you to write in the init field of the vehicle:

this addEventHandler ["Fired",{
 _this#0 setWeaponReloadingTime [_this#0,_this#2,0.5];
}];

 

 

So basically I paste this to the init field of the tank with no mistakes and invisible symbols https://prntscr.com/tsug3j . Press Ok and everything goes fine without mistakes. But it's just not working for some reason. Still have 5-6 sec reloading time of a cannon. Am I just  not getting a thing or it's really not working the way it should? 
this addEventHandler ["Fired",{
 _this#0 setWeaponReloadingTime [_this#0,_this#2,0.5];
}];

Share this post


Link to post
Share on other sites

Bah, that worked for hunter...

Try:

this addEventHandler ["Fired",{
 _this#0 setWeaponReloadingTime [gunner (_this#0),currentMuzzle gunner (_this#0),0.5];
}];

🤪

  • Like 1

Share this post


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

Bah, that worked for hunter...

Try:

this addEventHandler ["Fired",{
 _this#0 setWeaponReloadingTime [gunner (_this#0),currentMuzzle gunner (_this#0),0.5];
}];

🤪

Yep . This finally works! Thank you!

  • Like 1

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

×