Home   Help Search Login Register  

Author Topic: I guess this belongs here, Animation.  (Read 1508 times)

0 Members and 1 Guest are viewing this topic.

Offline Ding

  • Contributing Member
  • **
  • Jurassic Park
I guess this belongs here, Animation.
« on: 14 Jul 2005, 16:42:59 »
I have animated a Lever in o2 and have given it hte animation to move forwards and backwards, when they are used through the action menu, what i want to do though is i want a script to be activated when the lever is pressed, how do i do this?     :D
"If I remain lost and die on a cross, atleast I wasn't born in a manger"

Offline remcen

  • Contributing Member
  • **
  • a.k.a. hottentotten_mike
    • IM:UC
Re:I guess this belongs here, Animation.
« Reply #1 on: 14 Jul 2005, 21:15:23 »
no problemo actually. the clue is the init eventhandler and the animationphase query.

insert into the cfgvehicles section of the config of your object/car/whatever

class eventhandlers
{
Init="[_this select 0] exec ""\pboname\init_object.sqs"";";
};


your init_object.sqs:

#start
@ (_this select 0) animationphase "lever" == 1

insert script code here, loop maybe

@ (_this select 0) animationphase "lever" == 0
goto "start"


NB. this will not work for any stuff that you place on an island in an island editor. the class eventhandlers only work for vehicles/objects/etc which are placed in the mission editor.
hope that helps ;)
we're looking for members: IM:UC MOD

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:I guess this belongs here, Animation.
« Reply #2 on: 14 Jul 2005, 22:25:16 »
Quote
class eventhandlers only work for vehicles/objects/etc which are placed in the mission editor.

Actually the "init" eventhandler can be used on .wrp placed objects.......static objects like buildings and such anyway.

I think the model has to be in ODOL format though.....i.e. Binarized.


Planck
I know a little about a lot, and a lot about a little.

Offline Ding

  • Contributing Member
  • **
  • Jurassic Park
Re:I guess this belongs here, Animation.
« Reply #3 on: 15 Jul 2005, 11:00:34 »
what i realy wanted is a Global variable which says that when the lever is pressed a gate opens, i have an opening script for the gate, i just dont know how to get it to be activated by pressing the lever
"If I remain lost and die on a cross, atleast I wasn't born in a manger"

UNN

  • Guest
Re:I guess this belongs here, Animation.
« Reply #4 on: 22 Jul 2005, 08:59:05 »
Quote
Actually the "init" eventhandler can be used on .wrp placed objects.......static objects like buildings and such anyway.

I think the model has to be in ODOL format though.....i.e. Binarized.

Do you know of any released addons, that implement this?

Quote
what i realy wanted is a Global variable which says that when the lever is pressed a gate opens, i have an opening script for the gate, i just dont know how to get it to be activated by pressing the lever

Use class Useractions, I guess you have one already setup to animate the lever? Just use the AnimationPhase command remcen posted, to decied if the gate should open or close.

Code: [Select]
class UserActions
   {
   class PullLeverDown
      {  
           displayName="Pull Lever Down";
           position="zbran";
           radius=0.5;
           condition="This animationphase "lever"==1";
           statement="[Object <Map Object ID>,True] Exec ""OperateGate.sqs""";
            };

   class PushLeverUp
      {  
           displayName="Puch Lever Up";
           position="zbran";
           radius=0.5;
           condition="This animationphase "lever"==0";
           statement="[Object <Map Object ID>,False] Exec ""OperateGate.sqs""";
            };
   };

The Object command needs the ID you get in the mission editor, thats assigned to the gate object, you want to operate.

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:I guess this belongs here, Animation.
« Reply #5 on: 22 Jul 2005, 20:46:28 »
Quote
Do you know of any released addons, that implement this?

Yes......for example try looking at the config for AGS_inds.pbo from Agent Smith.

Basically it looks similar to:

class EventHandlers
    {
        init = "(_this select 0) exec {\pboname\scriptname}";
    };


Planck
I know a little about a lot, and a lot about a little.

UNN

  • Guest
Re:I guess this belongs here, Animation.
« Reply #6 on: 22 Jul 2005, 23:20:57 »
Quote
Yes......for example try looking at the config for AGS_inds.pbo from Agent Smith.

I don't think they work from .wrp placed objects though :( They will launch there config init from the Mission editor, but not straight from loading an island. I hope this is added for Armed Assault.

Cheers

Offline Planck

  • Honoured
  • Former Staff
  • ****
  • I'm never wrong ....I'm just not always right !
Re:I guess this belongs here, Animation.
« Reply #7 on: 23 Jul 2005, 00:17:57 »
Hmmm......I think you may be right there.

He actually uses effects scripts that need to be manually started.

Ah well, as you say, maybe in AA.

 ::) ::)


Planck
I know a little about a lot, and a lot about a little.