OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: Killzone on 06 Dec 2004, 17:00:29

Title: confused
Post by: Killzone on 06 Dec 2004, 17:00:29
Hi

I am using the new animations by flashpointgamer. I am trying to use an addeventhandler to call a script once the unit is either fired upon or hit. I have tried:

loon AddEventHandler ["fired", this exec "null.sqs"]
and
loon AddEventHandler ["hit", this exec "null.sqs"]

The script it is calling is a simple:

loon switchMove "null"

The problem I am having is the script activates right away when nothing has happened. I dont even have enemies on the map yet.
What am I doing wrong?

thanks again :)

Title: Re:confused
Post by: ACF on 06 Dec 2004, 17:40:57
You will get a problem with the Fired EH as that will activate when the unit fires, not when it's fired upon.  But if you haven't got any enemies on the map it can't be that causing the immediate problem.

The script command in the EH also wants to be in {}

There are other issues with the syntax of the _this function in the script which need checking, but I'm being chucked out of the office imminently . . .
Title: Re:confused
Post by: macguba on 06 Dec 2004, 20:54:30
Check the syntax in the comref.    I think there are some Comments on the online version which you might find helpful.

If the script is being called without the unit firing or being hit, then it is probably being called from somewhere else.    Check for forgotten test units and triggers.

"null" is a term used by the game engine so I wouldn't recommend using it for anything else, including a script name.   It shouldn't be a problem, but this is OFP ...