Player Exclusive Regions?

In this forum you will find and post information regarding the modding of Star Wars Battlefront 2. DO NOT POST MOD IDEAS/REQUESTS.

Moderator: Moderators

User avatar
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Player Exclusive Regions?

Post by General_Nate »

From the DMI:
RepSharpShooter wrote:As I start to model a starship, I thought, "Hey someone's probably going to steal my ship when I'm not around!" But I then realized that I could use the same security as I used in the jedi master unlocking procedure to keep them out.

Theres a region called rs_access. On enter region, it gets the profile name of the person. If it's not my profile name, it will kill the person/detonate a grenade with push = 9999. I could even do thing like poison them or something xD. Whatever would work online though. Now you may ask, "well how do we keep someone from stealing someone else's identity?" The answer is that getProfileName does not get the GameSpy ID of the user. It gets the regular profile name (which IS NOT displayed online if you have a GSID). This means one could use the profile name as a "password" which nobody would know.
How would one pull off such a move? Most of that is German to me... :roll:

Thanks very much for you help!
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Player Exclusive Regions?

Post by Fiodis »

That explanation is, actually, fairly clear. If you don't understand it I'd recommend learning more advanced LUA coding before you attempt it.
User avatar
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Re: Player Exclusive Regions?

Post by General_Nate »

Fiodis wrote:That explanation is, actually, fairly clear. If you don't understand it I'd recommend learning more advanced LUA coding before you attempt it.
Normally, I would take that and cherish it. But right now, I have a lot submission that has to get out before the end of the month. If it's clear to you, please enlighten me. :)

Here is all that I don't understand:
Theres a region called rs_access. Do I have to specify that in the LUA? how do I get an "rs_access" region? On enter region, it gets the profile name of the person. Is this the region that does this? Or the LUA command listed below? If it's not my profile name, it will kill the person/detonate a grenade with push = 9999. Is this automatic or do I have to put this in the lua myself? If I do, what is the command?I could even do thing like poison them or something xD. Whatever would work online though. Now you may ask, "well how do we keep someone from stealing someone else's identity?" The answer is that getProfileName<-- Is that what I have to put in the lua? does not get the GameSpy ID of the user. It gets the regular profile name (which IS NOT displayed online if you have a GSID). This means one could use the profile name as a "password" which nobody would know.
Please help! And thanks in advance.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Player Exclusive Regions?

Post by Fiodis »

In this case, you'll need a crash-course. Assuming you know what OnEnterRegion means (which I think you do), there's a v1.3 patch LUA command that enables you to grab the in-game name of a player. You do have to code for the grenade to go off, perhaps by spawning a self-destructing autoturret at a path point inside the region. I forget the exact wording of the function that gets the player's name, but it's in the v1.3 documentation.

CreateEntity to spawn the turret, btw.
User avatar
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Re: Player Exclusive Regions?

Post by General_Nate »

Ok, this is starting to make sense.
But:
Fiodis wrote:there's a v1.3 patch LUA command that enables you to grab the in-game name of a player.
What code command is that, or where do I look to find it?
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Player Exclusive Regions?

Post by Fiodis »

Fiodis wrote:I forget the exact wording of the function that gets the player's name, but it's in the v1.3 documentation.
:roll:
User avatar
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Re: Player Exclusive Regions?

Post by General_Nate »

:oops:

Ok, I've gotten it down to this:
Hidden/Spoiler:
OnEnterRegion(
function(regIn,character)
local name = getProfileName(character)
if name ~= "Genaral Nate" then
MoveEntityToNode(character,"gn_node3")
end
end,
"g_n_only"
)
ActivateRegion("g_n_only")
It doesn't work.

Am I missing anything? I have everything I need for the teleport BTW.
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Player Exclusive Regions?

Post by lucasfart »

General_Nate wrote: :oops:

Ok, I've gotten it down to this:
Hidden/Spoiler:
OnEnterRegion(
function(regIn,character)
local name = getProfileName(character)
if name ~= "Genaral Nate" then
MoveEntityToNode(character,"gn_node3")
end
end,
"g_n_only"
)
ActivateRegion("g_n_only")
It doesn't work.

Am I missing anything? I have everything I need for the teleport BTW.
on the second line you misspelt region? unless its meant to be regIn :)
also on the 4th line you added a symbol in front of the = and misspelt your own name (genaral) :funny2:
MercuryNoodles
Jedi
Jedi
Posts: 1003
Joined: Sun Mar 12, 2006 7:16 pm
Projects :: Space - Boarding Action
xbox live or psn: No gamertag set

Re: Player Exclusive Regions?

Post by MercuryNoodles »

His name's mispelled, yes, but it's actually his ingame name, so that's not a problem.
if name ~= "Genaral Nate" then
So, if someone has a name approximately equal to Genaral Nate, they get access to something? :lol:
User avatar
lucasfart
Sith
Sith
Posts: 1440
Joined: Tue Feb 24, 2009 5:32 am
Projects :: No Mod project currently.
Games I'm Playing :: I have not listed any games yet
xbox live or psn: No gamertag set
Location: Australia

