OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: headshot_snipe on 08 Apr 2003, 18:01:04
-
when i want a guy with his hands on his head i usually use triggers, but it takes ages so i "tryed" to make a script, but since my scripting skills are not very good the thing i made doesn't work.
1. I was trying to make a script so that when i type in the name or names of the units they all put their hands behind their heads and in case they die the animation "effectstandsurdead" comes up. here is my script:
guy = this select 0
guy setbehaviour"SAFE"
guy switchmove"effectstandsur"
#loop
?not(alive guy) = guy switchmove"effectstandsurdead"
goto"loop"
exit
Is their smth wrong in there? why doesn't it work?
2. in some scripts i found on the net they have the following line: [whatever,whatever] exec "whatever.sqs" to activate the script.
how do you use those []?
thanks in advance
-
This is how you should do:
_guy = _this select 0
_guy setbehaviour"SAFE"
_guy switchmove"effectstandsur"
@not(alive guy) : _guy switchmove"effectstandsurdead"
exit
2. [] is the cant-remember-the-name-cause-I-suck-on-names. Anyway, you see this in your script?
_guy = this select 0
Right? Well, IÂ'll make an example for this script.
[TheGuyYouWantToPutHisHandsBehindHisHeadName] exec "HandBehind.sqs"
Do you understand? _guy = this select 0 means that the user can put in sumthin in the [].
Man, I gotta start learning names :).
-
thanks very much for the reply. just one other question:
what does the underscore do before the "guy" and the "this", cant you just write it as guy = this select 0?
-
the underscore refers to local variables that work within the cript. if you've named the guy as guy in the editor then it may work but the _this refers to the script that was called. if you use it without the underscore it won't know which "this" you're refering to
-
I recommed you read Gustavssons script tute. Real swedish quality :).
-
Er.... i tried the script and it doesn't work, it displays a error message:
' not(alive _guy) [ # ] : _guy switchmove"effectstandsurdead" ': error unknown operator
i dont get it... do you have any idea whats wrong?
-
do not worry, i found it out (after reading Johan Gustafsson's tute) the script should have looked like this:
_guy = _this select 0
~5
_guy switchmove"FXstandsur"
#update
? not(alive _guy) : goto"dead"
goto"update"
#dead
_guy switchmove"FXstandsurdead"
exit
thanks for your replies anyway.