Mob cast

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
7 months 3 weeks ago #7943 by JTP
Mob cast was created by JTP
Hi

Ok i know How to get a mob to cast a spell in fight.

But If i wanted a mob to always have a spell on, How would i go about doing that with a trigger ?
So when the spell runs out, it recast it. Or If dispelled it recast it.

Please Log in or Create an account to join the conversation.

  • lacrc
  • lacrc's Avatar
  • Away
  • Senior Boarder
  • Senior Boarder
More
7 months 3 weeks ago - 7 months 3 weeks ago #7944 by lacrc
Replied by lacrc on topic Mob cast
Hmm, I don't think there's a "affect" type of trigger that constantly checks affects and is fired when they change.

But I think it's possible to make a 'random' type trigger that fires every X minutes and checks if the affect is in place and acts accordingly.
According to the documentation if you set a 'random' type trigger's Num Argument to 20, it should fire about every minute (got that from here: dgscripts.tbamud.com/index.php?page=trigtypes&type=mob )

Then the script would be something like:
# Replace <SPELL> with Spellname
if !%self.affect(<SPELL>)% 
    dg_cast '<SPELL>' %self%
end

Would that work for you?

EDIT: Just realized you said "in fight" so you would need to add a check to the fighting variable:
Not sure if %char.fighting% or %char.pos% is more suitable here, maybe someone can chip in.
With fighting:
if (!%self.affect(<SPELL>)% && %self.fighting%)
    dg_cast '<SPELL>' %self%
end
Or with pos:
if (!%self.affect(<SPELL>)% && %self.pos% == Fighting)
    dg_cast '<SPELL>' %self%
end
Last edit: 7 months 3 weeks ago by lacrc.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
7 months 3 weeks ago #7945 by JTP
Replied by JTP on topic Mob cast
Atm i have it set as fighting.. but i would like it to be always on.

Thoug If dispelled it would be cool it it waited alittle before recast.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
7 months 3 weeks ago - 7 months 3 weeks ago #7947 by JTP
Replied by JTP on topic Mob cast
if !%self.affect(spellname)%
dg_cast 'spellname' %self%
end

when mob loaded it after alittle cast the spell, but it didnt show any message that the spell ran out, and it took alot of time before it recast it :(
Last edit: 7 months 3 weeks ago by JTP.

Please Log in or Create an account to join the conversation.

  • lacrc
  • lacrc's Avatar
  • Away
  • Senior Boarder
  • Senior Boarder
More
7 months 3 weeks ago - 7 months 3 weeks ago #7948 by lacrc
Replied by lacrc on topic Mob cast
Oh sorry, I think I should've elaborated better, according to the link I sent earlier from the documentation:

Since random triggers fire every 13 seconds you can set how often the trigger fires by modifying numeric arg to the following values:

1% = about 22 minutes
2% = about 11 minutes
5% = about 4 minutes
10% = about 2 minutes
20% = about 1 minute
50% = about 26 seconds
100% = 13 seconds

Once you reduce the numeric arg below 100, because the numeric arg equates to the chance that the trigger will fire, the above timings are an average. It is possible that even at 1%, the trigger will fire twice, 13 seconds apart.

The actual equation is 100/numeric arg X 13 = time in seconds.
For example, 100/20 X 13 = 65 seconds

So, the Num Argument is the chance of the trigger firing, not the actual time for it to fire, but you can get the average chance of it firing by calculating the equation as mentioned (since it fires every 13secs using 50% chance would be 26 secs in average)

EDIT: You COULD control the timing by setting the chance to 100% and using a variable remoted.
Something like:
# First let's make sure the variable exists
if !%actor.varexists(spell_control)%
    # It didn't so let's create it
    set spell_control 3
    remote spell_control %self.id%
else
    # Okay so the variable exists, let's check if we can cast already or if we should wait more
    # If the variable is still not zero we're waiting, so subtract from the variable and stop the script
    if %actor.spell_control% > 0
        set spell_control %actor.spell_control% - 1
        remote spell_control %self.id%
        return 0
        halt
    end
end
        
# Now it will cast the spell, and reset the variable
if !%self.affect(spellname)%
    dg_cast 'spellname' %self%
    set spell_control 3
    remote spell_control %self.id%
end
With this script (and Num Argument 100) the trigger will run every 13 secs, this is unchangeable with random triggers (as far as I know).
The first time it runs it will set the variable and the spell will be cast.
But then there will be a delay of 3*13 seconds to recast the spell (you can change that by changing the "set spell_control 3" lines), a window of 39 seconds for the player to kill the mob.

This is just an idea tho, not sure if it will work for ya.
I haven't tested the script so sorry if there's any mistakes :)

PS: And I'm not sure if you have to remote the variable again after you set the value so, if anyone could please help haha
Last edit: 7 months 3 weeks ago by lacrc.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
7 months 3 weeks ago #7949 by JTP
Replied by JTP on topic Mob cast
Any idea why it doesnt show a message when the spell runs out by itself ? Like it does on players.
It just goes away.

Please Log in or Create an account to join the conversation.

More
7 months 17 hours ago #8064 by Parnassus
Replied by Parnassus on topic Mob cast
What sort of spell is it? Is it possible to put it on a worn item? This would keep the spell from wearing off. You could also add triggers to destroy the item on death and to keep players from using it if they managed to get one by accident.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
7 months 17 hours ago #8066 by JTP
Replied by JTP on topic Mob cast
Im making mob cast spell triggers so people Can dispel them.

But when the spell ran out there was no message like when a players has a spell run out.

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
7 months 17 hours ago #8068 by JTP
Replied by JTP on topic Mob cast
Any idea why a mob with a spell cast trigger, only caste the spell If there is a player in the same room ?


And numerisk arg 100= 13 sec. No Way to make it recast emediately ?

Please Log in or Create an account to join the conversation.

  • JTP
  • Topic Author
  • Offline
  • Platinum Boarder
  • Platinum Boarder
More
6 months 2 weeks ago #8090 by JTP
Replied by JTP on topic Mob cast
Still have the issue where mob only cast the dg_cast when a players is in the room.

That gives the player a chance to rush in and attack.

Idearly i would like the mob to have the spell/spells in even if no player is in the room.

Please Log in or Create an account to join the conversation.

Time to create page: 1.973 seconds