This is a read only copy without any forum functionality of the old Modcraft forum.
If there is anything that you would like to have removed, message me on Discord via Kaev#5208.
Big thanks to Alastor for making this copy!

Menu

Author Topic: Smartai Question  (Read 955 times)

Piccolodmq

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 200
    • View Profile
Smartai Question
« on: August 10, 2017, 05:47:06 pm »

Smartai Help

Hi There. Can anyone guide me making a npc (id 9999) summon a Game object (id 8888)' then the gobject casts a spell 7777 to itself (That can Hurt a player if near, and dissapear the gobject after 10 sec.

Thanks

Insanity

  • Registred Member
  • LUA Script Tinker
  • *****
  • Posts: 40
    • View Profile
Re: Smartai Question
« Reply #1 on: August 13, 2017, 03:55:55 am »
I think you are looking for action type 50 (SMART_ACTION_SUMMON_GO) on your npc, tied to whatever trigger event you want.  Action 50 has a despawn parameter you can use.  From there you just need to script the GO. 
I’m not familiar with spell id 7777 (if that is the actual spell id and not just a placeholder) but if the spell already has a built effect (like a damage aura) then you could just use action 12 (cast), if the spell activates the aura, or action 75 (add aura) if the spell is already an aura.  Again pending on how the spell works you can either use the in-combat (event 0) , out-of-combat (event 1), range (event 9), or Summoned_Unit (event 17) event to trigger.  Don’t forget that GO use source_type 1. 
I haven’t done a lot of GO scripting so you might have to use a timed action list to get things to work right.  Could you use an untargetable npc instead of the GO, smartai has better support for creatures?
Trinity’s Smart AI page is fairly detailed and should help.

Piccolodmq

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 200
    • View Profile
Re: Smartai Question
« Reply #2 on: August 13, 2017, 04:33:56 pm »
Thanks for the quick answer, will look into this.    Is it posible for a NPC to summon a gameobject at all?

Insanity

  • Registred Member
  • LUA Script Tinker
  • *****
  • Posts: 40
    • View Profile
Re: Smartai Question
« Reply #3 on: August 15, 2017, 03:04:47 am »
I believe that is what action 50 does.  Give it a try.  Set the npc with an 10 sec OOC time and then set the despawn parameter for action 50 to 5 sec.  Don't forget that smartai uses millisecond or else you will have a ton of GOs floating around.

Piccolodmq

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 200
    • View Profile
Re: Smartai Question
« Reply #4 on: August 26, 2017, 07:03:38 am »
This worked! thanks!