Page 3 of 3

Re: player.vehicleHp only works in multiplayer?

Posted: Tue May 18, 2021 6:07 pm
by Skull Kid
I am myself kind of stumped that the server executable (BF1942_w32ded.exe) doesn't ever accept even remote admin commands to spawn vehicles with the likes of "game.spawnobject" and "object.create. But I'll look into that another time!

I know you can use the "player.active" command with your name afterwards, but only if it has a underscore instead of spaces in it. I tried it and it seems to work just fine :)

EDIT: I successfully made it possible to spawn vehicles on a dedicated server. So far, only the game.spawnobjectat works, not game.spawnobject.

Re: player.vehicleHp only works in multiplayer?

Posted: Thu May 20, 2021 4:42 pm
by Diamondback
What I want to do is ''activate'' players on an Internet server with player.active, but without the players having to individually activate themselves to do so. In other words, I'd like to fetch the player name set in GeneralOptions.con in the Settings folder under the game.setPlayerName command by storing it in a variable. So far, my efforts have been unsuccessful. Here is an example of what I want to do:

console.useRelativePaths 0
include mods/BF1942/Settings/GeneralOptions.con
console.useRelativePaths 1

var v_active
game.setPlayerName v_active

The argument of game.setPlayerName is the player name you set in the game menu, between quotation marks ('' ''). However, that argument isn't stored in my variable, so it doesn't work.

Re: player.vehicleHp only works in multiplayer?

Posted: Thu May 20, 2021 4:46 pm
by Skull Kid
I can imagine that's not an easy thing to do. As for myself, that's probably way over my head of know-how, sadly... All I can say is Good Luck with that. I hope you solve it in the end :D

EDIT: If somebody else is able to help out, please do not hesitate to reply here!

Re: player.vehicleHp only works in multiplayer?

Posted: Thu May 20, 2021 4:53 pm
by Diamondback
I'm fairly sure it can't be done without patching the EXE somehow. For now, players will have to activate themselves with a console command.

Re: player.vehicleHp only works in multiplayer?

Posted: Thu May 20, 2021 4:56 pm
by Skull Kid
Hang on. What you want is to make a player active with the push of a key? I think that's possible... Although I'm not sure if that's what you meant. But I have made a couple of command binds to a few keys.

EDIT: I saw your other post here somewhere about this. This may be well possible.

Re: player.vehicleHp only works in multiplayer?

Posted: Thu May 20, 2021 5:33 pm
by Diamondback
What I'm trying to do is activate my own player with player.active. I read around on the forums and it was mentioned that the issue with player.active was that in an Internet server, it activates the latest player to join or connect to the server, not your own player. The only way to activate your player is to use your own nickname as the argument to player.active, assuming it doesn't have any spaces like you mentionned.

I however, want to find an automatic way to activate myself without having to enter the name of my character each time. Instead, I want to store my player nick name in a variable, using already set commands in the Settings CON files. The variable would be the argument to player.active, not my actual player nick. That way I can change my player name as much as I want in the game menu, and whatever my name is set to there it is stored in the variable which is the argument to player.active.

Re: player.vehicleHp only works in multiplayer?

Posted: Thu May 20, 2021 5:37 pm
by Skull Kid
Ah, I get it. I will take a look into it. It might require a bit more scripting. I will see what's possible with my knowledge.

Re: player.vehicleHp only works in multiplayer?

Posted: Thu May 20, 2021 5:42 pm
by Diamondback
The first thing I did was to look at game files which deal with setting or changing your player nickname.

In GeneralOptions.con, you have the command game.setPlayerName ''your_nick''. So I thought that I could replace the argument of that command with a variable in a custom CON file I made, which I would then use as an argument for player.active.

But this hasn't worked, I have no idea why. Perhaps because the output cannot be assigned to a variable, unlike some other commands. However, the command game.changePlayerName returns a string, and that string can certainly be assigned to a variable. But the goal is to use already existing commands in the Settings CON files, not add new ones.

Re: player.vehicleHp only works in multiplayer?

Posted: Thu May 20, 2021 6:05 pm
by Skull Kid
I am quite overwhelmed with how difficult this simple thing was... but now I'm kind of obsessed with solving it.

EDIT: Anyone with more knowledge is welcome to reply here.