Passing a random player on bosses hate list to another npc?
Can this be done?
I have 4 mobs which im going to have cast a spell at random times between every 60 - 120 seconds. I want them to cast them on random targets on the mobs hate list. Im not too sure how to go about doing that. This is the code for the mobs which will be casting the spells. I assume ill use GetHateList(); on the main mobs script when hes attacked or? Im not sure how I would store the hate list, ive never done much with arrays ect.. I assume how it would work is get the hate list and store each person on it as a variable, then randomly pick a variable each time the timer triggers and have the mob cast the spell on that person Any help will be appreciated Code:
##Child of Laiboch |
Would this be on the right track
Code:
sub EVENT_ATTACK { |
Actually, there is a Mob::GetHateRandom()
|
What Joligario says is the best solution. Get your npc with the entity list and hate random.
That said here is some quick untested code for manual hate list manipulation... Code:
#hate_clone(npc1, npc2) = npc2 gains npc1's hate list |
I've also used signals before. On your mob with the hatelist, he can select the random player, and then send the name or id to one of the other NPCs. Then that other NPC would add that player to his own hatelist.
|
Quote:
what are $cloned and $other? |
$cloned = $npc1 (npc you're cloning hate from)
$other = $npc2 (npc you're cloning hate to) |
ok, what event would i put that in?
I see you define your own sub, i didnt even know you could do that also does the npc getting the list automatically set a target? Like would this be the correct usage Sorry for being dumb, i cant exactly tell whats going on in the code. Not sure how i can then use that code to get a target in the hatelist on either the npc with the hatelist code or the casting npc. Would you guys be able to explain your sub better or help me do it an easier way with getentity list and randomhate? Code:
sub EVENT_TIMER { |
Sorry im just confused the hell out of :(
|
It was mostly used as an example of how to manipulate the hate lists. To give an idea of how to do what you want to do that way I still suggest Joli's idea.
Ex: Code:
#find npc of npc type 123456 |
Quote:
Code:
sub EVENT_ATTACK { |
Try something like this, where 999424 is the NPCID of your main boss, which I assume is named Laibach. This script would be placed on each of your add NPCs. This assumes that they are attacked as well, to trigger this event, otherwise you can just signal them from your main boss to trigger this same bit of code instead.
Code:
sub EVENT_ATTACK { |
Quote:
the other mobs are immune to melee, only damaged by spells |
Personally, I like to run everything from 1 NPC so there is less scripts involved, but sometimes that can get a little tricky and it is probably best for you to start off as simple as possible until you are comfortable moving to more complex stuff.
To run it all from the boss, would take a bit more information. But, a simple example would be like this: Code:
sub EVENT_ATTACK { |
Quote:
thanks trev oh what if they have the same Id? its based off of one mob i made multiple spawns of, just use the one Id then? Also does that update each time he is attacked or only the first attack? If its just once, ill have to figure a way to maybe work a timer in, so it selects new random targets every so often |
All times are GMT -4. The time now is 03:48 PM. |
Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.