Jump to content
Sign in to follow this  
Unnamed_

Starting animations from map objects

Recommended Posts

Hi,

I noticed the old chestnut about starting anims from map based objects, cropped up again. Remembering a couple of posts by Dinger and Bn880 I put this together.

As an example add the following user actions to the JOF_Objects1 config for:

class JOF_Radar002

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

{

class JOF_Radar002Init

{

displayName="Nil";

position="Achse1";

radius=3000;

condition="call {private ""_t"";_T=True;If JOF_Radar002 Then {_T=False};If _T Then {JOF_Radar002=True; [This] Exec ""\JOF_Objects1\Radar.sqs""};_T}";

statement="";

};

};

class JOF_Haus006Init

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

{

displayName="Nil";

position="Achse1";

radius=3000;

condition="call {private ""_t"";_T=True;If JOF_Haus006 Then {_T=False};If _T Then {JOF_Haus006=True; [This] Exec ""\JOF_Objects1\Radar.sqs""};_T}";

statement="";

};

When you start a mission on Mapfacts Nogova, both Radars should be working. It's activated when the player is within 2000 meters of the radar (2000m is the max range of user actions?)

There are better ways of starting more than one anim, but this was just a quick test. The downside, the following function:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">call {private ""_t"";_T=True;If JOF_Radar002 Then {_T=False};If _T Then {JOF_Radar002=True; [This] Exec ""\JOF_Objects1\Radar.sqs""};_T}

Is called every 0.04 seconds for the duration of the mission. But it's only a couple of logic test on some Booleans, so it should not be that bad.

Cheers

Share this post


Link to post
Share on other sites

does this work ingame editor only or aswell when placed

by visitor/wrptool?

Share this post


Link to post
Share on other sites

It works best when placed by visitor.

You should be able to use the method as either a single init event for an island. Or as individual init events for objects placed on the island with visitor.

Share this post


Link to post
Share on other sites

Veeeery nice finding there.

There's another radar tower in the Mapfact Baracks Addon (Baracken.pbo, currently in version 1.5), "AIR\Military Radar Tower"/JOF_Radar003. Here's how to do the same trick to it by adding a class UserActions part to it:

Quote[/b] ]

...

class JOF_Radar003 : Fence

{

...

...

<span style='color:green'>class UserActions {

class JOF_Radar003Init

{

displayName="nil";

position="Achse1";

radius=5000;

condition="call{private""_t"";_t=true;if JOF_Radar003 then{_t=false};if _t then{JOF_Radar003=true;[this]exec""\Baracken\Radar.sqs""};_t}";

statement="";

};

};</span>

...

};

...

NB: The "..." just means "things here I haven't quoted", so don't go adding those to the config.

<span style='color:red'>EDIT: set radius to 5 km based on Unnamed's tip in the post just below</span>

Share this post


Link to post
Share on other sites

Hi,

Just an extra thing I found out. The User Action radius can be set to 5000. It corresponds to the view distance you set in OFP. As soon as the player gets within the view distance, the object is created (in game) and OFP starts checking the user actions.

So if you set the radius to 5000 you will always see the anims working, no matter what the view distance.

Cheers

P.S Sorry about the name change halfway through this thread

Share this post


Link to post
Share on other sites

Well,here are my configs,can't make it work:

Baracken config:

//----Radar003 ------------------------------------------------------------------------

class JOF_Radar003 : Fence

{

model="\Baracken\JOF_Rada003";vehicleClass="Mapfact Objects";icon="\Baracken\b46.jpg";

displayName="$STR_DN_JOF_Radar003";armor=200;irTarget=0;scope=2;

ladders[]={{"start","end"}};

class UserActions

{

class JOF_Radar003Init

{

displayName="nil";

position="Achse1";

radius=5000;

condition="call{private""_t"";_t=true;if JOF_Radar003 then{_t=false};if _t then{JOF_Radar003=true;[this]exec""\Baracken\Radar.sqs""};_t}";

statement="

};

};

class Animations

{

class JOF_Radar{type="rotation";animPeriod=200;selection="Radar";axis="Achse1";angle0=0;angle1=500;

};

};

};

