Variables and work with them (Переменные и работа с ними)

For info on the site, community and 'battlefieldy' things

Variables and work with them (Переменные и работа с ними)

Postby OldGoodMan » Sat Aug 10, 2013 8:25 pm

а. Where can I read about variables and work with them?
For example the variable Var - what it is and how to treat it? )
I feel that it will be very helpful to me.
b. Where can I get the absolute coordinates of the object (rotation x, y, z)?

а. Где мне можно прочитать про переменные и работу с ними?
Например переменная Var - что это и с чем её едят? )
Я чувствую что мне это очень поможет.
b. Где я могу получить абсолютные координаты объекта (rotation x, y, z)?
User avatar
OldGoodMan
 
Posts: 22
Joined: Thu Aug 30, 2012 6:40 am

Re: Variables and work with them (Переменные и работа с ними

Postby exe » Tue Aug 20, 2013 11:59 am

a. A good start is this site: http://www.velotech.net/battlefield/tutorials.php (Select "Using Conditional Statements" in the drop-down list)
Sadly the programming possibilities are very very limited in BF1942. The only way to start your code while playing is by pressing a certain key, see here

b. You can obtain this information with this code

Code: Select all
rem *** variables ***
var v_id
var v_Position_Vec

rem *** get the vehicle's ID which the player is currently using ***
player.vehicle -> v_id
rem *** activate that object ***
object.active v_id
rem *** get current position (vector) of this object ***
object.absolutePosition -> v_Position_Vec

But the problem is the command player.vehicle because it always returns the ID of the vehicle which is currently used by the player who joined last, I haven't found a way yet to call a specific player. If you only plan to code for Singleplayer it should work though.
exe
 
Posts: 60
Joined: Wed Feb 08, 2012 10:04 pm

Re: Variables and work with them (Переменные и работа с ними

Postby Classical Modder » Wed Mar 06, 2019 4:25 pm

exe wrote:a. A good start is this site: http://www.velotech.net/battlefield/tutorials.php (Select "Using Conditional Statements" in the drop-down list)
Sadly the programming possibilities are very very limited in BF1942. The only way to start your code while playing is by pressing a certain key, see here

b. You can obtain this information with this code

Code: Select all
rem *** variables ***
var v_id
var v_Position_Vec

rem *** get the vehicle's ID which the player is currently using ***
player.vehicle -> v_id
rem *** activate that object ***
object.active v_id
rem *** get current position (vector) of this object ***
object.absolutePosition -> v_Position_Vec

But the problem is the command player.vehicle because it always returns the ID of the vehicle which is currently used by the player who joined last, I haven't found a way yet to call a specific player. If you only plan to code for Singleplayer it should work though.


It has recently been found that the player.active command works in MP; however the command only accepts names with no spaces as arguments. My question is, In your code, the object.absolutePosition should return the position of the object where it spawns, and not where it currently is? Also, any way to get the position of a soldier on the field or does this code only works for PCOs? Don’t have a PC right now so I can’t test any code.
{SoH} Clan Leader // http://sohclan.forumotion.com/
See my Strasbourg map project here.
GSC: diamondback67
Steam: diamondback67
Classical Modder
 
Posts: 450
Joined: Mon Oct 01, 2012 3:13 pm
Location: Canada


Return to General discussion & notices

Who is online

Users browsing this forum: No registered users and 13 guests

cron