Jump to content
Sign in to follow this  
colonel_klink

Clock works in nogova

Recommended Posts

Ok the clock on the large building in Nogova (model= domek_radnice.p3d) has a working clock. I wish to implement a similar thing in the consulate. Can anybody enlighten me to how this works in Nogova. The clock parts in the BIS model are minutova3, hodinova3 and the axis point is osa3 (thanks to the Odol_explorer tool). I have checked the cpp files for 1.75 and above, but still no luck.

Share this post


Link to post
Share on other sites

Maybe this is what you are looking for?

class IndicatorWatch

{

hour = "hodinova";

minute = "minutova";

axis = "osa_time";

reversed = false;

};

Share this post


Link to post
Share on other sites
Quote[/b] ]i think there shouldnt be a '3' at the end?

This is directly from the model itself.

Quote[/b] ]Maybe this is what you are looking for?

class IndicatorWatch

{

hour = "hodinova";

minute = "minutova";

axis = "osa_time";

reversed = false;

};

Was the first thing I tried before finding the object names as above.

Thanks Guys

Share this post


Link to post
Share on other sites

There might be a way around this doing just costum animations instead of using the preset ones in OFP. I'm sorry for my bad memory on scripting since I haven't scripted anything for about 4 months, but i think there is another way to do it.

Would creating 2 different animations for each arm on the clock work. One for the minute hand and one for the hour hand, both set with a rotation set at 0 radians and the next at a full rotation of 2pi i guess it is.

then use an intit eventhandler in the config file with a separate script in the file.

the script could look something like this

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_clock = _this select 0

#Clock

_time = daytime

_hours = _time - _time% 1

_min = _time - _hours

;****minute rotation

_MinAnim = _min

_clock animate ["minute", _MinAnim]

? _MinAnim >= 1 : _MinAnim = 0

;****hour rotation

_HourAnim = _hour*(1/24)

_clock animate ["hour", _HourAnim]

? _HourAnim >= 1 : _HourAnim = 0

~1

Goto “clockâ€

I'm sure there might be some mistakes since i can't remember the correct syntax and everything, but that might work.

Especially since daytime returns a time like 7:30 am as 7.5 and then everything is converted to a 0.0 to 1.0 scale for animation rotation

Well i hope i helped ya

crazy_o.gif

Share this post


Link to post
Share on other sites

oops not sure if i read that wrong...especially didn't see how long ago the last post was....oopppss...

did the previous post mean that you had it fixed or that it still wasn't working??

Share this post


Link to post
Share on other sites

@Bullz_eye_on_my_back

no I hadn't resolved the issue with the clock, but your suggestion is a good one. I will try that out as soon as I get back on to the embassy. thanks

Share this post


Link to post
Share on other sites

Well I tried making a quick test of it, but its been a while since i've done some modeling too. For some reason the only thing i see when making an animation is the shadow rotating the hour hand or minute hand stays stationary. I'm sure i'm just missing something in it. Also, one thing to add is that I didn't account for the hour hand will do 2 rotations in a 24 hour period. You just have to put a set of equations to subtract out 12 hours if its over 12 pm.

Another wierd thing i noticed is when I was trying to get the hours by rounding or so didn't work. I'll think of a dif. way to do it smile_o.gif

Share this post


Link to post
Share on other sites
Guest

Make sure the selection has the same name/coordinates in the LOD that is producing the shadow smile_o.gif

Share this post


Link to post
Share on other sites

thats the part that i can't figure out. I've made several models in the past with costume animations, and looked to them in reference to make sure i had it all right. All I've done is named the selections and parts and did a "duplicate" for the different LODs..... maybe its just OFP getting back at me for ignoring it for the past 4 months crazy_o.gif

Share this post


Link to post
Share on other sites
Guest

Ahhh....she's a fiesty Mistress! wink_o.giftounge_o.gif

Share this post


Link to post
Share on other sites

sorry to bring up an old thread, but did you ever get it working Colonel_Klink??

If not I've created a small addon with all the scripts and animations for a clock.

You can have it if ya want smile_o.gif

Share this post


Link to post
Share on other sites

Bullz_eye_on_my_back

Hi there buddy.

