OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: dmakatra on 02 Oct 2003, 21:27:53
-
OK, hi all! Looks who's back with a new n00b Q again? Yup, me!
<advertising>
I asked this @ Gameers NPD 2 forums, but it's down at the moment
</advertising
WTF is wrong with this script? It's a primitive script that'll update so it'll get better later. It's for making a base more alive.
_unit = _this select 0
@ (stoner distance _unit <= 3)
_rand = random 4
? _rand <= 4 : ["Hi, what's up?", "PLAIN DOWN"]; goto "anim"
? _rand <= 3 : ["Yo! Something new Stoner?", "PLAIN DOWN"]; goto "anim"
? _rand <= 2 : ["Hey Stoner! Lend me a cigg would ya?", "PLAIN DOWN"]; goto "anim"
? _rand <= 1 : ["Hey Stoner, I think the captain wanted to talk to you, have you seen him?", "PLAIN DOWN"]; goto "anim"
#anim
? _rand <= 4 : _unit switchmove "foldonesarms"; goto "exit"
? _rand <= 3 : _unit switchmove "FXCivilLookaround1"; goto "exit"
? _rand <= 2 : _unit switchmove "FXCivilLookaround2"; goto "exit"
? _rand <= 1 : _unit switchmove "FXCivilArmsAkimboL"; goto "exit"
#exit
exit
That didn't work so I thought the distance command was screwing up, and I added this after the distance line:
hint "yo! wazzzzzzzzzzzzzzzzzzup!?"
Just to see if it worked, and it did. Looks like it's the random command is wrong, and I've used it like this a billion times... WTF is wrong?
:beat: *Gets Shot* :beat:
-
? _rand <= 4 : ["Hi, what's up?", "PLAIN DOWN"]; goto "anim"
The problem is that you can't have more than one command in a ?condition statement. You need to either use an if-then construct, or you need to break it up into two lines, as follows:
? _rand <= 4 : ["Hi, what's up?", "PLAIN DOWN"]
? _rand <= 4 : goto "anim"
And by the way, I find it funny that you use the word n00b :P
-
You're using ";" instead of ":" in your ": goto" bits.
-
OK Barron, so now it looks like this:
_unit = _this select 0
@ (stoner distance _unit <= 3)
_rand = random 4
? _rand <= 4 : ["Hi, what's up?", "PLAIN DOWN"]
? _rand <= 4 : goto "anim"
? _rand <= 3 : ["Yo! Something new Stoner?", "PLAIN DOWN"]
? _rand <= 3 : goto "anim"
? _rand <= 2 : ["Hey Stoner! Lend me a cigg would ya?", "PLAIN DOWN"]
? _rand <= 2 : goto "anim"
? _rand <= 1 : ["Hey Stoner, I think the captain wanted to talk to you, have you seen him?", "PLAIN DOWN"]
? _rand <= 1 : goto "anim"
#anim
? _rand <= 4 : _unit switchmove "foldonesarms"
? _rand <= 4 : goto "exit"
? _rand <= 3 : _unit switchmove "FXCivilLookaround1"
? _rand <= 3 : goto "exit"
? _rand <= 2 : _unit switchmove "FXCivilLookaround2"
? _rand <= 2 : goto "exit"
? _rand <= 1 : _unit switchmove "FXCivilArmsAkimboL"
? _rand <= 1 : goto "exit"
#exit
exit
Still ain't working :-\
-
Post the mission plz, and I'll try to debug.
-
Hell, you lotta guys can't see the forrest because of
so many trees there ;D
First off:
? _rand <= 4 : ["Hi, what's up?", "PLAIN DOWN"]
The condition <=4 right as first condition will always be
true because it's always <=4 ;)
And ["HI, what's up?","PLAIN DOWN"] without the
titleText/Cut won't do anything, and so it will
be with the following goto statement.
You "can" combine commands, using the ";" semicolon, but
in your case it's not working because of the missing titletext
in the first command.
btw - i would do the whole stuff in a different way, using
arrays and one random selector. ;)
~S~ CD
-
This is far too complicated to be located in the General Board ???
Or is it just me ;D ME aint got a bleeding clue about the _rand thingy migjig..
I aint going to get into it either unless i need to ;D
Chao
-
Nah, I think this is ok for the general board.
_rand is just a local variable that is defined at the start of the script. In this case it's a random number between 0 and 4.
-
DOH!!! How can I miss the titletext!?!?!
*Bangs himself in a table*
:beat: *Gets Shot* :beat:
-
There's still no animation... :-\
:beat: *Gets Shot* :beat:
EDIT: Nevermind... I figured it out now. Looks like some animations, even FXs, required that the soldier had a weapon in his hand, I had removeallweapons him.
Cheers!