Re: Player Exclusive Regions?

Post by lucasfart »

MercuryNoodles wrote:His name's mispelled, yes, but it's actually his ingame name, so that's not a problem.
if name ~= "Genaral Nate" then
So, if someone has a name approximately equal to Genaral Nate, they get access to something? :lol:
:funny2: didn't think of it that way......good one MercuryNoodles! :funny2:
User avatar
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Re: Player Exclusive Regions?

Post by General_Nate »

Yep. My ingame name is Genaral Nate. :lol:

I looked up "LUA not equal to symbol" and that (~=) is what I found. The munger didn't like "!=".

So: on enter region, if the person's name isn't mine, teleport them out of the lot.

What is the LUA symbol for "Not equal too"!?

Other than that, is the code correct?
Aman/Pinguin
Jedi
Jedi
Posts: 1104
Joined: Tue Jan 30, 2007 6:04 am
Projects :: Inactive
Location: Germany

Re: Player Exclusive Regions?

Post by Aman/Pinguin »

The code seems totally correct to me. I don't know how getProfileName() works so there might be something wrong, everything else seems correct though.
~= is correct, too.

Is there anything interesting in the error log?
User avatar
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Re: Player Exclusive Regions?

Post by General_Nate »

Funny you say that:
The Error Log wrote:Message Severity: 3
.\Source\LuaHelper.cpp(312)
CallProc failed: (none):0: attempt to call global `getProfileName' (a nil value)
stack traceback:
(none): in function <(none):32>
I think it speaks for it's self.

Does anyone know the correct command for getting the name of a player?
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Player Exclusive Regions?

Post by Fiodis »

Fiodis wrote:
Fiodis wrote:I forget the exact wording of the function that gets the player's name, but it's in the v1.3 documentation.
Hint:
LucasArts\Star Wars Battlefront II\GameData\addon\AAA-v1.3patch\docs\howtos

Hint 2: Using Ingame Player Data.txt

Hint 3: uf_processPlayers()
User avatar
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Re: Player Exclusive Regions?

Post by General_Nate »

Fiodis wrote:
Fiodis wrote:
Fiodis wrote:I forget the exact wording of the function that gets the player's name, but it's in the v1.3 documentation.
Hint:
LucasArts\Star Wars Battlefront II\GameData\addon\AAA-v1.3patch\docs\howtos

Hint 2: Using Ingame Player Data.txt

Hint 3: uf_processPlayers()
:?

Ok, Well, I have it down to this:
ActivateRegion("g_n_only")
OnEnterRegion(
function(regIn,character)
local name = uf_processPlayers(character)
if name ~= "Genaral Nate" then
print("OnEnterRegion():",name)
MoveEntityToNode(character,"gn_node3")
end
end,
"g_n_only"
)
The only bad part it that it teleports me even if my name is "Genaral Nate" And it pops up with this jewel:
Image

... Ummmm, I think I'm on the right track though.
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Player Exclusive Regions?

Post by Fiodis »

You are, but did you even look at the doc I pointed you to? I won't bother posting it, as it is somewhat lengthy. But look at it yourself, and the example code there.
User avatar
[TFA]Padawan_Fighter
High General
High General
Posts: 806
Joined: Wed Mar 25, 2009 3:37 pm
Projects :: Ha - as if I will ever get back to them
Games I'm Playing :: SWBF2 ARK EliteDngrs
xbox live or psn: No gamertag set
Location: Lost at sea

Re: Player Exclusive Regions?

Post by [TFA]Padawan_Fighter »

Fiodis wrote: Image

O.o

What are those things on the right? :shock:
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Player Exclusive Regions?

Post by Fiodis »

Hex code? Idk, really.

When did I write that? :wink:
User avatar
General_Nate
Lieutenant General
Lieutenant General
Posts: 689
Joined: Sun Jun 28, 2009 4:01 pm
Projects :: None because BFII is not working
Games I'm Playing :: Minecraft
xbox live or psn: No gamertag set
Location: 127.0.0.1

Re: Player Exclusive Regions?

Post by General_Nate »

The Tut wrote:exampleTable = {
{ indexstr = "1", namestr = "Alpha"},
{ indexstr = "3", namestr = "Bravo"},
{ indexstr = "2", namestr = "Player 1"},
{ indexstr = "4", namestr = "LastJoinedPlayer"},
}

Am I suppose-to add this for every person on BFII!? Or does it do it automatically?
User avatar
Fiodis
Master of the Force
Master of the Force
Posts: 4145
Joined: Wed Nov 12, 2008 9:27 pm
Projects :: Rannoch + Tientia + Tools Programming

Re: Player Exclusive Regions?

Post by Fiodis »

I think the whole point of it is to get their names off the player list.
Post Reply