I've been busy with some other stuff (Utopia Island and the Falklands mod) so haven't been back to the clock. I would much apprecate the script if I may borrow it as there ore a couple of buildings in the Utopia 'mini mod' that have clocks in them.

Thanks

Klink

Share this post


Link to post
Share on other sites

no problem... when you mentioned the idea I kind of wondered if i could get one to work myself. So I tried creating one.... ofcourse thats where I found my "animated=1" to be my problem lol

But yep I'll send it to ya! I love the Utopia Island look! Keep it up!!

The look kind of gives me a feeling of the mystic game with all of the puzzles and everything.

Share this post


Link to post
Share on other sites

Well I can't find an email address, I'll just post up the scripting and config for anyone that would like to know of a way to do it. I don't know how BIS does it but this one works too...

I doubt you need the model to see because I've learned most of my O2 from your tutorials Klink smile_o.gif

First the config>>>>

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

class CfgPatches

{

class clock

{

units[] = {house};

weapons[] = {};

requiredVersion = 1.3;

};

};

class CfgVehicles

{

class All {};

class AllVehicles: All {};

class Land: AllVehicles {};

class Static: Land {};

class Building: Static {};

class NonStrategic: Building {};

class House: NonStrategic {};

class clock: house

{

model="\clock\clock";

armor=40;

vehicleClass="Support";

side=TWest;

scope=public;

displayName="Working Clock";

animated=1

class Animations

{

class Minute

{

type="rotation";

animPeriod=0.0000001;

selection="minute";

axis="osa_minute";

angle0=0

angle1=-6.283185307179586;

};

class hour

{

type="rotation";

animPeriod=0.00001;

selection="hour";

axis="osa_hour";

angle0=0

angle1=-6.283185307179586;

};

};

class eventhandlers

{

init="[_this select 0] exec ""\clock\scripts\clock.sqs""";

};

}

};

Naturally just name the selections "hour" and "minute"

now the \scripts\clock.sqs file...

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">

_clock = _this select 0

#timecheck

_time = daytime

_planea = _time - _time % 1

_min = _time-_planea

?(_time>=12): _time =(_time-12)

?(not alive _clock) : exit

#animate

_minAnimate = (_min)

_clock animate ["minute", _minAnimate]

_HourAnimate = (0.08333333*_time)

_clock animate ["hour", _HourAnimate]

~0.5

goto "timecheck"

exit

The hours are converted to the 0 to 1 scale for animation by just dividing it by 12 or 0.083333

The minutes are already on a scale from 0 to 1

I hope I helped biggrin_o.gif

Share this post


Link to post
Share on other sites

oops you could totally take out the <#animated> part and the <_minAnimate> and replace it with just <_min>

also for less strain on the cpu ...the variables could be shortened wink_o.gif

Sorry

Share this post


Link to post
Share on other sites

Thanks buddy this will save me a heap of time.. And of course you'll get an honorable mention in the credits smile_o.gif

Cheers

Klink

Share this post


Link to post
Share on other sites

Very welcome Colonel Klink, I'm glad I could help save you some time. It's the least I can do after all the time you've spent helping the rest of us. biggrin_o.gif

p.s. Watchout about visiting your island... you might find yourself with about 17 lil munchkins

Thats really something to think about...whew

Share this post


Link to post
Share on other sites

Hmm im sure there is something with a working clock on it i have....hmmmm maybe it was one of the demo buildings.....i cant remember where ive seen it tho......

Oh yeh i know, its the watch.....dunno if thats any use to you.....

Share this post


Link to post
Share on other sites

If I remember right, the radio also has a clock. But I can't remember if it's working... rock.gif

Share this post


Link to post
Share on other sites

Nice to see you again Dshulle smile_o.gif

I'm slowly getting better at scripting

Yeah...I think the radio clock did work...but I never tried speeding up the time to watch and see if it moved....hmmmm...

Share this post


Link to post
Share on other sites

What invokes the wrp embedded clock models at all ? Also, which vector points to the xmas trees going on at given times ?

Share this post


Link to post
Share on other sites

well for what its worth ...if anyone wants to know a good way to have a clock by scripts I can post up the much more efficient config and script to make it work ..its million times better than the previous post i put up....still haven't checked out the bis clock though

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×