Home   Help Search Login Register  

Author Topic: Random Trigger activation  (Read 2201 times)

0 Members and 1 Guest are viewing this topic.

Offline snozzdog

  • Members
  • *
Random Trigger activation
« on: 16 Sep 2008, 22:40:08 »
Is there anyway i can make a trigger so its activation is a 50% chance?

Thanks

Snozzdog

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Random Trigger activation
« Reply #1 on: 17 Sep 2008, 00:09:11 »
For SP all you need is Condition
(random 1) > 0.5
« Last Edit: 17 Sep 2008, 22:01:12 by Mr.Peanut »
urp!

Offline snozzdog

  • Members
  • *
Re: Random Trigger activation
« Reply #2 on: 17 Sep 2008, 12:54:14 »
Does this work in both single player and mulitplayer?

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Random Trigger activation
« Reply #3 on: 17 Sep 2008, 13:43:09 »
In MP it will not work because each machine will do its own random 1 and each machine will get a different result. If asking about MP you should post in the MP topic. It helps if you are a little more specific about what you are trying to do.

« Last Edit: 17 Sep 2008, 17:24:04 by Mr.Peanut »
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Random Trigger activation
« Reply #4 on: 17 Sep 2008, 14:23:27 »
The more important issue is that if a trigger just has 50% condition:
Code: (trigger condition) [Select]
(random 1) > 0.5
or even
Code: (trigger condition) [Select]
this and ((random 1) > 0.5)
Then it really isn't changing the basic operation of the trigger. In the first case, every 0.5 seconds, it will have a 50% chance to trigger, so it will likely just trigger within the first couple of seconds of the mission starting. In the latter case, it will just trigger within the first couple of seconds after the standard activation (e.g. this being true because OPFOR present).

In both cases, you'd be better just using the standard trigger timeout/countdown values which should be MP compatible already.

I suspect you actually want something else, in which case we need more information on what you are trying to achieve in order to give you the correct answer. Perhaps you want a trigger that only works 50% of the time (so it does nothing at all, half the times you run the mission)?
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline snozzdog

  • Members
  • *
Re: Random Trigger activation
« Reply #5 on: 17 Sep 2008, 15:14:18 »
If im going to give you more info i'll have to explain that its for MP so once again i've posted in the wrong section, so i'd really apprieciate it being moved. Again im sorry for posting in the wrong section, i didnt think it through properly, But anyway.

Im making a Escape and Evade mission for the clan im in to use online. One side is OPFOR the other side is BLUFOR.

OPFOR start in random places around the map and BLUFOR start in bases and have to hunt down and kill the OPFOR before they reach the safe zone (Its pretty good actually). To make it a little easier for OPFOR (cause they are unarmed) i put a few vehicles in every town, but to keep them on their toes i put triggers in each town saying things like "Intelligence reports that men in military clothing have been spotted in blah blah blah" whenever the trigger is activated by OPFOR entering the town.

But what i wanted was the trigger not to always fire because the message is based on them being seen in the town and in reality they wouldnt be spotted 100% of the time, especially if they are crawling through trees nearby at the time they cross the trigger. So i was looking for a way to do the trigger so it doesnt always trigger when people walk into it.



I hope this explains it a little better, thanks.

Snozzdog.

P.S sorry again for the wrong post.


EDIT: Also while im on the subject, about the Safe Zone part where OPFOR enter it, i'd like it to say "'Playername' has reached the Safe Zone" 'Playername' being the name of the person based on their ArmA profile name. If this possible?


Thanks Again
« Last Edit: 17 Sep 2008, 15:17:51 by snozzdog »

Offline Trexian

  • Members
  • *
Re: Random Trigger activation
« Reply #6 on: 17 Sep 2008, 17:00:54 »
Dunno about the playername part, but have an idea for the random thing.

On activation of the trigger, have it call an sqf like "randomMessage.sqf" or whatever you want to call it.

