Author Topic: Quick Question : RegisterOutput giving bricks position as an argument.  (Read 834 times)

So I have a function that takes a position as it's argument.
And I have this line of code:
Code: [Select]
registerOutputEvent("fxDTSBrick","NoaddAirstrikePlaneClient");That can trigger the event, but how would I get it to pass the bricks position as the first argument of the function?

That event will call the function fxDTSBrick::NoaddAirStrikePlaneClient(%this). You can then find the brick's position with %this.getPosition() or %this.getWorldBoxCenter().

If you make the code registerOutputEvent("fxDTSBrick","NoaddAirstrikePlaneClient", 1); then the function called will also have a %client argument (for something like the client who launched the air strike getting credit for kills made)

Thing is, there is no client activating it, it'll probably be used with onRelay things, also, it dosn't launch a killing attack. So there isn't anyway to pass the bricks position as an argument? How about,
Code: [Select]
registerOutputEvent("fxDTSBrick","NoaddAirstrikePlaneClient", obj.getPosition());. Something like that?

The "client activating it" is passed through any events including ones triggering each other. If you have:
Code: (brick1) [Select]
onActivate -> NAMED BRICK: brick2 -> fireRelay
onRelay    -> Self                -> spawnProjectile [...]
Code: (brick2) [Select]
onRelay    -> NAMED BRICK: brick1 -> fireRelayand click 'brick1', your client will be passed through both 'fireRelay' events and to the projectile one so it can hit people in your minigame etc.

Okay, so If I use the client, registerOutputEvent("fxDTSBrick","NoaddAirstrikePlaneClient", 1); how do I find the position of the brick once the function is loaded. (Being the only argument is the client)

%this.getposition() I assume.

%this.getposition() I assume.

The client's position?
At the very least it'd be %this.player.getposition() ,right?


You can then find the brick's position with %this.getPosition() or %this.getWorldBoxCenter().
"%this" in the function is the brick the event is run on, so either of those will get its position.

Code: [Select]
function fxDTSBrick::AzjAdjSuppliesDrop(%dblock,%num,%client)
{
stuff
....

for(%i=0;%i<%num;%i++)
{
schedule(5600+(%i*40), 0, nopillairstrikeclient, %v,%dblock);
}

schedule(10050,0,messageall,"","Supply drop complete.");

}

I have the above function with the arguments that you can see, the first is a datablock of the item you want, the number is how many to drop, and the client is of course, the client.....

Code: [Select]

function NoPillAirstrikeClient(%obj,%dblock)
{
%cash = new Item()
{
datablock = %dblock;
canPickup = true;

};



%cash.schedule(50,"setTransform", %obj.getTransform());


MissionCleanup.schedule(100, "add", %cash);


}

The above is just another function to add some context.

Code: [Select]
registerOutputEvent("fxDTSBrick","AzjAdjSuppliesDrop", "string 250 250", "int 1 15 6",1);

And I want to add an output even to activate that first function, it has a string for the datablock and the int for how many to drop, as arguments, I also want it to pass the client. I try this but it dosn't work.....

(The above posts thing worked, but this is a new function)

function fxDTSBrick::AzjAdjSuppliesDrop(%this,%dblock,%num,%client)

You should use "datablock ItemData" instead of a string for the item type selecting.

function fxDTSBrick::AzjAdjSuppliesDrop(%this,%dblock,%num,%client)

You should use "datablock ItemData" instead of a string for the item type selecting.

What's %this do? What's that (%this) mean?
« Last Edit: April 03, 2010, 10:45:20 AM by Azjherben »

"%this" in the function is the brick the event is run on
Please try to read what I've actually written rather than just blindly copying down what other people give to you.

Please try to read what I've actually written rather than just blindly copying down what other people give to you.

I've been reading what you're saying, I must have forgotten the below quoted post or something when I said that, that's all.

That event will call the function fxDTSBrick::NoaddAirStrikePlaneClient(%this). You can then find the brick's position with %this.getPosition() or %this.getWorldBoxCenter().

If you make the code registerOutputEvent("fxDTSBrick","NoaddAirstrikePlaneClient", 1); then the function called will also have a %client argument (for something like the client who launched the air strike getting credit for kills made)