Home   Help Search Login Register  

Author Topic: Me and OFP CWC v1.3  (Read 1658 times)

0 Members and 1 Guest are viewing this topic.

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
Me and OFP CWC v1.3
« on: 08 Jun 2010, 11:52:57 »
I am now making a mission for my brother (Only intended for my brother, and he only got ofp v1.3)
(And I also have only v1.3)
As you can imagine,
you can't do much scripting things with that ....  :confused:

but I finally managed to find the max buildingpos in a nearby building
(I think functions don't work in that version,because i can't use execVM command)

here's the code :
Quote
_unit=_this select 0;
_h_building=_this select 1;
_bp=0;
_bpos=[];

#loop
_bpos=_h_building buildingpos _bp;
_bformat=format ["%1",_bpos];

;I think its converting _bpos to string
;in ofp v1.3 ,you can't compare something with arrays
;getpos player==[1,3,4] won't work.

~0.2
? (_bformat != format ["%1",[0,0,0]]) : _bp=_bp+1;goto "Loop"
;if buildingpos is not equal to [0,0,0] then continue looping

hint format ["Building : %1\nMax Positions : %2",_building,_bp];
;output the max buidingpos of the nearby building
exit
Can it be used with ofp resistance?

another problem :
i have the editorupdate102 addon installed.
so,i've got a snow dropping object (Burn...*Snow or something like that in empty>ammo)
(the object is fire type,so this inflame true is necessary to drop the snow
as well as a disturbing action menu entry showing "Put Out Fire", and "Light Fire" pop up where you are near it)
I wrote a script(snow dropping script) so it keeps the snow object about 5 meters in the air and 6m infront of him all the time.
(So its snowing around the player all the time)

I want to setpos that snow to [0,0,0] when the player is inside a building...
So I added the following things to the snow dropping script and end up with failure.

_unit=_this select 0;
_snow=_this select 1;
_nb=nearestBuilding _unit;

#loop
? _unit distance _nb < 5 : _snow setpos [0,0,0];@ _unit distance _nb > 5
dropping stuffs
other things
goto "loop"

and when i hint formatted the two positions of the building and unit.
the position of the building is far too higher than the unit even though the unit is just standing out side the
building.
eg.
unit pos > [4321.5,3059.5,0]
building pos > [10035.6,18550.3,0.0023E]

(just my imagination of the positions ,not copied from the mission)

So is there any other way to setpos that snow to [0,0,0] when _units in a building?
and is there any other way to check the distance between the unit and the building?

Regards,
Haroon1992
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Me and OFP CWC v1.3
« Reply #1 on: 08 Jun 2010, 15:01:37 »
Quote
(I think functions don't work in that version,because i can't use execVM command)

LOL Haroon, you're right, functions were introduced in OFPR. But ExecVM is an Arma command. :whistle:

Quote
Can it be used with ofp resistance?

Yes, though I couldn't help but notice that you use a variable _building near the end which was not defined. Also, because the buildingPos indices start at 0, the Max Positions part of your hint will display a number one greater than the highest buildingPos index of a given building.

And there's a more elegant way to check if a buildingpos is not [0,0,0].

Code: [Select]
"_x == 0" count (_h_building buildingpos _bp) != 3

Probably works in CWC. As for your snow script, I noticed

Code: [Select]
? _unit distance _nb < 5 : _snow setpos [0,0,0];@ _unit distance _nb > 5
Placing an @ after a semicolon is not a valid expression (at least, not in OFPR) and should cause an error. Use a line break.

Quote
and when i hint formatted the two positions of the building and unit.
the position of the building is far too higher than the unit even though the unit is just standing out side the
building.
eg.
unit pos > [4321.5,3059.5,0]
building pos > [10035.6,18550.3,0.0023E]

No idea why this should be happening, unless you didn't put in the right object ID.

Correction: I just tested. It appears that nearestBuilding returns the nearest enterable building, so that probably explains it.
« Last Edit: 08 Jun 2010, 15:14:47 by RKurtzDmitriyev »
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
Re: Me and OFP CWC v1.3
« Reply #2 on: 09 Jun 2010, 17:42:00 »
Thank you for the methods,
but isn't nearestbuilding returns the nearest enterable building within 50 meters?
I will check it later..(the positions)

Regards,
Haroon1992
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Me and OFP CWC v1.3
« Reply #3 on: 09 Jun 2010, 18:00:07 »
No, that's nearestObject that can only go up to 50m. :D
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)

Offline haroon1992

  • Members
  • *
  • My life is hopeless...
Re: Me and OFP CWC v1.3
« Reply #4 on: 09 Jun 2010, 18:07:19 »
So i'm with the most disabilities. LOL  :D

(To say the truth, i also have Resistance,but its in another computer which is unreachable at the moment.
Well,I won't be able to touch for another two months,i think )


I am now thinking of creating a fire source compatible with CWC.
Will i even create one?

if so can you tell me how to create the fire.
Can i use the drop command?
and the parameters?

Regards,
Haroon1992
Very busy with life, business, and other stuff. Away from OFP for months. Not sure if I could get back onto it. :(

Offline RKurtzDmitriyev

  • Former Staff
  • ****
Re: Me and OFP CWC v1.3
« Reply #5 on: 09 Jun 2010, 18:32:05 »
Never done particle scripting, I'm afraid. But the Bohemia Interactive Community wiki has its own comref, and it records which version a command was introduced in. Drop is supposed to be from version 1.5. Not sure what that's supposed to mean, because CWC was up to 1.46 and then skipped over to 1.75 for Resistance . My guess is that it was introduced in OFPR.
The OFP Editing Center wishes to remind you that the faithful COMREF will never threaten to stab you and, in fact, cannot speak.
However, in the event that it does speak, you are encouraged to heed its advice. ;)