There, you could have something like this.

Code: [Select]
_rndNum = random 1;
if (_rndNum < .5) then
{hint "Civilian says a search party is around."};
Or something like that.

Who is triggering the script?  If both groups are in the same trigger?  Just the OPFOR? Are there really civilians around?

Edit: actually, that's short enough (although untested by me) to probably put in the OnActivation field of the trigger.
Also, you could create an array of messages you want, and have it randomly pick one of the messages.
Sic semper tyrannosauro.

Offline snozzdog

  • Members
  • *
Re: Random Trigger activation
« Reply #7 on: 17 Sep 2008, 17:24:31 »
That looks good, whats an sqf? haha im not sure how to do that, and do these three lines go in the trgger?

The idea was theres no civilians around, OPFOR trigger the trigger and a sidechat radio message comes up on only the BLUFOR's side. So the OPFOR dont know they've triggered it.

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Random Trigger activation
« Reply #8 on: 17 Sep 2008, 17:26:41 »
snozz, trex's advice is not MP compatible.
urp!

Offline Trexian

  • Members
  • *
Re: Random Trigger activation
« Reply #9 on: 17 Sep 2008, 18:15:14 »
Oh yeah... in case you hadn't noticed, I'm MP ignorant at this point.  :cool2:

However, I'm very interested in how to solve something like this for MP. :)

Sic semper tyrannosauro.

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Random Trigger activation
« Reply #10 on: 17 Sep 2008, 18:36:04 »
Yes, Trexian's solution is exactly the same as Peanut's original suggestion, only not as simply implemented.

Now that I've seen your actual problem, I'd suggest something like this:

Activation: OPFOR PRESENT REPEATEDLY
Condition: this
Timing: TIMEOUT 60, 660, 360
OnActivation: player sideChat "Hostiles spotted in Birmingham"

This means they will always be spotted after being in the zone continually for 11 minutes (660 seconds), but any time less than that, between 1 and 11 minutes, they might be spotted or might not, but the longer they stay, the more likely it is. This makes it quite random when they will be spotted, doesn't make it predictable to them when they are spotted and encourages them to keep moving, lest they be guaranteed to be spotted.

Another alternative is to name the trigger "spotter1" and have a gamelogic with 50% probability of presense that has "deleteVehicle spotter1" in its init. This way, the logic is only created half the time and if it is, it removes the spotter trigger entirely. Again, it depends if this suits your mission or not.
« Last Edit: 17 Sep 2008, 18:39:36 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline snozzdog

  • Members
  • *
Re: Random Trigger activation
« Reply #11 on: 17 Sep 2008, 19:11:17 »
Ahhh thanks alot that looks even better than my original idea, i'll try it either today or tomorrow and tell you about how it went. Thanks for going to all that trouble to suss it all out for me.


Cheers, Snozzdog

Offline Mr.Peanut

  • Former Staff
  • ****
  • urp!
Re: Random Trigger activation
« Reply #12 on: 17 Sep 2008, 19:27:31 »
Yes, Trexian's solution is exactly the same as Peanut's original suggestion, only not as simply implemented.
I won't forget this cutlery boy...
urp!

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Random Trigger activation
« Reply #13 on: 17 Sep 2008, 19:35:34 »
It was meant as a compliment, it-isn't-actually-a-nut,-but-a-legume boy ;P
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Trexian

  • Members
  • *
Re: Random Trigger activation
« Reply #14 on: 17 Sep 2008, 20:21:13 »
hehe

By linking to an sqf, I think he'd have more options.

Like, an array of different messages, so when it is triggered, he could get a variety of messages.

Also, modify the random generator by the actual proximity of the searching troops.  So, if they are further away, he is less likely to get the information.

Also, he could build in a directional that suggested where the troops were, with a healthy margin of error, of course. :)

But, I admit ignorance as to how MP friendly or not those kinds of things are.

 :good:
Sic semper tyrannosauro.