Author Topic: Client Relays. NEED BADLY.  (Read 924 times)

I really need this. Client relays. Instead of firing the relay to the brick (one player per brick) it fires a relay to the client (unlimited players per brick). I need this for an upcoming hunger mod I am making completely out of events. Please, it shouldn't be that hard. I really need it.

There's a reason they aren't there.

Not only are there ways around it, but:

There's a reason they aren't there.

There's a reason they aren't there.
Nice of you to tell the reason.

onActivate Client fireRealy
onRelay Client (something)
onRelay self fireRelay

No, I don't want client to be part of the list after OnRelay. Maybe a custom target like ClientRelay that just has the output FireRelay, along with CenterPrint, BottomPrint, and ChatMessage. I just want each client to have their own relay, so I can use the following:

0         OnMinigameJoin:Client:FireRelay
30000 OnRelay:ClientRelay:FireRelay
0         OnRelay:Self:VCEModVariable[var:cl:hunger] - [1]
0         OnRelay:Client:ChatMessage[<color:ffff00>Your hunger dropped! You are now <var:cl:hunger>/6 full!

There's several ways to do this:

Use relays and printCount underflows/overflows:

onActivate -> self -> fireRelay
onRelay -> self -> decrementPrintCount -> 9
onRelay -> self -> decrementPrintCount -> 1
onRelay - > self -> fireRelay
onPrintCountUnderflow -> self -> centerPrint -> HI


Or just use print counts (better):
onActivate -> self -> decrementPrintCount -> 9
onActivate -> self -> decrementPrintCount -> 1
onPrintCountUnderflow -> self -> decrementPrintCount -> 9
onPrintCountUnderflow -> self -> decrementPrintCount -> 1
onPrintCountUnderflow -> self -> centerPrint -> HI

Just make sure that there's a delay when decrementing the printCount again.


Also, printCounts and relays pass ownership. That means that if someone activates a brick, the events are owned by them.


Whups, one more thing. If you use purely print count loops, more than one person can have an event loop on the same brick. However, it's not guaranteed to work. As long as you have a decent loop delay (like 15 secs), that problem probably won't come up.
« Last Edit: February 01, 2011, 01:54:45 PM by Snaily »

yay for print loops :D
also, do you guys mind not using the same avatar? at first i though you were chrono, and so i was wondering why you didn't make it yourself

also, do you guys mind not using the same avatar? at first i though you were chrono, and so i was wondering why you didn't make it yourself
I like fluffy Hype Dog :C

I like fluffy Hype Dog :C

No. Excuse. I'll repeat the quote as it's exactly what I thought:

also, do you guys mind not using the same avatar? at first i though you were chrono, and so i was wondering why you didn't make it yourself

So change it before you get into actual trouble for confusion. Seriously, I read this topic like "The forget? When did Chrono become handicapped and wishing for abusive scripts he could make himself in the first place?"

Change your avatar you poo.


As you're using VCE, dont bother with Print Loops. Although they work well enough, I dont trust them.. Instead use the following:

Code: [Select]
OnActivate > Self > VCE_StateFunction > [<var:client:BL_ID>] [ ]
OnActivate > Self > VCE_CallFunction > [<var:client:BL_ID>] [ ]
OnVariableFunction > Self > VCE_CallFunction > [<var:client:BL_ID>] [ ]
OnVariableFunction > Client > VCE_ModVariable > [hunger] [-] [1]
OnVariableFunction > Client > CenterPrint > [<color:ffff00>Your hunger dropped! You are now <var:cl:hunger>/6 full!]

As long as you only have one function on the brick, it will work for unlimited players, because each player has his/her own function named as their BL_ID. The only problem with this is if two or more people with the same ID join..

Also, the reason why relays can't be used for this isn't because they can only hold one ID, or whatever. But its because relays 'Overwrite' each other. Basicly, if a relay is going to be fired in 3 seconds, but someone fires a relay onto the brick, then the current relay being fired will be canceled, and started from the other person. If you're clever enough you can use this to make temporary pauses for relay loops. Just make a relay that fires quicker than the one you wish to delay, to target the relay loop. Although it is easier just to cancelEvents, then fire a relay once its done, that can cause other events to mess up on the brick. Therefore this method is quiet useful. Think as it of a way to cancel the relays on a brick without damaging anything else.