You really should check my mission scripting tutorial.
So basically you do this,
To tell you a few things make sure to follow my scripting tutorial entirely. The argument with if is always used to ask the game wether something is valid or not.
Anything can be used for checking
if DuckisGoose = false and DuckisFound = false and PedIsValid(Goose) then
--Duck Found
end
With false the argument is always set to true if your trying to run something once. Running false multiple times like this
function CallPreppiesToHelp()
PreppiesHelp = false
end
function CallPreppiesToHelp()
PreppiesHelp = false
PedAddPedToIgnoreList(Preppy1)
end
function CallPreppiesToHelp2()
PreppiesHelp = true
PedAttack(Preppy1)
PreppiesHelp = false
end
function MissionSetup()
AreaTransitionXYZ(0, 270, -110, 6.4000000953674)
DisablePunishmentSystem(true)
AreaDisableAllPatrolPaths()
DisablePunishmentSystem(false)
Algernon = PedCreateXYZ(4,265,-110,6.4000000953674) -- Spawn bully target
Damon = PedCreateXYZ(12,262,-110,6.4000000953674) --Spawn bully
SpawnCallToBully()
end
function SpawnCallToBully()
local x,y = 4,256
local r1 = x + 1.5
local r2 = y + 1.5
local r3 = x - 1.5
local r4 = y - 1.5
repeat
Wait(0)
until PedInRectangle(gPlayer,r1,r2,r3,r4)
Wait(1500)
TextPrintString("Algernon is one of the geeks at school. He needs protection from Damon, the jock who has been bullying him.", 4, 1)
Wait(4000)
PedRecruitAlly(Algernon,gPlayer)
PedShowHealthBar(Algernon, true, "N_Algernon", true)
PedAttack(Damon, Algernon, 1)
IsBully = false
end
function BullyDefeated()
if PedIsDead(Damon) and IsBully = false then
IsBully = true
TextPrintString("Congratulations! Algernon is safe for now thanks to your intervention.",4,1)
Wait(6000)
MissionSucceed(true, false, false)
CameraSetWidescreen(true)
Wait(4000)
CameraFade(500, 0)
Wait(500)
CameraAllowChange(true)
SoundSetAudioFocusPlayer()
CameraReturnToPlayer()
CameraReset()
CameraSetWidescreen(false)
PlayerSetHealth(800)
end
main = function()
repeat
BullyDefeated()
Wait(0)
until not Alive
end