5
« on: March 04, 2016, 10:56:23 AM »
Trying to put together some basic missions for a research study I'm helping with. The current intent is to simply spawn two peds, have one start attacking the other, and have the player intervene to protect the one being bullied. I'd also like a text message to come up when the bully is beaten up.
I've gotten everything working except that last part. When the player intervenes and beats up the bully... nothing happens. No text or anything. What am I missing?
ImportScript("\\Library\\LibTable.lua") -- imports the LibTable library
ImportScript("\\Library\\LibPed.lua") -- imports the LibPed library
local l_0_0 = false
MissionSetup = function() -- basic mission setup function which is used in almost all bully scripts
local l_1_0 = 270 -- X coords
local l_1_1 = -110 -- Y coords
local l_1_2 = 6.4000000953674 -- Z coords
local Algernon = Nil -- Initialize bullied char
local Damon = Nil -- Initialize bully
DisablePunishmentSystem(true) -- Necessary to keep the prefects from interfering
PlayerSetHealth(200) -- gives the player 200 health
AreaTransitionXYZ(0, l_1_0, l_1_1, l_1_2) -- Moves player to outside boys' dorm
TextPrintString("Algernon is one of the geeks at school. He needs protection from Damon, the jock who has been bullying him.", 4, 1) -- Posts red text on screen
Algernon = PedCreateXYZ(4,265,-110,6.4000000953674) -- Spawn bully target
Damon = PedCreateXYZ(12,262,-110,6.4000000953674) -- Spawn bully
PedRecruitAlly(Algernon,gplayer) -- Second character assigned to bodyguard first
PedAttack(Damon, Algernon, 1) -- Bully attacks target
PedShowHealthBar(Algernon, true, "N_Algernon", true) -- Display Algernon's health bar
end
MissionCleanup = function()
end -- end statement
F_MissionCheck = function()
if PedIsDead(Damon) then
TextPrintString("Congratulations! Algernon is safe for now thanks to your intervention.") -- This is where I need help, this text never appears
end
end
main = function() -- Main mission function
repeat
F_MissionCheck()
Wait(2000)
until not Alive
end