Member
Last active 6 years ago
@SavageCDN Thanks added to wiki
http://alivemod.com/wiki/index.php/Script_Snippets#CBA_Eventhandlers
Thank you all, wish I had a better solution to the problem but I'll investigate it deep in hope of finding another solution without the use of the headless client.
I'll stay in touch once I know more.
Honestly, I have no clue why this issue even happened but somehow I got it to work, in case anyone else has the same issue use this code below and it should work perfectly after just change the function to your script or function depending on how you build your mission.
P.S I currently use headless client and that is what it is working for, can't confirm that it is working without it right now.
if !(hasInterface or isServer) then { ["All", "Hit", {_this call alive_fnc_handleHit;}] call CBA_fnc_addClassEventHandler; ["All", "Killed", {_this call alive_fnc_handleKill;}] call CBA_fnc_addClassEventHandler; } else { ["CAManBase", "Fired", {_this call alive_fnc_handleFired;}] call CBA_fnc_addClassEventHandler; ["CAManBase", "Respawn", {_this call alive_fnc_handleRespawn;}] call CBA_fnc_addClassEventHandler; };
@marceldev89 I might be reading this wrong but the event does actually fire but the code it executes gives an error, correct?
If you talking about the last post I did yes, but I figured out the issue. Somehow when it fired the event the data transferred from the code was an array, easy fix. I'm attempting right now to get the event handlers to work based on the initPost function.
I simply just did a diag_log to see if the initPost is being executed on each unit that is spawned on the server and it seems to work so far.
@SpyderBlack723 Just to confirm information:
Have you tried with CBA / ALiVE only?
Have you tried replacing your script/function with a super simple hint just to see if it gets called at all?Otherwise I think I pass the baton to @marceldev89 because he isn't busy enough.
1: No, will do that in a bit working on another way to kinda inject it into each unit that is being spawned.
2: Yes, just to be on the sure side I run a simple script with just a hint stating what event fired, I got both hit and kill events that aren't working any of them.
Executes correctly when any unit is being spawned attaching the event handlers to it.
["CAManBase", "initPost", {_this call alive_fnc_setupEVH},true,[],true] call CBA_fnc_addClassEventHandler;
This is the problem right now (currently tested this only with headless client, going to do a separate test in a bit to see if it does any different which I doubt it would as it only outputs the player as the unit assigned to call the function from above.
diag_log format["Assigning Events to data: %1", name _this]; // Giving this error, Error in expression < format["Assigning Events to data: %1", name _this]; diag_log format["Assigning Events to data: %1", name player]; // Works but only outputs the HC and not the rest of the players/units spawned on the map
@SpyderBlack723 I doubt it's causing your problem here, but its convention to use a class to separate your eventhandlers by mod
class Extended_Hit_EventHandlers { class CAManBase { class your_mod_name { hit = "_this call custom_fnc_handleHit;"; }; }; };
Sorry for the late response kinda took a break from scripting, anyhow I tried the way you recommended, for several mods. I've tried changing CAManBase as well (Man, All, etc), the only way I got it to work so far is by spawning the AI from Zeus.
This issue kinda is the same as when I used the headless client, bots controlled by system or addons such as ALiVE and headless client doesn't seem to want to work. I have been looking into a different way by making a script that loops through all bots lets say every 10-15 seconds and then attaches the event handler at that point to the AI itself this would technically work at all time no matter if u use headless client or not.
The problem is I do not really know how I would loop through the bots at all time, the best way would be if you could call when a unit is created in which it wouldn't be such a heavy performance hitter with massive loops all the time.
If anyone wants to help me out, feel free giving me suggestions or what to do, otherwise, I'll have the end result with the source code here if anyone wants it.
Aight so I've been trying to start my server since yesterday and for some reason it keeps crashing/freezing at the same log entry all the time.
ALiVE_sys_acemenu: ACE interact_menu not active or no interface found, exiting
Please anyone help me, not sure if it's ACE or ALiVE I assume it's alive since it's an ALiVE_sys_acemenu
@SpyderBlack723 I doubt it's causing your problem here, but its convention to use a class to separate your eventhandlers by mod
class Extended_Hit_EventHandlers { class CAManBase { class your_mod_name { hit = "_this call custom_fnc_handleHit;"; }; }; };
Oh I never knew about that, cheers man I'll give it a test and come back with the result shortly!
Hi there, about 7 months ago I created a topic related to event handlers and I recently just got back to the alivemod again. I've got some event handlers going and when I'm testing it on my local machine it works just fine but not when I move it over to my dedicated server on a different machine. I've tried different ways and as far as I got it to work and find what the problem is, and it something with alive that I've missed or are not understanding, because any AI's spawned from the alive modules aren't triggering the event handler, however, if I spawn an AI from Zeus it works just fine without a problem. Anyone got any ideas on how to resolve this?
description.ext (I've tried switching CAManBase to Man and All and still no change, I mean it works just fine on my local machine)
class Extended_Hit_EventHandlers { class CAManBase { hit = "_this call custom_fnc_handleHit;"; }; };
fn_handleHit.sqf (Just as a test to see if it's being triggered or not)
params ["_unit","_causedBy","_damage","_instigator"]; hint format ["Triggered\nUnit: %1\nCausedBy: %2\nInstigator: %3", name _unit, name _causedBy, name _instigator];
Hi there,
I'm trying to convert some data via the JSON functions that comes with ALiVE which then should be able to be read through my website. Anyhow, for some reason I seem to not be able to create the JSON elements with both key and values, been reading through the functions itself on the GitHub page just to figure it out but no joy.
Anyone here that might be able to help out, this is the code that I have so far just as a test so I can figure it out
_map = ["", "new"] call ALiVE_fnc_unorderedMap; [_map, "insert", ["key", "value"]] call ALiVE_fnc_unorderedMap; _test = ["", "encode", [_map]] call ALiVE_fnc_JSON; diag_log format["%1",_test];
Need the code to be output as
{ "key": "value" }
the closest I got was the return of
{ "value" }
Hopefully, someone can share some light with this functions, been trying to wrap my head around the functions for a while now and I still can't seem to get it to work correctly.
@HeroesandvillainsOS MediumMGCamp3 remove it. Delete and replace. Don’t put it back in there. It should load.
Wow, the fact that I missed that part is unreal, really though thanks that will really help me with my previously working missions.