reset issue?
Alright, after a year or so absence, I try to dive into scripting and I realize I forgot way too much.. and didn't know a whole lot before I quit! =P
After a few hours of VARIOUS testing, I'm stumped.. A little help would be awesome! Basic idea of event 1 - spawn mob 2 - 1 add spawns on aggro, and more every 25% 3 - if he or one of the adds kills a player, an add will spawn 4 - once main guy dies, everything else despawns, if still around I have found 2 problems so far.. play testing on a monk, if I spawn the adds, and FD, the "$npc->SetHP(2500);" will heal him back to full, but it won't reset the hp event - no more adds until the next hpevent(x) is met.. is there a way to reset this maybe? Also, for the life of me, I can't get timers to work.. I would like for him to despawn after so many minutes of no aggro.. This is the base code now, took the timers out obviously because I can't remember for the life of me how to get these to work properly.. =\ Code:
sub EVENT_SPAWN |
First, I am not sure if your HP event 100 would do anything, though I would need to test to verify that. I think you would need to start at 99 or so for it to trigger. Next, when you reset the event and set the HPs, you also need to set the HP event back to the one you want to trigger first again with "quest::setnexthpevent(xxx)". Also, it looks like you are checking if "$combat_state = 1", which is wrong for 2 reasons. To do a comparison, you need to use == not =, and you should be checking for combat state 0, not 1, as 1 is for when combat is started and 0 is for ended. Last, timers are pretty simple, you just need to set the timer in your EVENT_COMBAT where you set the HPs back to 100%. Then, check the timer in EVENT_TIMER and do a depop. There are lots of timer examples on the forums, and explanations in the wiki if you need help with that. Otherwise, post what you have for timers so far and we can tell you what you are doing wrong.
|
Well, as it was up, it was working fine at hpevent(100), but I changed it anyway to 95.
As for the 2 mistakes.. yeah, I really don't know how I got turned around in there.. I had changed that portion of the code about 20 times using timers, I must have missed them both (rest of code uses == like it should =P ) I read a few examples, as well as the wiki regarding timers.. And I know I had them figured out and working last time I was messing around with scripting, but it seems I've drank too much in the past year maybe? =P But, after using a few examples here on the forums, I threw this together real quick (and yet, I don't really see any mistakes), but it doesn't work.. (short timer for easy testing) Code:
sub EVENT_SPAWN |
Quote:
The EVENT_SLAY I would think is confined to the boss itself, since the script is the boss's script, no? Don't know for sure, I'm here for injection in case it may help, but, definitely here to learn as well (and since I'd like to know the exact solution to the OP's question as well there is no point in me making a new thread). IOW's please don't see this as a hijack what-so-ever, as that is far from my intent. :) *Edited - Yes, I read OP's #3 if a spawn was killed it would spawn another. Not quite sure how I did, but I did. Going back to my safe little cubby now, I'm apparently in no mental status to try to comprehend at the moment. <grin> Sorry OP. |
Quote:
|
Lol, no worries man.. I think my mental state is a little fubared as well - this script should be an easy one but it's kickin my ass =\
|
Quote:
Also the final HP event is redundant as it will be caught by the death event. You should also consider using $npc->GetX(), etc(or $npc->GetX() -5, if you want them to not spawn directly on top on the main mob) for the location of the spawned mobs or leash the main mob or the player can just pull the mob away from that loc and the adds won't agro. |
Yeah, I wasn't sure about the final hpevent, but read somewhere it was required.. hadn't actually tested it, but I know without the sub EVENT_DEATH part, he wont despawn the adds or do his shout.. I'll throw the final hp event out and see how it goes..
I have the mob perma rooted, and summons.. adds aren't permarooted though.. Since the subject came up, anyone know how you would go about summoning the adds that pop on kills, on the killed player's corpse loc? |
Keep the death event, lose the final hp event.
source: Code:
parse->EventNPC(EVENT_SLAY, killerMob->CastToNPC(), this, "", 0); |
The timer looks fine as far as I can tell from a quick review. Maybe add in a shout before the depopalls for debugging purposes so you can see if the script is making it to that point or not. Adding debugs throughout a script that is giving you trouble is a good way to tell if anything is wrong with it. You can add a shout (or whatever message) before and after any section of the script so you can see exactly what is happening at each step. It is also good to put the variables you are using or expecting into the debug messages so you can make sure they are being set as you expect (such as $timer).
|
If you're still using the code in post #3, it looks like you have your combat states reversed.
|
Sigh, work sucks..
I'll try your debugging Trev - and I feel much better knowing that the code "looks fine" cuz I couldn't see any problems with it either haha.. Also, thx Caryatis! Once I get the rest of this crap fixed, I'll add in the killed player code.. =) Will let ya guys know if I get it all figured out |
Thanks Trev for the debug input =D Got it figured out.. and to be honest, I don't really know what it was =P
Now, to tackle the pc-dying-spawning-mob part =) Thanks guys! I'll post here if I have any issues or questions *Edit - was gonna post code but not gonna =P |
All times are GMT -4. The time now is 07:57 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.