Add points to player when entering region? [Solved]

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

Post Reply
User avatar
asleeponduty
Private First Class
Posts: 77
Joined: Tue Jul 22, 2008 3:05 pm
Games I'm Playing :: AaaaaAAaaaAAAaaAAAA
xbox live or psn: No gamertag set
Location: Illinois

Add points to player when entering region? [Solved]

Post by asleeponduty »

Hey I am trying to add points to a players score when they enter a region and I dont think what I have so far will work.
Heres my codepiece:

Code: Select all

		OnEnterRegion(
    function(regIn,character)
    ScriptCB_SetPlayerStatsPoints( Playerpoints )
	SetProperty("Playerpoints",  Playerpoints+5)
    end,
    "megapoints"
    )
Could someone knowledgeable explain how to do this correctly?
thanks! :]
Last edited by asleeponduty on Sat Mar 19, 2011 12:09 pm, edited 1 time in total.
CalvaryCptMike
Captain
Captain
Posts: 476
Joined: Sat Feb 19, 2011 3:10 pm
Projects :: Nothing--absolutely nothing
Location: Freed by alien robots, now living on Mars
Contact:

Re: Quick .LUA Scripting question

Post by CalvaryCptMike »

Hidden/Spoiler:
[quote="asleeponduty"]Hey I am trying to add points to a players score when they enter a region and I dont think what I have so far will work.
Heres my codepiece:
[code]
OnEnterRegion(
function(regIn,character)
ScriptCB_SetPlayerStatsPoints( Playerpoints )
SetProperty("Playerpoints", Playerpoints+5)
end,
"megapoints"
)
[/code]
Could someone knowledgeable explain how to do this correctly?
thanks! :][/quote]
I'm not a Lua expert and could be 100% wrong, but:

Shouldn't "megapoints" be in front of: "end,"? I imagine that ending the function then trying to do something isn't going to work. I don't know, correct me if I'm wrong.

Also: I think you have to create a custom ingame.lvl if you are going to use the "ScriptCB_" function. I could be wrong though... :?
User avatar
Firefang
Major
Major
Posts: 518
Joined: Mon Nov 15, 2010 8:55 pm
Location: California

Re: Quick .LUA Scripting question

Post by Firefang »

Everything is good. And to add points, you can put

Code: Select all

AddAssaultDestroyPoints(character)
User avatar
asleeponduty
Private First Class
Posts: 77
Joined: Tue Jul 22, 2008 3:05 pm
Games I'm Playing :: AaaaaAAaaaAAAaaAAAA
xbox live or psn: No gamertag set
Location: Illinois

Re: Quick .LUA Scripting question

Post by asleeponduty »

Ok, thanks!
Shouldn't "megapoints" be in front of: "end,"? I imagine that ending the function then trying to do something isn't going to work. I don't know, correct me if I'm wrong.
Megapoints is the name of the region you enter to get points

Problem solved

Revised code for those who are interested:

Code: Select all

      
OnEnterRegion(
    function(regIn,character)
  AddAssaultDestroyPoints(character)
    end,
    "megapoints"
    )
Note: "megapoints" is the region name
Post Reply