ArcEmu: Small Npc Script Not Working. - ArcEmu

Jump to content

Toggle shoutbox Lastest Announcements

dfighter  : (07 December 2014 - 12:06 PM) Arcemu is in hibernation mode, please read http://arcemu.org/fo...showtopic=26903
dfighter  : (01 January 2013 - 05:56 PM) Arcemu wishes you all a happy new year!
Hasbro  : (12 September 2012 - 10:01 AM) Please excuse our outage from the web! Our web host had a major malfunction!
dfighter  : (01 September 2012 - 04:05 PM) Since the spam bots just don't want to stop, I've enabled admin verification when registering.
dfighter  : (23 January 2012 - 09:56 PM) Please note that from now on you will need to confirm your email on the wiki in order to edit it!
Hasbro  : (31 December 2011 - 12:50 PM) Happy New Years all!
Navid  : (26 December 2011 - 04:09 AM) Merry Christmas !!!!!! Happy holidays all :)
WAmadeus  : (24 December 2011 - 03:54 PM) Merry Christmas to all!
dfighter  : (24 December 2011 - 11:05 AM) The Arcemu team wishes y'all a Merry Christmukkah!
Hasbro  : (05 October 2011 - 12:53 PM) Looking for web designers for upcoming web related project. If you're interested in designing user interfaces contact me
dfighter  : (02 September 2011 - 03:47 PM) So who here wants vehicles in Arcemu? :P http://arcemu.org/fo...showtopic=25440
Hasbro  : (14 August 2011 - 03:25 PM) Join us on irc, grab an irc client and connect to irc.freenode.net join channel #arcemu /server irc.freenode.net:6667 /join #arcemu
jackpoz  : (03 August 2011 - 05:33 AM) to all Lua Engine (old one) users: please check http://arcemu.org/fo...showtopic=25274
Hasbro  : (20 May 2011 - 05:27 PM) Looking for people experienced with CMake configuration and setup! Contact me asap
Hasbro  : (15 May 2011 - 05:03 PM) ArcEmu is recruiting C++ programmers, contact Hasbro if interested.
paroxysm  : (03 May 2011 - 06:26 PM) Updated luabridge gossip example to describe the whole gossip creation process rather than just how to create menu. Gossip tutorial
paroxysm  : (23 April 2011 - 11:35 AM) Lua writers can refer to the Luabridge Tutorials section in the Wiki to learn how to write gossip code correctly.
Hasbro  : (20 April 2011 - 05:22 PM) Thank you for your continuous contribution of bug reports, we are working on them.
Hasbro  : (17 April 2011 - 03:20 AM) Please consider donating to support our bills. Donations can be sent using PayPal to donations@arcemu.org - Thank you for your support.
paroxysm  : (10 April 2011 - 12:43 AM) Refer to the Luabridge Tutorials section in the Wiki to learn the new syntax of luabridge.
Resize Shouts Area

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Small Npc Script Not Working. Shouldn't be to hard.

#1 User is offline   kp3 

  • Newbie
  • Group: Members
  • Posts: 7
  • Joined: 24-June 10
  • Gender:Male

Posted 25 June 2010 - 04:54 AM

function KoboldVermin_OnCombat(pUnit,pMisc, Event) 
	pUnit:SendChatMessage(12, 0, "Oh you!")
	Unit:RegisterEvent("KoboldVermin_OnHit",1,10)
end
function KoboldVermin_OnHit(pUnit,pMisc, Event) 
	pUnit:SendChatMessage(12, 0, "Yiieeeeeee! Me run!")
end

RegisterUnitEvent(732, 1, "KoboldVermin_OnCombat") -- On Enter Combat event for unit with ID 6 (Kobold Vermin)
RegisterUnitEvent(732,13, "KoboldVermin_OnHit") 


It's supposed to say "Oh You!" when you approach it, or well, enter combat. This works.
When you hit it it's supposed to say "Yiieeeeee! Me run!". This might seem very unlogical but it's just for testing purposes. 732 is a murloc that i used for testing. I've tried other npc's too, including one i made on my own. The function names are just ones i got from a sample script, and are only for testing purposes.

Problem is that KoboldVermin_OnHit never happens.
Originally i had a script that produced a random number between 1 and 4 each time it got hit, and if it returned 1 it would cast a spell. That didn't work so i simpled it down as much as i could, and noticed that the only event I'm able to actually get working is the OnCombat one. I don't get any errors either. All that happens is that it never actually says "Yiieeeeee! Me run!".

