OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: AnarCHy on 26 Jul 2004, 11:48:24

Title: camCreate LaserGuidedBomb
Post by: AnarCHy on 26 Jul 2004, 11:48:24
Hello.

I need help wit some code problems I have in a mission I am making.

I used a small part of script i found in the topic "Blowing Stuff Up!", from DBR_ONIX:
Quote
explo01 = "LaserGuidedBomb" camcreate [getpos crate select 0, getpos crate select 1, getpos crate select 2]

In this case, I have a trigger that goes off when "crates" gets destroyed.

But, whenever it calls for the code, I get an error message:
Quote
explo01 = "LaserGuidedBomb" camcreate [getpos crate select 0, getpos crate select 1, getpos crate select 2]; Error type Any, expected Number

Could someone tell me what is wrong here please?

thanks,
AnarCHy
Title: Re:camCreate LaserGuidedBomb
Post by: CopyrightPhilly on 26 Jul 2004, 11:52:27
if thats all one line then

Code: [Select]
explo01 = "LaserGuidedBomb"; camcreate [getpos crate select 0, getpos crate select 1, getpos crate select 2]
other wise look for where the # is in the error message and where ever that will be where the error is.

hope this helps

cheers, Philly
Title: Re:camCreate LaserGuidedBomb
Post by: AnarCHy on 26 Jul 2004, 11:59:42
Right after all of the code, after the last bracket is closed (])

That is where the problem is, but wtf?
Nevah used camCreate before...
Title: Re:camCreate LaserGuidedBomb
Post by: macguba on 26 Jul 2004, 12:10:46
When you quote an error message always include the #.    Arguably its the most important bit.

In this case you talk about crates in your post but the code uses crate.    Also you seem to be trying to create something at the position of an object which doesn't exist because it's been destroyed.    

Make it work with a simple gamelogic for the position, before you try and insert it into your mission.    It's a common mistake this - using an unfamiliar piece of code in battle conditions before understanding it fully.   Always test a new command in a missionette first.    ;)
Title: Re:camCreate LaserGuidedBomb
Post by: CopyrightPhilly on 26 Jul 2004, 12:12:26
ok make your self a sqs file and put this in it:

Code: [Select]
_x=getpos crate select 0
_y=getpos crate select 1
_z=getpos crate select 2

explo01 = "LaserGuidedBomb" camcreate [_x,_y,_z]
exit;

then put this in the trggers activation:

Code: [Select]
[] exec "filename.sqs"
replacing filename with whatever u named the file.

i just tested this and it worked fine, i made a ammo crate and called it "crate" and then ran it, it worked

cheers, Philly
Title: Re:camCreate LaserGuidedBomb
Post by: AnarCHy on 26 Jul 2004, 12:39:59
thanks for your reply Philly, but Macca fixt it.  Thnx macguba and Philly for your help!

Now the munitions cache is gonna blow the base sky high!

Look for me mission later mebbe this next few days.


thnx again,

AnarCHy


*topic solved*