OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: FiLL2d on 10 Sep 2005, 10:57:46

Title: can a script be executed with an object number instead of its name?
Post by: FiLL2d on 10 Sep 2005, 10:57:46
can a script be executed with an object number instead of its name?

or did they stop this in 1.85 due to setpos cheating?
Title: Re:can a script be executed with an object number instead of its name?
Post by: bedges on 10 Sep 2005, 11:31:07
no idea, but scripts can be called with anything in the execution array field -

Code: [Select]
[12345] exec "script.sqs"
then in the script _this select 0 points at '12345' which can be used as an object id...
Title: Re:can a script be executed with an object number instead of its name?
Post by: Baddo on 10 Sep 2005, 12:39:28
Or alternatively, if you have only one argument to pass to the script:

Code: [Select]
12345 exec "script.sqs"
Then in the script _this will point at '12345'.

...but I bet this wasn't what you needed to know. Could you clarify your question a bit?
Title: Re:can a script be executed with an object number instead of its name?
Post by: Kyle Sarnik on 10 Sep 2005, 14:38:04
can a script be executed with an object number instead of its name?

or did they stop this in 1.85 due to setpos cheating?

Are you reffering to objects on the island? If so, you simply use object ID#. If you are talking about the ID of objects placed in the editor, then no, not if you type them in yourself, you have to "get" them first be assigning them to a variable, which really is what you are doing when you give objects names. So if that is your question then no.
Title: Re:can a script be executed with an object number instead of its name?
Post by: FiLL2d on 10 Sep 2005, 14:53:23
yes like 12345 exec "addon\script.sqs"
instead of unit exec "addon\script.sqs"
Title: Re:can a script be executed with an object number instead of its name?
Post by: Kyle Sarnik on 10 Sep 2005, 15:17:08
First I must ask... why? And second, no, because like I explained, units don't have a simple ID number that will work if you type somewhere, no, it works like setpos and getpos. If you want to setpos something, you first need to getpos the position (ignore the fact that you can use an array). So the only way to get a units ID is to assign it to a variable (for example, Soldier1 = this) which is the exact same thing as giving it a name.
Title: Re:can a script be executed with an object number instead of its name?
Post by: Planck on 10 Sep 2005, 15:26:54
I suspect FiLL2d is referring to .wrp placed objects, in which case you would need to use (object xxxx).

However .wrp placed objects cannot be setpos'ed anywhere AFAIK, all you can do is destroy them.


Planck
Title: Re:can a script be executed with an object number instead of its name?
Post by: Kyle Sarnik on 10 Sep 2005, 16:11:10
I suspect FiLL2d is referring to .wrp placed objects, in which case you would need to use (object xxxx).

However .wrp placed objects cannot be setpos'ed anywhere AFAIK, all you can do is destroy them.


Planck

I know that, I was refering to editor placed objects, cause I thought he was. I just thought FiLL2d doesn't know that units don't actualy have ID's. Well I don't know, FiLL2d could you be more specific? What exactly do you mean?