OFPEC Forum
Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting Multiplayer => Topic started by: NightJay0044 on 04 Sep 2008, 21:01:29
-
Hi all this script didn't work for me. The error it gave me was "error invalid number in expression".
Here is my script with the code as you can see very simple probably but basically it's acting like a trigger saying if the E1 soldier is dead then a hint will pop up saying that.
; A script that will say E1 is dead when you have killed him.
_a = alive E1;
if(!_a) then
{
hint "The enemy is dead!";
}
exit
So I'm not sure how to fix it thank you.
-
I don't really know how to use the event handlers, but it looks to me as though you assign _a the value true and then use it in a check. Essesntially your checking "if not false", which doesn't make any sense. Can't you just put this in:
if(!alive E1) thenI'm not sure if it'll work though, and the syntax may be wrong, I'm not sure about this but it's a suggestion.
:)
-
Yeah this doesn't work either. It still gives me the same error message. Basically I'm trying to have a west soldier eliminate an east soldier and having this script say "hint" The Enemy is dead!. In game all I have is one west soldier and one east soldier.
Well basically I was just trying to figure out how to use the command ! a
I dont' know what it means or how to use it or how many different ways to use it.
See where scripting is simpler for me is when you can use commands such as
this addeaponcargo "Ak47",1]; etc......
But when it comes to using the commands such as;
<, !, a, _a...etc..
It's harder for me because I can't always see how it relates to soldiers in the mission editor and stuff.
thanks.
-
hi,
i was never able to make a structured syntax working in .sqs code like this:
if (condition) then
{
doSomething;
}
You have to write your command in one line:
_a=alive E1
if (!_a) then {hint "This guy is dead"}
:cool2:
-
Why do you have to use a one line command?
-
I think it is because a .sqs script gets interpreted line by line. The interpreter wants to find a complete working syntax in one line, and not only a fragment of it. If you write a .sqf function, you can have the structured syntax.
:)
#EDIT: Removed the unnecessary quote; no need to quote the whole previous post you're replying to.. h-