Help with script!
Hello everyone,
I'm doing a script in which a hero is in a prison and he has to pay to get out. So when he steps on region prison, it calls the function prison_escape to asks him if he pays or not, and if he does, he gets teleported.
Problem is the script doesnt work. In the console, it says "empty message text!". I don't understand why because my message texts are not empty. I checked the path and it seems fine. I suspect some little detail hidden somewhere that escapes me...
Here's the function :
--Prison
function prison_escape(heroname)
herolevel= GetHeroLevel(heroname);
GoldBribe = herolevel*100;
CurrentGold = GetPlayerResource(1, 6);
GoldEnd = CurrentGold - GoldBribe;
if GetPlayerResource(1, 6) >= GoldBribe*100 then
QuestionBox("Maps/SingleMissions/Xentar/prisonquestion.txt", "onOK", "onCancel");
else MessageBox("Maps/SingleMissions/Xentar/notenoughmoney.txt");
end;
end;
function onOK()
MessageBox("Maps/SingleMissions/Xentar/prisonpay.txt");
SetPlayerResource(1, 6, GoldEnd);
SetObjectPosition("heroname",42,122,0);
end;
function onCancel()
MessageBox("Maps/SingleMissions/Xentar/notenoughmoney.txt");
end;
And here's the trigger :
Trigger(REGION_ENTER_AND_STOP_TRIGGER,"Prison","prison_escape");
|