OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: dalton on 11 Jun 2004, 03:11:58

Title: spawning smoke grenades?
Post by: dalton on 11 Jun 2004, 03:11:58
how do i spawn a smoke grenade? preferably red?
Title: Re:spawning smoke grenades?
Post by: nEO iNC on 11 Jun 2004, 10:10:04
Hey dalton, you can do the following... Not sure if it's what you want tho...

"smokeshellred" camcreate (getpos 'smoke')

where 'smoke' = gamelogic/unit or vehicle name where you want the smoke to be... (no quotes)

or

"smokeshellred" camcreate (getpos (object '12345'))

where '12345' = objectid of an object in the mission editor (no quotes)

Just put either of the above in a trigger/unit init string etc... You may neeed to check that 'smokeshellred' is correct, think it is...
Title: Re:spawning smoke grenades?
Post by: dalton on 12 Jun 2004, 00:52:57
it dont work...
it says "type object, expect nothing"
Title: Re:spawning smoke grenades?
Post by: Gnat on 12 Jun 2004, 07:07:25
More information ! ........... what exactly did you type in?
Title: Re:spawning smoke grenades?
Post by: j-man on 12 Jun 2004, 08:12:39
You need to use the following code:

_smoke = "smokeshellred" camcreate (getpos gamelogic)

If your putting this into a script, then keep the underscore at the begining. If your putting this somewhere else (trigger, init field), take away the underscore.

This code has been tested, and it works.
Title: Re:spawning smoke grenades?
Post by: macguba on 12 Jun 2004, 11:36:58
If you get an error message, you should always quote the whole message.   Plus of course the whole of the code that you used.     ;)    "It don't work"  ::) is one of the commonest lines used in this forum, and is unquestionably the most unhelpful.  :P

Also, you should always check the syntax of a command in the comref before using it.    And you should always[/i] check it again before posting.   If I may quote a Comment on camCreate in the online comref:

Quote
You can use camCreate to create objects.  For example:

flare1 = "flare" camCreate getpos gameLogic_1

Which, combined with  nEO iNC's almost excellent post above, solves your problem.    Answers in the forum are almost always fundamentally correct, but it is fairly common for there to be a minor error of syntax.  (It happens to me all the time.  :'()

In this case of course you've been lucky because j-man has kindly spotted the problem.