Time Based Spell Bonuses
I'm trying to set up time and weather based buffs that are automatically cast on the player as the time and weather change.
I'm starting simple, just to get a feel for how this is scripted and how it works, but the method seems to be eluding me. Here's what I've got in the player.pl file in one zone currently, just to test it - when I have the script working, I'm gonna move it into global_player.pl I've currently got this set to (when it's working) cast on the player every time they zone, but what I *really* want is for the daytime buff to cast when it hits daytime, last until night, and then the nighttime buff is cast and overwrites the daytime buff. But I'm starting small, just to get a grip on this. Code:
sub EVENT_ENTERZONE{ |
[quote]
Code:
sub EVENT_ENTERZONE{ |
Why is that? How can I correct it?
|
To be more specific, you need to use logical and (&&) here instead of or.
|
Something like:
Code:
if ($zonetime > 599 && $zonetime < 1900) { |
Thanks for the help, that works perfectly for sub EVENT_CONNECT but I cannot seem to get it working for sub EVENT_ZONE or sub EVENT_ENTERZONE sadly.
|
I tested in tutorialb on player.pl in EVENT_ENTERZONE just fine, but my code is forked off of June 2014, though doubt that would make a difference ( i guess it could, but that would be bad if so)
Also, need to consider that you would need some kind of logic to turn the daytime buff off and replace with the nighttime version and vice versa, these would only run once (but as you said, start small) As for your final version may want to do it in the BuffProcees() function in zone/spell_effects.cpp although it could be done many ways I suppose in perl. Ill try to put something like this together in c++ this weekend if I get the time (on-call for work, so no promises) I already do custom buffing ala eq2 in the BuffProcess() function myself. As for your issues with EVENT_ENTERZONE, could you post your script for that? Curious why it works for me but not you (code differences notwithstanding) |
rencro, that would be FANTASTIC if you would take the time to code that for our server. I will indeed need some way to turn the daytime buff off and replace with the night buff, but hadn't gotten that far in my own thinking yet.
Code:
sub EVENT_ENTER_ZONE { |
You have an underscore between Enter and Zone, ie EVENT_ENTER_ZONE instead of EVENT_ENTERZONE more than likely from your testing going back and forth between settings.
|
That fixed it, rencro! Thank you!
Now just to figure out how to make the night spell overwrite the day spell, and vice versa. Looking into this now! |
This is my first attempt at trying to cancel the daytime buff if the player zones and it is nighttime. Seems to have broken the entire script. Continuing to try and solve this...
Code:
sub EVENT_CONNECT { Attempt 2 Code:
sub EVENT_CONNECT { Attempt 3... if someone could gently nudge me in the right direction (or crudely beat me over the head with it) that would be awesome.. Code:
sub EVENT_TIMER { I should note that in this last attempt I am simply trying to change the night time message to trigger in a different fashion so I can then insert the buff removal code once I see that it's checking a specific time and not just going by an else statement |
Code:
sub EVENT_CONNECT { |
You shoulnd't need to do another time compare because if its not daytime, then an else means its gotta be dark
On attempt two, there is an error with the if statement Code:
sub EVENT_CONNECT { Code:
sub EVENT_CONNECT { |
Thank you! Got it working now, and now I understand WHY and HOW it works, most importantly!
|
I'm testing this is both BuffProcess and in BuffTic by creating a new SE_TimeOfDayBuff, not sure which would be better but this could all be done from perl by I guess having a timer constantly running on player zonein that checks the status of the buff on said player and, if the time changes while they are still in zone, to fade one and apply the other. Just dont know how "expensive" that would be having all these timers running in perl. Maybe Kingly Krab or Akka can chime in and help you there, as they definitely have perl grasped far better than I.
But Im intrigued by this idea and will keep working on it in c++. The problem if you apply a c++ solution is you will have to maintain(merge) it any time you decide to upgrade the server source. |
All times are GMT -4. The time now is 01:01 PM. |
Powered by vBulletin®, Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.