OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: CopyrightPhilly on 14 May 2004, 00:58:35

Title: Placing Soldier Inside Building
Post by: CopyrightPhilly on 14 May 2004, 00:58:35
ok what i want is for a little scipt so that when the trigger is activated then to create a soldier eather west or east (random) and to place him inside a building...

dose anyone know how to do this?

cheers, Philly
Title: Re:Placing Soldier Inside Building
Post by: Kammak on 14 May 2004, 01:14:09
Which part(s) do you need help with?

1) Placing units in buildings
2) Randomly choosing a side
3) Creating a unit
4) All of the above

Title: Re:Placing Soldier Inside Building
Post by: CopyrightPhilly on 14 May 2004, 01:17:08
thats a rodger
Title: Re:Placing Soldier Inside Building
Post by: CopyrightPhilly on 14 May 2004, 01:26:12
thats a rodger

maybe i should read the question, #4 all of the above
Title: Re:Placing Soldier Inside Building
Post by: nEO iNC on 14 May 2004, 08:51:11
Hey CopyrightPhilly, all, an interesting problem and one that most people come up against at some point during their editing career...

I've attached a script I wrote to do just what you wanted. There are some instructions inside, but I'll run through what you need to make it work. I just knocked this up so there might be some syntax errors, but essentially it should work. :)

You need to give it the following information in the following format;

[object id, x offset, y offset, z, offset] exec "solbuild.sqs"

'objectid' - editor number of the building you want to put soldier in
'x offset' - offset (number) in the North/South axis
'y offset' - offset (number) in the East/West axis
'z offset' - height (number) above/below ground

You will also need to place two soldiers on the map out of the way. Make one East, one West and call them solbase and solbasw respectively. You can set their health to zero if you don't want any trouble from them...  :)

Feel free to modify it in any way you like... It would be nice though if you use it in your mission and it becomes a hit to give me a bit of credit...  ;)
Title: Re:Placing Soldier Inside Building
Post by: ACF on 14 May 2004, 14:53:15
Have a look at the BuildingPos command in the Command Reference in the Editor's Depot - it looks like this will get you the coordinates of the programmed positions in houses.
If you set yourself as the leader of a group in the editor, you can have a look round the houses - select one of your men and your crosshair will display the building's internal positions and their all-important index number.
Title: Re:Placing Soldier Inside Building
Post by: CopyrightPhilly on 14 May 2004, 15:41:45
Hi nEO iNC, I Thank You For Your Work, That Worked Fine..

Cheers, PHilly
Title: Re:Placing Soldier Inside Building
Post by: CopyrightPhilly on 14 May 2004, 17:23:59
ok i just come over a problem with that scipt.

say i use

[7035, 0, 0.5, 0] exec "build1.sqs"

then it works fine but if i put anything higher then 0.5 then nothing happens!!!

any ideas?

i tryed it with a full nuber as well like 1 but still no joy :(

cheers, philly
Title: Re:Placing Soldier Inside Building
Post by: CopyrightPhilly on 17 May 2004, 11:17:56
guess n1 can help me????  :(
Title: Re:Placing Soldier Inside Building
Post by: nEO iNC on 17 May 2004, 16:26:26
Hey CopyrightPhilly, sorry I've not posted before now, don't really get chance to look at the forums at the weekends...  :(

Odd one that, don't believe I've come across it before... I've got a lot of scripts that use this same pricipal, but haven't had the problem you describe...  ???

Is it just the 'Y' axis adjustment or all of the co-ord adjustments..?

I can't see anything immediately wrong with the script, I'll have to check this evening for you. Hopefully, I'll have an answer for you tomorrow... or... a new script... maybe a couple...  ;)

Watch this space...
Title: Re:Placing Soldier Inside Building
Post by: nEO iNC on 18 May 2004, 08:00:11
Hey CP, well... Errr what can I say? The original script was garbage, not sure how you got it to do anything, let alone only have a problem with the y offset..?!

Anyway, to make up for wasting your time I made these last night...

'solfpos.sqs' is essentially a new version of the old non-worker. Supply the object id, give it offsets for each co-ord and thats where the soldier appears.

'solbpos.sqs' uses the buildpos idea that ACF suggested. Just supply the object id, a position within the building (pre-defined) and again that's where the soldier appears.

I've added a couple of more things to make your life easier. You now get to select the type of unit spawned for each side. Just add a unit type (in quotes), one for each side. See the .sqs for details.

Hope these help...

Title: Re:Placing Soldier Inside Building
Post by: nEO iNC on 18 May 2004, 08:00:38
Second script...