Well after some testing . 2 walking scripts and the casualty system are done.
Instructions : casualty system
1.Place a dynamic light somewhere on the level and set its main script to this
;Artificial Intelligence Script
;Header
desc = Global Casualties
;Triggers
:state=0:globalvar=Casualties
:state=0,vargreater=0:timerstart,plrfreeze=3000,state=1
:state=1:fpgcrawtextsize=24,fpgcrawtextfont=arial,fpgcrawtextr=200,fpgcrawtextg=200,fpgcrawtextb=200,fpgcrawtextx=50,fpgcrawtexty=50,fpgcrawtext=Civillian casualties not allowed! Mission failed
:state=1,timergreater=1000:plrsubhealth=9999,state=2
:state=2:setvar=0,state=0
;End of Script
It sets a global variable Casualties and stores the number of killed civillians and updates via their destroy scripts.then checks if you have killed an x number of them and "fails your mission"
The destroy script for the civillians (+ragdolls for 1.17) is this :
;Artificial Intelligence Script
;Header
desc = Activate ragdoll and leave as corpse + casualty increase
;Triggers
:state=0:state=1,suspend,coloff,ragdoll
:state=1:incvar=1
;End of Script
- Pretty simple.
Then come the patrolling scripts (or walking people)
Simple walking foreward and back :
;Artificial Intelligence Script
;Header
desc = Zombie Patrol
;Triggers
:state=0:timerstart,state=1
:state=1:movefore=1,animate=2
:state=1,timergreater=10000:state=2
:state=2:animate=1,freeze=1,rotatey=180,state=3
:state=3:freeze=0,movefore=1,animate=2
:state=3,timergreater=20000:state=4
:state=4:rotatey=180,state=0
;End of Script
You can change the time for each movement to suit your needs.
Then is a crossing script and waiting intended for 5 segment crossing , but can be changed easily.
;Artificial Intelligence Script
;Header
desc = Zombie Patrol
;Triggers
:state=0:timerstart,state=1
:state=1:movefore=1,animate=2
:state=1,timergreater=10000:state=2
:state=2:animate=1,freeze=1,rotatey=90,state=3
:state=3:freeze=0,movefore=1,animate=2
:state=3,timergreater=15000:state=4
:state=4:animate=1,freeze=1,rotatey=180,state=5
:state=5:freeze=0,movefore=1,animate=2
:state=5,timergreater=20000:state=6
:state=6:freeze=1,animate=1,rotatey=-90,state=7
:state=7,timergreater=35000:rotatey=90,freeze=0,movefore=1,animate=2
:state=7,timergreater=40000:state=8
:state=8:freeze=1,animate=1
;End of Script
The crossing script is not finished and has some bugs!
I'm also thinking of making some scared people.If the player has a drawn gun and is within x distance of them to start running in panic.But all of that later
--------------------------------- UPDATE --------------------------
First experiment with raycast.Entity Crosses a street , stops and turns around , stays on sidewalk (+lookout)
;Artificial Intelligence Script
;Header
desc = Cross Road , Turn around and Stop Automatic
;Triggers
:always,random=20:rotateheadrandom=65
:state=0:state=1
:state=1:movefore=1,animate=2
:state=1,raycastback=-50 0:state=2
:state=2:timerstart,freeze=1,rotatey=180,state=3
:state=3:freeze=0,movefore=1,animate=2
:state=3,timergreater=400:state=4
:state=4:freeze=1,animate=1
;End of Script