Advertisement

Author Topic: Flashlight signalling (ACCEPTED)  (Read 1336 times)

0 Members and 1 Guest are viewing this topic.

Offline Homer Johnston

  • Members
  • *
Flashlight signalling (ACCEPTED)
« on: 17 Feb 2009, 21:46:41 »
Hi there guys, my first post here. Here's something I've been making for my mission, I thought I'd share it here to see what happens :whistle:

It is for multiplayer, to allow players to communicate via rudimentary "flashlight signals". It was made for a mission where all players are separated and must regroup without using global and side channels, or their maps.

Usage should be self-explanatory, once you preview it in the mission editor on Rahmadi. There is 2 playable slots - If you can, test it with a friend!! Otherwise, the mission includes radio triggers that simulate the other AI player "sending" a signal. I am not sure if it works on Listen servers and do not have the means to test that at the moment -- it may only work on a dedicated server.

I would love any input, suggestions on how to improve it, hate mail, anthrax scares etc.!

-HoJo

[edit] fixed issues mentioned by Worldeater, and added a pbo version to use in MPMissions to test with one other player.

OFPEC DOWNLOAD
« Last Edit: 10 Aug 2009, 17:48:41 by hoz »

Offline Worldeater

  • Former Staff
  • ****
  • Suum cuique
Re: Flashlight signalling
« Reply #1 on: 17 Feb 2009, 22:34:05 »
Haha, great idea! :clap:


Things you should check:
- DoFlash.sqf uses the object variable "HoJoFlashColor", the other scripts use "HOMJ_FlashColor"
- The actual color of the users flashlight is hardcoded to white in DoFlash.sqf


try { return true; } finally { return false; }

Offline Homer Johnston

  • Members
  • *
Re: Flashlight signalling
« Reply #2 on: 17 Feb 2009, 23:06:12 »
Oops - thanks. Oversight whilst trying to change everything to OFPEC tags...

And the color ... another oversight after I decided to add color filters (originally it was only going to be white) :D Unfortunately it is almost impossible to tell what the color is (ArmA's limited light engine...) and I'm curious if there is a good tweak for that.

nice job and thanks for spotting these - wouldn't have worked in MP otherwise! Both fixed, and upload updated...

P.S. I'm also curious if there are any better objects for the drop command, or methods in general, to emulate the flashlight ... there's some sunflares and such in Addons\Ca.pbo but they won't load with the drop command >:(
« Last Edit: 17 Feb 2009, 23:09:32 by Homer Johnston »

Offline hoz

  • OFPEC Site
  • Administrator
  • *****
Re: Flashlight signalling
« Reply #3 on: 17 Feb 2009, 23:09:14 »
Can the AI use it? Can you setup the AI to flash some signals at you? I haven't tried it and won't likely get to it till later.
Xbox Rocks

Offline Homer Johnston

  • Members
  • *
Re: Flashlight signalling
« Reply #4 on: 17 Feb 2009, 23:11:26 »
For viewing how it looks - yes. How it works:

when "you" send a flash, you give PublicVariable [stuff] ... other players run a script when [stuff] changes, displaying the flash on their PC.

The included mission has radio triggers which execute the necessary scripts for an AI player to "send" a flash.

[Edit] I'm not allowed to doublepost even after 3 days? :D I have a question: I need to include a transparent screen overlay of the signals, present for the whole mission. I'm fairly new to advanced description.ext editing. I don't know what method I should look into to do this - I can't use a "dialog" for this, because they lock the player's controls. I'll be searching around hoping to find a method but if anyone can speed up the process it'd be awesome.
« Last Edit: 20 Feb 2009, 08:32:55 by Homer Johnston »

Offline Mandoble

  • Former Staff
  • ****
    • Grunt ONE and MandoMissile suite
Re: Flashlight signalling
« Reply #5 on: 20 Feb 2009, 21:18:05 »
Use a title or cut Rsc, check this as example.

Offline Homer Johnston

  • Members
  • *
Re: Flashlight signalling
« Reply #6 on: 20 Feb 2009, 22:25:29 »
Fantastic, never would have occurred to me I could simply "store" the overlay off-screen too.

Thanks Mandoble...

Offline Spooner

  • Members
  • *
  • Mostly useless
    • Community Base Addons
Re: Flashlight signalling
« Reply #7 on: 21 Feb 2009, 14:55:44 »
Aha, someone implementing an idea I had a long time ago and never got around to. Always good to see, since it saves me the effort :whistle: If only more people could do that, my life would be a lot easier!

Since you are pre-compiling your functions, you might as well also pre-compile your event handler:
Code: [Select]
HOMJ_ShowFlash = compile (preprocessFileLineNumbers "scripts\Flashlight\HOMJ_ShowFlash.sqf");
"HOMJ_FlashSender" addPublicVariableEventHandler { (_this select 1) spawn HOMJ_ShowFlash };
(the second value _this array is the value that was passed via the event handler).

If your HOMJ_GetPosture is better than Mando_getpos, then you should either submit it yourself or, since Mandoble is still active, as a bug-fix to Mandoble himself. You could even bug him to rename the function as getPosture, since that is considerably less confusing than calling it getPos ::)

Don't make HOMJ_FlashColor an object variable on the player, since the value will be lost when the player respawns. Instead, just use a regular (non-public) global variable which will then be client, rather than player-object, specific. This will also overcome the JIP issue you have now (since in JIP, you will attempt to set a value on the player-object which isn't created at the start of the mission, when init.sqf is run, for jippers).
« Last Edit: 21 Feb 2009, 14:57:56 by Spooner »
[Arma 2] CBA: Community Base Addons
[Arma 1] SPON Core (including links to my other scripts)

Offline Homer Johnston

  • Members
  • *
Re: Flashlight signalling
« Reply #8 on: 22 Feb 2009, 01:58:06 »
Interesting Spooner, thanks very much for the tips! I'm still learning the gist of some of these more advanced scripting doo-hickies...

Have not updated the attachment yet, hopefully later tomorrow. I've also made it leave an overlay on your screen when you close it now (optionally) in case the user can't memorize the signals easily enough. I plan soon to have it alert the AI, but I don't know if I can do much as the reveal command simple doesn't "reveal enough" (1 out of 4...).

Also kind of forgot that I modified Mando_Getpos -- as I think I commented in it, I needed it to work up inside buildings, so I had to toss in a couple extra lines of code involving the modelToWorld command ... if Mando updates his function then I will rip out my hacked version and put the new "official" one in.

Cheers.
« Last Edit: 22 Feb 2009, 02:03:32 by Homer Johnston »