Jump to content
  • 0

consume item for each hit


Kawita

Question


  • Group:  Members
  • Topic Count:  7
  • Topics Per Day:  0.02
  • Content Count:  13
  • Reputation:   0
  • Joined:  06/11/23
  • Last Seen:  

It is possible to call a function for each attack that the character performs, what I basically want to achieve is through a function or in the following way:
When attacking the character consumes 1 usable item for each hit made, I would like to know if it is possible without modifying the SRC

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  1
  • Topics Per Day:  0.00
  • Content Count:  232
  • Reputation:   86
  • Joined:  06/30/18
  • Last Seen:  

You could try to achieve this effect using autobonus by setting a short amount for the duration the script will last.

*autobonus <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
*autobonus2 <bonus script>,<rate>,<duration>{,<flag>,{<other script>}};
*autobonus3 <bonus script>,<rate>,<duration>,<skill id>,{<other script>};
*autobonus3 <bonus script>,<rate>,<duration>,"<skill name>",{<other script>};

These commands are meant to be used in item scripts only! See 'petautobonus' for pet usage.

What these commands do is 'attach' a script to the player which will get
executed on attack (or when attacked in the case of autobonus2).

Rate is the trigger rate of the script (1000 = 100%).

Duration is the time in milliseconds that the bonus will last for since the script has triggered.

Skill ID/skill name the skill which will be used as trigger to start the bonus. (autobonus3)

The optional argument 'flag' is used to classify the type of attack where the script
can trigger (it shares the same flags as the bAutoSpell bonus script):

Range criteria:
	BF_SHORT:  Trigger on melee attack
	BF_LONG:   Trigger on ranged attack
	Default:   BF_SHORT+BF_LONG
Attack type criteria:
	BF_WEAPON: Trigger on weapon skills
	BF_MAGIC:  Trigger on magic skills
	BF_MISC:   Trigger on misc skills
	Default:   BF_WEAPON
Skill criteria:
	BF_NORMAL: Trigger on normal attacks
	BF_SKILL:  Trigger on skills
	default:   If the attack type is BF_WEAPON (only) BF_NORMAL is used,
		   otherwise BF_SKILL+BF_NORMAL is used.

The difference between the optional argument 'other script' and the 'bonus script' is that,
the former one triggers only when attacking(or attacked) and the latter one runs on
status calculation as well, which makes sure, within the duration, the "bonus" that get
lost on status calculation is restored. So, 'bonus script' is technically supposed to accept
"bonus" command only. And we usually use 'other script' to show visual effects.

In all cases, when the script triggers, the attached player will be the one
who holds the bonus. There is currently no way of knowing within this script
who was the other character (the attacker in autobonus2, or the target in
autobonus and autobonus3).

//Grants a 1% chance of starting the state "all stats +10" for 10 seconds when
//using weapon or misc attacks (both melee and ranged skills) and shows a special
//effect when the bonus is active.
	autobonus "{ bonus bAllStats,10; }",10,10000,BF_WEAPON|BF_MISC,"{ specialeffect2 EF_FIRESPLASHHIT; }";

 

Edited by Winterfox
Link to comment
Share on other sites

  • 0

  • Group:  Forum Moderator
  • Topic Count:  93
  • Topics Per Day:  0.02
  • Content Count:  10013
  • Reputation:   2346
  • Joined:  10/28/11
  • Last Seen:  

autobonus "{ if (countitem(512)) delitem 512, 1; else unitstopattack(getcharid(3)); }",1000,1000;

something like this ?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...