To test this further, I tried spawning the npc 20923, Or well Porung, which has a script included in arcscripts. It doesn't work either, So I'm begining to think it's a problem with my revision 3435. I can't update to the newer one to test either because in europe the new patch hasn't been released yet.

Just realised i forgot to put [lua] in the title, Hope it's no big deal.
Help is very much appreaciated. Thanks in advance! :blink:
0

#2 User is offline   kp3 

  • Newbie
  • Group: Members
  • Posts: 7
  • Joined: 24-June 10
  • Gender:Male

Posted 25 June 2010 - 06:06 AM

Thanks for the answer.
What you wrote works fine, However the event i'm wanting to use is 13, OnHit. Like, When i hit the npc it's going to say that. I couldn't get other event such as 5, parry to work either. The event 2 is on leave combat.
0

#3 User is offline   kp3 

  • Newbie
  • Group: Members
  • Posts: 7
  • Joined: 24-June 10
  • Gender:Male

Posted 25 June 2010 - 07:10 AM

Any clue on why it doesn't work?
0

#4 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 25 June 2010 - 03:25 PM

View Postkp3, on 25 June 2010 - 07:10 AM, said:

Any clue on why it doesn't work?


hmm...no candle?
Posted Image I do not join. I lead.
0

#5 User is offline   kp3 

  • Newbie
  • Group: Members
  • Posts: 7
  • Joined: 24-June 10
  • Gender:Male

Posted 25 June 2010 - 06:12 PM

View PostEzri, on 25 June 2010 - 03:25 PM, said:

hmm...no candle?

Is that a no?
0

#6 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 26 June 2010 - 05:28 AM

View Postkp3, on 25 June 2010 - 06:12 PM, said:

Is that a no?


no, actually this is more a "if you want to find out about if (or if not) the function you are trying to use is 'working' then you should put up your visual studio and check out the sourcecode. Or give that kobold a candle... however it will require you to do at least something... ^^
Posted Image I do not join. I lead.
0

#7 User is offline   kp3 

  • Newbie
  • Group: Members
  • Posts: 7
  • Joined: 24-June 10
  • Gender:Male

Posted 27 June 2010 - 06:01 AM

View PostiEzri, on 26 June 2010 - 05:28 AM, said:

no, actually this is more a "if you want to find out about if (or if not) the function you are trying to use is 'working' then you should put up your visual studio and check out the sourcecode. Or give that kobold a candle... however it will require you to do at least something... ^^


I don't really know much about c++ but i atleast managed to lookup if 13 actually existed in the source code, and it does. If i were capable of any c++ coding i probably wouldn't be trying to use lua in the first place.
0

#8 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 27 June 2010 - 06:11 AM

View Postkp3, on 27 June 2010 - 06:01 AM, said:

If i were capable of any c++ coding i probably wouldn't be trying to use lua in the first place.


if you would spend more energy not on explaining why you can't but more on trying to learn it, i bet you would have fixed it by now...
Posted Image I do not join. I lead.
0

#9 User is offline   Neglected 

  • Member
  • Pip
  • Group: Members
  • Posts: 25
  • Joined: 27-May 09
  • Gender:Male

Posted 27 June 2010 - 11:36 AM

View Postkp3, on 27 June 2010 - 06:01 AM, said:

I don't really know much about c++ but i atleast managed to lookup if 13 actually existed in the source code, and it does. If i were capable of any c++ coding i probably wouldn't be trying to use lua in the first place.


		sLuaMgr.PUSH_UNIT(_unit);
		sLuaMgr.PUSH_INT(CREATURE_EVENT_ON_HIT);
		sLuaMgr.PUSH_UNIT(mTarget);


ON_HIT is when the creature hits something, not the other way around.

You want 23 - CREATURE_EVENT_ON_DAMAGE_TAKEN. This gives the arguments:
(pUnit, 23, pAttacker, fAmount)
Lua Wiki Editor.
Ahn'Qiraj PvP EU - Hitswitch [Rogue]; Aeire [Priest]; Neglected [Warlock]
0

#10 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 02 October 2011 - 12:04 PM

interesting how none noticed OnHit wasn't even hooked.
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users