Page 1 of 1
Add points to player when entering region? [Solved]
Posted: Fri Mar 18, 2011 4:58 pm
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! :]
Re: Quick .LUA Scripting question
Posted: Fri Mar 18, 2011 5:04 pm
by CalvaryCptMike
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...

Re: Quick .LUA Scripting question
Posted: Fri Mar 18, 2011 7:42 pm
by Firefang
Everything is good. And to add points, you can put
Code: Select all
AddAssaultDestroyPoints(character)
Re: Quick .LUA Scripting question
Posted: Sat Mar 19, 2011 12:09 pm
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