PDA

View Full Version : Sensor ot trigger question.



Groucho2
10-06-2009, 08:25 AM
Is there a way to configure a sensor or trigger to enable/disable by pressing a defined key on the keyboard? or maybe wait to invoke an action until the user presses a key?

seir
10-06-2009, 02:03 PM
Create a trigger that will some action under condition "IsActionExecuting". In this condition, you have list of actions made by player that can be used as you said. You can't assing exact key but it's still very powerful condition http://forums.ubi.com/groupee_common/emoticons/icon_smile.gif

wookash_b
10-15-2009, 01:36 PM
Question about triggers and actions. I tried to disable a trigger by using act_EnableDisable in the aOnExecute action list and then do the same thing (disable the trigger) in aOnStopExecute list. The effect I was after was to make the trigger work only once. I noticed that when I used actEnabledisable in aOnStopExecute list it did not work, the trigger was still enabled and could be used multiple times. It would only be properly disabled when I used act_EnableDisable in aOnExecute list as the last action. Why is that? When are actions from aOnStopExecute launched?

Eltaar
10-16-2009, 02:14 AM
I assume you are referring to TriggerObject class, not an actual Trigger (since Trigger doesn't contain handlers you have mentioned)?

First of all you don't have to use act_EnableDisable to make a TriggerObject work only once - there is a variable called nOnExecuteTimes, if you set it to 1, your object should work one time, and then automatically disable itself.

As for the execution handlers they work a bit differently than one might expect - aOnExecute is triggered when the player presses use button. aOnStopExecute starts when the button is released.

This is also true for all other usable objects, so for instance: if you perform use action on a Gatling: aOnExecute is triggered when the key is pressed, and shortly after aOnStopExecute when the key is released - both actions will be performed just by the act of mounting on the Gatling. When the players tries to dismount, he will have to press use button - and again this would execute both aOnExecute (when key is pressed) and aOnStopExecute (when key is released).

wookash_b
10-16-2009, 06:33 AM
Thanks for the explanation.

Groucho2
10-16-2009, 11:05 AM
This is also true for all other usable objects, so for instance: if you perform use action on a Gatling: aOnExecute is triggered when the key is pressed, and shortly after aOnStopExecute when the key is released - both actions will be performed just by the act of mounting on the Gatling. When the players tries to dismount, he will have to press use button - and again this would execute both aOnExecute (when key is pressed) and aOnStopExecute (when key is released).

Would it be possible to use this method as a way of holstering your gun?

For example: Say I created a model of a holster in 3DS Max and imported it and attached it or parented it to the player element. Assigned it the whatever needed class then configured a trigger so that whenever I look down at the holster object (attached around the waist area)I could push the use key and force the holster weapon attribute to work?

seir
10-20-2009, 01:42 AM
Grucho2, that's a good idea. I think this will work fine. Use TriggerObject as class of holster and in this object "onExecute" set PlayerControl to Holster player guns. In "CustomTip" type "Holster guns".

Groucho2
10-20-2009, 08:05 AM
Thanks Seir! This is great news for me. Now I'll be able to add a feature back in that while it wasn't a big deal to most it really bugged me for some reason. You're a HUGE help as always!

Spamhain
10-22-2009, 01:45 PM
This was very helpful Seir, thanks! Now, how do I set a trigger to have a delay before it can be used again? For example, I've created a detonator that when used immediately blows up dynamite elsewhere on the map (Wanted). How do I make it so the detonator can't be pushed for 8 more seconds?

Thanks!

seir
10-23-2009, 01:20 AM
Create a trigger that will work only "1" "nTimes". In Actions first action should do that what you want to do and after them create action "act_Wait" and in "Delay" type "8" (8 seconds) and after this create "act_Enable" that will turn on your trigger http://forums.ubi.com/groupee_common/emoticons/icon_smile.gif

I don't know did I get your idea http://forums.ubi.com/groupee_common/emoticons/icon_wink.gif

Spamhain
10-23-2009, 09:05 AM
Thanks Seir. I almost had it. I still can't get it to work more than once though. Also, when I host a Wanted or Shootout match, only the player that uses the detonator can see/hear the explosion it causes. Any idea why?

http://img259.imageshack.us/im...onatorattributes.jpg (http://img259.imageshack.us/img259/8476/detonatorattributes.jpg)

cr1m3
07-02-2010, 03:02 PM
Hi,
maybe you can try to invoke all actions you need with a "NetInvokeObject" (added to good game mode) for showing the explosion to all players.
In the trigger, on execute action choose act_invoke and point the target to the netInvokeObject you've created.
Now, in netInvokeObject put your actions in the m_onInvoke action field.