Odd issue with my potion drinking EVENT. - Printable Version +- SphereCommunity (https://forum.spherecommunity.net) +-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d) +--- Forum: Script Help (/Forum-Script-Help) +--- Thread: Odd issue with my potion drinking EVENT. (/Thread-Odd-issue-with-my-potion-drinking-EVENT) Pages: 1 2 |
Odd issue with my potion drinking EVENT. - Rayvolution - 09-18-2012 11:14 PM I'm trying to get my potion drinking script to work, and the only way I can is with a little work around. But, the work around should *not* be required. I'm totally puzzled why it's acting the way it is. The "Working" script with the work around, you'll notice I had to create a new potion, have the NPC drink that, then consume the original one: Code: ON=@GetHit What SHOULD work, but isn't. It's actually making the NPC's target attempt to drink the potion in the NPC's backpack. Code: ON=@GetHit Any advice? RE: Odd issue with my potion drinking EVENT. - Mordaunt - 09-18-2012 11:34 PM Doesn't CONSUME make the item work like it has been used? RE: Odd issue with my potion drinking EVENT. - darksun84 - 09-19-2012 12:07 AM I think because useitem(fired from an item) refers to the src, and in @gethit the src is the character that do the damage. The workaround works because that USEITEM fires from the character that receives the damage. You should try to do : PHP Code: ON=@GetHit RE: Odd issue with my potion drinking EVENT. - Rayvolution - 09-19-2012 02:06 AM (09-19-2012 12:07 AM)darksun84 Wrote: I think because useitem(fired from an item) refers to the src, and in @gethit the src is the character that do the damage. I tried that method also before posting, didn't work. Has the same effect; the attacker tried to use the NPC's potion in the NPC's pack. I also wanted to make sure it wasnt something totally wonky with my potions (they're completely custom) so I tested it on an i_candle instead of a potion, and when it fired my character (who was attacking the potion drinker) equipped the NPC's i_candle in his pack. lol. RE: Odd issue with my potion drinking EVENT. - darksun84 - 09-19-2012 03:04 AM I tried same trigger with default yellow potion and it works RE: Odd issue with my potion drinking EVENT. - Rayvolution - 09-19-2012 03:59 AM very strange! When I get home, I'll try again. Maybe I typo'ed/goofed somewhere. I was writing that in the wee hours of the night RE: Odd issue with my potion drinking EVENT. - Rayvolution - 09-19-2012 08:24 AM IF (<RESTEST 1 i_potion_heal_minor>) && (<HITPOINTS> < (<STR>/2)) && (<EVAL RAND(5)> == 1) EMOTE drink a <findid.i_potion_heal_minor.name>! // <--This works! (EDIT: I even removed the .name part and it'll display the UID of the potion it found in the character's pack.) USEITEM <findid.i_potion_heal_minor> return 1 ENDIF Still doesn't work. Also tried: findid.i_potion_heal_minor.useitem findid.i_potion_heal_minor.use USE <findid.i_potion_heal_minor> Here's the entire code for everything related to the script.. The Event: Code: [EVENTS e_AI_Potion_Drinker] Potion itself: Code: [ITEMDEF I_POTION_HEAL_MINOR] Changes to t_potion def: Code: [TYPEDEF T_POTION] The test NPC with the event: Code: [CHARDEF c_m_alton_guard] I'm *completely* stumped. I'm sure it's just a syntax problem with findid though, but what's wrong with it, I have no idea. :/ RE: Odd issue with my potion drinking EVENT. - Skul - 09-19-2012 12:04 PM Maybe useitem does not accept an argument? Try using trysrc to do it. RE: Odd issue with my potion drinking EVENT. - darksun84 - 09-20-2012 07:26 AM maybe on the typedef t_potion part SRC it's considered attacker i guess, so as skul wrote you can use trysrc on useitem RE: Odd issue with my potion drinking EVENT. - Rayvolution - 09-20-2012 07:42 AM Hrm, what would be the correct syntax for TRYSRC? I've never used it before, and the syntaxes ived tried on the wiki aren't working |