I am attempting to use a region to give an info popup but for some reason its not working. The first argument is invalid even though I copied it direcly from a shipped script. Could someone look over this bit of code for the mistake I made? I'm rather lost.
Hidden/Spoiler:
ActivateRegion("Info2")
infopopup2 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(character) then
ShowObjectiveTextPopup("level.TCR.objectives.info.2")
SetProperty("cp6", "Team", 1)
end
end,
"Info2"
)
Here is Mav's example script just for comparison
Hidden/Spoiler:
ActivateRegion("regionname")
testfunction = OnEnterRegion(
function(region, player)
if [whatever callbacks you want] then
whatvever you want to happen
end
end,
"regionname"
)
you can only use the paramaters the function returns. your callback uses "character" as parameter but you never assigned anything to that variable. the function onneterregion returns the unit in the variable "player". therefore you should either let the function return "character" or use "player" as parameter for the ischaracterhuman callback.