Jump to content
Sign in to follow this  
BronzeEagle

Two old ofp scripts, hunterkiller and vehiclecam

Recommended Posts

this is vehiclecam.sqs, keep in mind all the information from here goes into vehiclecam.sqs and the syntax can go in either an init.sqs file for intros or a trigger, check the syntax part:

; concept by Turok_GMT, modified by snYpir,modified by [F-L]Sneaker 01.10.01 V3.0

; Sneaker added BLACK IN and BLACK OUT at the end of the script

; Sneaker added alive test of _unit in case of midair collision or enemy attack

; Sneaker added time limitation in seconds to prevent endless loop within game

; Sneaker doubled refresh rate of the camCommit command, to prevent lags at fast movements

; syntax:

; [<name of vehicle>, <name of unit to target>, <[xoffset,yoffset,zoffset]>,<relative to vehicle?>,<time limitation>] exec "vehiclecamV3.sqs"

; example: [heli, dilbert,[0,0,-10],false,300] exec "vehiclecam.sqs"

; get camera vehicle and target

_unit = _this select 0

_target = _this select 1

_timelimit = _this select 4

; define relative time at start of this script

_initialtime=daytime

; you can change the positional offsets for the camera (these are relative to the vehicle)

_camoffsetX = (_this select 2) select 0

_camoffsetY = (_this select 2) select 1

_camoffsetZ = (_this select 2) select 2

; do u want your offsets to be relative to the vehicle?

_camrelative = _this select 3

; clear the variable that will stop this script

vehiclecamstop = false

; create a camera

_cam = "camera" camcreate [0,0,0]

_cam cameraeffect ["internal", "back"]

#loop

; get actual time and calculate the time difference to _initialtime in seconds

_actualtime=daytime

_runtime=(_actualtime-_initialtime)*3600

; now create a loop to continuously update the cam's pos, so it appears to be attached to the vehicle

_newpos = getpos _unit

; set posn not relative to vehicle?

? NOT(_camrelative) : _cam camsetpos [(_newpos select 0) + _camoffsetX, (_newpos select 1) + _camoffsetY, (_newpos select 2) + _camoffsetZ]; goto "commit"

; set posn relative to vehicle

_cam camsettarget _unit

_cam camsetrelpos [_camoffsetX,_camoffsetY,_camoffsetZ]

#commit

; aim camera at target

_cam camcommit 0

_cam camsettarget _target

_cam camcommit 0

; insert a small update time to avoid anychance of any nasty infinity loop errors

~0.005

; perform an if test to see if _stop has been set to true or _uint has been killed: if not, do another lap of the loop

? (NOT(vehiclecamstop) AND (alive _unit) AND (_runtime<_timelimit)): goto "loop"

; the loop ends here when vehiclecamstop gets set to true by either a trigger or a waypoint's "on activation" field once loop had ended, kill the camera and return control to player

TitleCut ["","BLACK OUT",2]

vehiclecamstop = true

~2

_cam cameraeffect ["terminate", "back"]

camdestroy _cam

TitleCut ["","BLACK IN",2]

exit

and hunterkiller.sqs:

;made by Baron Hurlothrumbo IIX

; if you want to have an AI unit (tank, infantry, whatever) hunt down

;and kill whoever set off a trigger, then set up the trigger so that the

;unit you want hunted will set it off. Then in the on activation line put

;the line below, using <thislist select 0> for the unit to be hunted down.

;syntax

;[<name of unit to hunt down other unit>, <name of unit to be hunted down>] exec "hunterkiller.sqs"

;example

; [aTank, thislist select 0] exec "hunterkiller.sqs"

_Killer =_this select 0

_KG = group _killer

_hunted = _this select 1

_KG SetCombatmode "RED"

_KG SetBehaviour "COMBAT"

_KG SetSpeedMode "FULL"

#loop

"_x domove (getpos _hunted)" foreach units _kg

"_x doTarget _hunted" foreach units _KG

~60

;waits 60 seconds before updating- change time if you want but bear

;in mind if it updates too fast AI will be swamped with move commands

?alive _hunted: goto "loop"

;checks if the target is alive, if so goes looking for him, if not exits script.

exit

Share this post


Link to post
Share on other sites

Well, they seem like pretty basic scripts, nothing special. And I can recall similiar scripts already existing for years, but I guess these could be useful for beginner mission editors.

Share this post


Link to post
Share on other sites

its definitely useful for me because i can't script cutscenes for the life of me, and hunter killer is just great to have for an aggressive enemy. defnitely a must have for as you say beginners or more novice editors like me.

Share this post


Link to post
Share on other sites

The comments on top of the scripts explain pretty well how they are used. There are even example calls included.

Please stop spamming the forums with your rather pointless comments and questions.

Share this post


Link to post
Share on other sites
I find both these intresting,how can i make use of both these script.

check for the area that says syntax for how to apply the scripts. the vehiclecam script attaches a camera to a vehicle and focuses its aim on any object, for cutscenes, and the hunterkiller script allows any ai units to go after and kill any particular unit(s) you tell it to.

Edited by BronzeEagle

Share this post


Link to post
Share on other sites

I suck at editing and I need a better explenation to hunterkiller thing, because I didnt understand what do I write to SQS and what to tigger??

So do I have to do a sqs file and what do I have to write there? What about editor, what do I write in the activation field of the tigger? And what means thislist select?

Share this post


Link to post
Share on other sites
I suck at editing and I need a better explenation to hunterkiller thing, because I didnt understand what do I write to SQS and what to tigger??

So do I have to do a sqs file and what do I have to write there? What about editor, what do I write in the activation field of the tigger? And what means thislist select?

Go to ofpec.com(www.ofpec.com) and find Johnatan Gusthavson scripting tutorial .There will be explanations on how to use scripts.

Share this post


Link to post
Share on other sites

Well first off - as a noob scripter - understand that the trigger will help you launch your script.

Trigger has a condition field - this will set off your trigger if true or condition is met.

As far as scripting goes...

in Activation field of trigger type:

[aTank, thislist select 0] exec "hunterkiller.sqs"

aTank = name of Vehicle

thislist = a Triggers name - which has been setup to encompass any number of units.

-or-

thislist = could possibly point to an Array. thislist = [player,bTank,cTank]

select 0 = means select 1st entry in array --> player

select 1 = means select 2nd entry in array --> bTank

select 2 = means select 3rd entry in array --> cTank

Remember An Array - starts it's count at 0 - not 1

It's very important to understand this...

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×