iraciz Posted June 15, 2022 Posted June 15, 2022 Good day,please help me! Bindatcommands are not working in the item scripts. TXT Example: 40574,Moonlight Bell,Moonbell,11,0,,0,,,,,0xFFFFFFFF,63,2,,,,,,{ specialeffect2 549; soundeffectall "moonlight_move.wav",0; atcommand "@bonus"; },{},{} @bonus is a custom npc bind atcommand that I use to apply random options to the gear. Oncommand only works with typing or talking to the NPC, but I want activate the script by using the item above. What can I do? Quote
0 Tokei Posted June 16, 2022 Posted June 16, 2022 Heya, You should use a function instead for items calling script code. So your script would become: function script F_AtBonus { mes "Kitsune Fox Blessings"; mes "..."; next; switch(select("...")) { } end; } - script atcmd_bonus -1,{ end; OnInit: bindatcmd "bonus", strnpcinfo(0) + "::OnCommand"; end; OnCommand: callfunc("F_AtBonus"); end; } And your item script would be: { specialeffect2 549; soundeffectall "moonlight_move.wav",0; callfunc("F_AtBonus"); } Alternatively, you can use doevent directly. So your code would be: { specialeffect2 549; soundeffectall "moonlight_move.wav",0; doevent "bonus_atcmd::OnCommand";} Though... doevent is a tricky script command and usually isn't something I'd recommend using if you can avoid it. But, it will work in your case. Quote
0 Emistry Posted June 17, 2022 Posted June 17, 2022 On 6/16/2022 at 5:39 AM, iraciz said: Bindatcommands are not working in the item scripts. *useatcmd "<command>"; This command will execute a script-bound atcommand for the attached RID. If the supplied command is not bound to any script, this command will act like 'atcommand' and attempt to execute a source-defined command. The three .@atcmd_***** variables will NOT be set when invoking script-bound atcommands in this way. 1 Quote
0 Tokei Posted June 18, 2022 Posted June 18, 2022 On 6/17/2022 at 2:01 PM, Emistry said: *useatcmd "<command>"; This command will execute a script-bound atcommand for the attached RID. If the supplied command is not bound to any script, this command will act like 'atcommand' and attempt to execute a source-defined command. The three .@atcmd_***** variables will NOT be set when invoking script-bound atcommands in this way. Never knew this one existed, thank you Emistry! This is much simpler. Quote
Question
iraciz
Good day,please help me! Bindatcommands are not working in the item scripts.
TXT Example:
@bonus is a custom npc bind atcommand that I use to apply random options to the gear.
Oncommand only works with typing or talking to the NPC, but I want activate the script by using the item above.
What can I do?
3 answers to this question
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.