Home   Help Search Login Register  

Author Topic: class useractions. I can't make them work...  (Read 1131 times)

0 Members and 1 Guest are viewing this topic.

Baphomet

  • Guest
class useractions. I can't make them work...
« on: 17 Jun 2003, 15:05:36 »
Anyone understand the finer points of using "class useractions" to create actions which execute scripts for one's addon?

I was fiddling around with col klink's A4 skyhawk and I couldn't seem to get the useraction to appear on the little menu while I was in the game. Is there something I'm not doing aside from defining a class and telling it to run a script?

As usual constructive comments are greatly appreciated.

Skaircro

  • Guest
Re:class useractions. I can't make them work...
« Reply #1 on: 17 Jun 2003, 16:35:54 »
To have it execute a script it goes something like this:

class Useractions
{
     class ActionName
     {
     displayName="Do Something";
     position="NamedMemoryVertex";
     radius=2;
     condition="player in this";
     statement="[this] exec ""\addonname\script.sqs""";
     };
};

Baphomet

  • Guest
Re:class useractions. I can't make them work...
« Reply #2 on: 17 Jun 2003, 17:01:44 »
It seems they work now that I've defined it within class cfgvehicles... go figure. I got it to work... sorta...

I'm not terribly certain what this named memory vertex is? Is it referring to a predefined location on the model?

Baphomet

  • Guest
Re:class useractions. I can't make them work...
« Reply #3 on: 17 Jun 2003, 17:07:47 »
I seem to have fixed one problem and ran into another. I'm using carey bear's nitro script and I was counting on the condition I had placed in the action to stop it from being activated when the vehicle started moving past a speed of 280

class UserActions
   {
           class Afterburner
   {
   displayName = "AfterBurner On";
   position = "GearArea";
   radius = 5;
   condition = "speed this <= 280";
   statement = "[this] exec ""\CWKSkyhawk_4k\nitro.sqs""";
   };
   
      };

Unfortunately it can remain activated indefinitely. Which is rather annoying. This sort of straddles the line between scripting and cpp editing so if an admin wishes to re-locate the thread I understand.

Can anyone give me a hand?

Skaircro

  • Guest
Re:class useractions. I can't make them work...
« Reply #4 on: 18 Jun 2003, 17:46:34 »
The named memory vertex is just like you have it there, as GearArea.
It's just a vertex in the memory lod of the model named as GearArea.

The condition line is what needs to be met for the action to be used.
Once the action is executed it doesnt pay any attention to that, until it comes time to use the action again
What you have there is, 'this action will only be available when speed is less than 280'.
I hope you understand what I mean!  ;D


To fix it you could edit the script so that it works on a type of timer.
(Of course, seek permission if you want to release the script afterwards)

The attached script is from my f-111 for the dump and burn, basically making it run for approx 10 seconds.
Ignore the bits for vehiclechat and setobjecttexture, the bits for _dumptime is like what you would need to use.

And this is the useraction I have:

class FuelDump
{
displayName="Start Dump & Burn";
position="ControlArea";
radius=2;
condition="speed this >350 and player in this";
statement="[this] exec ""\SKC_F111_Grey\dump.sqs""";
};
« Last Edit: 18 Jun 2003, 17:50:33 by Skaircro »