#Event Handler Advice Needed
1 messages · Page 1 of 1 (latest)
is "vn_m18_purple_mag" the exact class?
if so:
"vn_m18_purple_mag" == _magazine
if not and you want any class with purple in it:
"purple" in toLowerANSI _magazine
see the difference? in is used for looking IN something, like a string or array or vehicle etc
Yes but to rule it out I changed it to vn_m18 which works with a diferent event handler.
so ill change it back since thats not it
i'm just making sure you understand the use of in vs using a comparison
"apple" in ["pear", "apple", "grape"] // true
"purple" in "vn_m18_purple_mag" // true
"purple" in "VN_M18_Purple_Mag" // false - case sensitive
yeah
I think it makes more sense to use == then because im looking for a very specific class.
Im starting small with the EH but the gist is to have an audio file play for each color of smoke. So for now im just trying to get one working.
remind me what that is again please?
so make an event handler to start. lets do your fired one. and just log what each of the variables are when you do something, like fire or throw something
see what values they contain
etc
Then no I havent done that before.
to further simplify it I changed everything to player
if (triggerActivated ExtractConvo) then {
player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
if ("vn_m18_purple_mag" == _magazine && (player inArea "Grenade_Marker" || player distance markerPos "Grenade_Marker" < 100)) then {
hint "Purple Seen";
};
}];
};
still doesnt work so thats not the issue
question: do hints print on top of each other?
im going to do a hint for my trigger. but i am also using a hint for the EH
like do you even know that A, the event is added, B, that _magazine is even giving you what you want, etc
start logging when you have a problem to find the problem
that way you can start to figure stuff out on your own
Sounds great. I found the file path for my rptfiles. What is diag_log?
Do I run that in the debug console?
anywhere
each time you start the game though, a new rpt file is created
this is where "watching" the file in different editors allows you to keep the active file pulled up
Im browsing thorugh the rpt file. I see CBA debug console
The wiki says diag_log needs an output
yeah you put in what you want to show
so for instance
diag_log _magazine
// or
diag_log str _magazine
and it will log whatever is inside _magazine
at that frame
so do it AFTER what you are trying to diagnose?
depends on what you want to see. in your case, you want to see what the engine is giving you, so before. if you make an edit and want to see if the edit worked, then after
you can even do things like:
diag_log format["The magazine stored in _magazine is %1", _magazine];
or
diag_log format["[%1] ?= [%2] - %3". "vn_m18_purple_mag", _magazine, "vn_m18_purple_mag" == _magazine];
// will output - ["vn_m18_purple_mag"] ?= ["vn_m18_purple_mag"] - true
// if it was the same
its probably a class name, might not even have the word magazine in it
add some text with format to give something you can search
or you can use systemChat if you want during the game to see, that's an option too but its not copy paste friendly
btw, i would just check to see if the magazine exists in the area you are wanting the grenade thrown instead of doing an event handler
Inside of a trigger:
player in thisList && "nv_m18_purple_mag" in thisList
or
[player, "nv_m18_purple_mag"] findIf {!(_x in thisList)} == -1
might need to use the ammo class instead of the magazine class, but worth a try
Whew my brain is fried. I've been work on this mission all day. I will revisit this issue tomorrow with fresh eyes and a better attitude. And I will try your suggestions above as well. The only reason I am trying an EH is because I already have a working one that someone helped me with a year ago and I thought it would be easy to reconstruct for my new idea. LOL.
I tried these a few times and couldn't get them to work. The closest I got was to get player in thisList to fire but only by itself. Would it be better to place them in a if then anyways since I need to fire a system chat based on the color of nade?
Anyways, after messing with the EH for a few hours I got it working. I only got like 1.5 weeks left before work starts up again and my time will be limited so I'm gonna move on the next problem in the mission. At some point I will circle back to these because they seem simpler to understand.
@rocky scaffold sorry bud I passed out after work last night. I'm off today but my computer is apart so I can put my led system together on the desk. I'll be able to help tonight tho.