Page 1 of 1
Help with OnEnterRegion script
Posted: Wed Aug 10, 2011 2:46 pm
by wishihadaname
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.
Here is Mav's example script just for comparison
Re: Help with OnEnterRegion script
Posted: Wed Aug 10, 2011 2:54 pm
by DarthD.U.C.K.
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.
Re: Help with OnEnterRegion script
Posted: Wed Aug 10, 2011 3:43 pm
by wishihadaname
thanks for the help, got it to work.
Re: Help with OnEnterRegion script
Posted: Wed Aug 10, 2011 4:01 pm
by CalvaryCptMike
I've been having the same problem, could you please specify what exactly it would look like?
ActivateRegion("Info2")
infopopup2 = OnEnterRegion(
function(region, player)
if IsCharacterHuman(player) then
ShowObjectiveTextPopup("level.TCR.objectives.info.2")
SetProperty("cp6", "Team", 1)
end
end,
"Info2"
)
Would that be it?

Re: Help with OnEnterRegion script
Posted: Wed Aug 10, 2011 4:03 pm
by DarthD.U.C.K.
yes, thats how it must look like, like i said.
Re: Help with OnEnterRegion script
Posted: Thu Aug 11, 2011 1:23 am
by CalvaryCptMike
Okay, thx I get it now!