Author Topic: [SOLVED] How to Reference the Brick an Event was Called From?  (Read 874 times)

So I have one output event and two input events defined like this...
Code: [Select]
function Player::loadClass(%this) {
if (...) { // If player has selected a class
// Load class...
%brick.processInputEvent("onClassLoadSuccess", %this.client);
}
else { // If player has not selected a class
%brick.processInputEvent("onClassLoadFailure", %this.client);
}
}
registerOutputEvent(Player, "LoadClass");
registerInputEvent(FxDTSBrick, "onClassLoadSuccess", "Client GameConnection");
registerInputEvent(FxDTSBrick, "onClassLoadFailure", "Client GameConnection");
(To be clear, I mean "class" as in "Medic" or "Soldier", not an object class.) My problem is that I don't know how to find %brick, the brick that LoadClass was initially called from. What's the cleanest way to find %brick?
« Last Edit: December 25, 2017, 02:43:51 AM by Platypi »

make your event for fxDtsBrick object type, and require client var to be passed in to get the player object from it.

make your event for fxDtsBrick object type, and require client var to be passed in to get the player object from it.
Yeah, I guess that works. Feels a bit messy... but whatever. Probably the easiest way to do it.