![]() |
triggeraction vs player.trigger
Here's the thing - I really, really hate the triggeraction(targetx+1.5,targety+1.5,hit,2); technique. What happens if the target's lagging? What happens if he moves between the point that you had him lined up in your sites and took the shot and the point that the action triggers on his spot?
And yet I find myself with a script that's almost finished - except that the previous scripter used triggeraction. I've got a whole beautiful (not elegant, I don't do elegant) subroutine for detecting which players are about to get hit and storing their names, and I've got a whole beautiful loop for picking each one and hitting them...but because I'm not writing (guessing) it Exactly Right, it doesn't do a damn thing. Here's what I got: PHP Code:
PHP Code:
|
Why are you naming your weapons with a # in front of them, anyway?
Have you debugged and made sure that you're actually reaching the player? It looks like those should work. Are you getting any errors in NC (e.g. can't access private function)? If you want I can get on Testbed or wherever you're doing this and try to help you out. |
I inherited the # signs. Not a lot I can do about it. Got sure I can find it (I forgot some little subroutine to make sure the player was getting called), then the guy I was testing with got quietly kicked offline. Right now I got
PHP Code:
PHP Code:
|
Clientside to clientside triggeractions only work for a certain distance.
If you're trying to make a sort of long range hit detection you may want to change your methods (such as storing the data in attr or anis). |
Quote:
... ... ... Thanks, that's great. Hooray Wiki. -_- Does the old trick of setting a weapon's x and y work? Or is it a fixed distance from the player? Or is a weapon's x and y static? |
Quote:
|
Suggestion: Join the player to a class, then you can call a public function.
PHP Code:
|
Might do that, the players already join a class; would that trigger function on doDamage(){, function onDoDamage(){, function doDamage(){, ? The "on"s always throw me.
|
Quote:
PHP Code:
|
kkthxz. :-D
|
Quote:
|
Quote:
PHP Code:
|
Quote:
|
Event function names are prefixed with "on" and trigger() is triggering an event, same with scheduleevent().
I also find "doDamage" a silly function name, "damage" works fine. |
Keep in mind that triggers are considerably slower than direct public function calls. However if you do not need quick response time, triggers/events are much more useful, especially because of the interface they provide with functions such as catchevent.
|
It's resolved now, but could you geniuses (not intended sarcastically) give the wiki a page on the modern communication styles? I think the last time I checked it just had a GS1 "triggeraction x, y, name, params;" page. :-P
And yeah, I like the aspect of triggers that is "Mail this data to this player and get on with your life", I just can't stand the "Throw a dart at the board and hope it hits the right player, and you can put the target's name in the parameters and check to make sure the target's right and dismiss it if it's wrong, and maybe you can have the wrong-target forward it to the right-target but there's no guarantee" aspect. I mean, what if jailing scripts had to take the account named, get their X and Y, and trigger on those coordinates iff you're within 6 tiles?! Madness. |
Quote:
|
| All times are GMT +2. The time now is 04:48 PM. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
Copyright (C) 1998-2019 Toonslab All Rights Reserved.