//----OFP-Zaune -----------------------------------------------------------------------

@ECP config.cpp:

class WireFence:Fence

{

scope=2;

model="plot_provizorni.p3d";

displayName="$STR_DN_FENCE_WIRE";

accuracy=0.3;

mapSize=5.5;

};

class JOF_Radar003:Fence

{

model="\Baracken\JOF_Rada003";vehicleClass="Mapfact Objects";icon="\Baracken\b46.jpg";

displayName="$STR_DN_JOF_Radar003";armor=200;irTarget=0;scope=2;

ladders[]={{"start","end"}};

animated=1;

class UserActions

{

class JOF_Radar003Init

{

displayName="nil";

position="Achse1";

radius=5000;

condition="call{private""_t"";_t=true;if JOF_Radar003 then{_t=false};if _t then{JOF_Radar003=true;[this]exec""\Baracken\Radar.sqs""};_t}";

statement="";

};

};

};

class Hangar01:Fence

NOE(nogova) config:

class Hallway:default

{

access=2;

files="podldlzin02*";

rough=0.12;

dust=0.1;

soundEnviron="hallway";

};

};

class JOF_Radar003:Fence

{

model="\Baracken\JOF_Rada003";vehicleClass="Mapfact Objects";icon="\Baracken\b46.jpg";

displayName="$STR_DN_JOF_Radar003";armor=200;irTarget=0;scope=2;

ladders[]={{"start","end"}};

animated=1;

class UserActions

{

class JOF_Radar003Init

{

displayName="nil";

position="Achse1";

radius=5000;

condition="call{private""_t"";_t=true;if JOF_Radar003 then{_t=false};if _t then{JOF_Radar003=true;[this]exec""\Baracken\Radar.sqs""};_t}";

statement="";

};

};

};

class CfgWorldList

I placed them with wrptool,what´s wrong?

Share this post


Link to post
Share on other sites

I noticed you have an incomplete statement:

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

Should be like the others:

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

And the Braken config does not set the animation flag like the ECP config:

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

That might be it?

Share this post


Link to post
Share on other sites
Guest

Is this single player or multiplayer or both? Only whenever I've fiddled around with this sort of stuff I've noticed that things will work well for single player, but can experience heaps of problems over a network.

Share this post


Link to post
Share on other sites

Single player.And what config of those should have this statement?

Share this post


Link to post
Share on other sites

The braken config has the incorrect statement, but I doubt that is a problem otherwise OFP would have objected.

But you definetly need the:

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

line in the class JOF_Radar003 for the Braken config.

The others should work ok?

If not I could probably create a tiny addon that inherits from the JOF objects. Never tried Island based objects, but I can make it so the new object does not show in the editor. But should be available to insert into an island. Then I guess you just package my new addon, into your Island pbo?

One question though, why do you have the same object defined in three different configs? Or do you have three different islands?

Share this post


Link to post
Share on other sites

No,it wasn´t missing in config itself.I have tried all those configs,but cant make it work.Addon could be nice thing.But you shoul make configs for all(4)original islands.Could you include both radars and hangar(biggest one) 001 in it?

Share this post


Link to post
Share on other sites

Hi,

Like I said I'm not up on WrpTool. But AFAIK the Radar's are in JOF_Objects1.pbo? I have the Braken addon, but that has no objects in it.

So I dont understand why you need configs for all those islands, just to use the one in JOF_Objects?

Share this post


Link to post
Share on other sites

Well,i removed those two configs and it works now!Thank´s for all who wanted to help!!!I also got hangar01 doors working,and fml_objects windmill(bigger one)working also,but couldn´t make small one to turn.Any experience about this?

Share this post


Link to post
Share on other sites

I'll make some companion addons to go with JOF_Objects1 and FML_Objects, if someone can test them with WRP? I have the radar object class names, are there any more class names like Hangar01?

I read something about animated cranes? Not really familiar with either of theses addon collections.

Quote[/b] ]Any experience about this?

I'll take look.

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  

×