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: How to make an NPC that wont move.  (Read 953 times)

Piccolodmq

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 200
    • View Profile
How to make an NPC that wont move.
« on: February 27, 2017, 10:28:47 pm »
Hi there

I want to make an NPC that when attack it will hold position (like a cannon) and attack me from its position,
I know this is something fairly simple and in the past I have done it by just editing the unit flags to 4, but its just not working with the current trinitycore version.

Here is the the full SQL

-- FULL `creature_template` of entry 80269
DELETE FROM `creature_template` WHERE (entry = 80269);
INSERT INTO `creature_template` (`entry`, `difficulty_entry_1`, `difficulty_entry_2`, `difficulty_entry_3`, `KillCredit1`, `KillCredit2`, `modelid1`, `modelid2`, `modelid3`, `modelid4`, `name`, `subname`, `IconName`, `gossip_menu_id`, `minlevel`, `maxlevel`, `exp`, `faction`, `npcflag`, `speed_walk`, `speed_run`, `scale`, `rank`, `dmgschool`, `BaseAttackTime`, `RangeAttackTime`, `BaseVariance`, `RangeVariance`, `unit_class`, `unit_flags`, `unit_flags2`, `dynamicflags`, `family`, `trainer_type`, `trainer_spell`, `trainer_class`, `trainer_race`, `type`, `type_flags`, `lootid`, `pickpocketloot`, `skinloot`, `resistance1`, `resistance2`, `resistance3`, `resistance4`, `resistance5`, `resistance6`, `spell1`, `spell2`, `spell3`, `spell4`, `spell5`, `spell6`, `spell7`, `spell8`, `PetSpellDataId`, `VehicleId`, `mingold`, `maxgold`, `AIName`, `MovementType`, `InhabitType`, `HoverHeight`, `HealthModifier`, `ManaModifier`, `ArmorModifier`, `DamageModifier`, `ExperienceModifier`, `RacialLeader`, `movementId`, `RegenHealth`, `mechanic_immune_mask`, `flags_extra`, `ScriptName`, `VerifiedBuild`) VALUES
(80269, 0, 0, 0, 0, 0, 147047, 0, 0, 0, 'Fel Soulstone', '', NULL, 0, 80, 80, 0, 189, 0, 1, 1.14286, 1, 0, 0, 2000, 2000, 1, 1, 1, 4, 2048, 0, 0, 0, 0, 0, 0, 9, 0, 0, 0, 0, 10, 0, 0, 0, 40, 10, 0, 0, 0, 0, 0, 0, 0, 0, 9085, 0, 0, 0, 'SmartAI', 0, 1, 1, 3, 1, 1, 1, 1, 0, 0, 1, 0, 2, '', 12340);

I have even tried to copy npc´s in game that wont move when attack (like fel cannons from outland ID=)22461, and change the ID, and still... when I attack the NPC it will follow me everywhere.  I want it to attack me holding its position.

thanks!
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Amaroth

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1219
    • View Profile
    • Amaroth's Tools
Re: How to make an NPC that wont move.
« Reply #1 on: February 27, 2017, 10:41:29 pm »
The easiest way I am aware of is using SmartAI. On update in combat, set its combat movement to 0. On update out of combat, set its combat movement to 1, so its able to move if it has any kind of waypoints or whatever (I am unsure wheter this was really needed, but I think it was). Done.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
English YT tutorial channel. Check it out if you preffer videos over walls of text.:
https://www.youtube.com/AmarothEng

Want to support me for my releases and/or tutorials? You can send donation via Paypal to:
jantoms@seznam.cz

Piccolodmq

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 200
    • View Profile
Re: How to make an NPC that wont move.
« Reply #2 on: February 27, 2017, 11:05:31 pm »
I just have one question... how do you know so much random stuff. hahhaha that did it!
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Amaroth

  • Contributors
  • Creator of Worlds
  • *****
  • Posts: 1219
    • View Profile
    • Amaroth's Tools
Re: How to make an NPC that wont move.
« Reply #3 on: February 28, 2017, 11:55:25 am »
It has been over 5 years since I have started working with TDB :D. And as I needed archer NPCs, I needed to find out how to make them work.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »
English YT tutorial channel. Check it out if you preffer videos over walls of text.:
https://www.youtube.com/AmarothEng

Want to support me for my releases and/or tutorials? You can send donation via Paypal to:
jantoms@seznam.cz

Gratural [Харгард]

  • Registred Member
  • Race Changer
  • *****
  • Posts: 30
    • View Profile
Re: How to make an NPC that wont move.
« Reply #4 on: February 28, 2017, 03:50:56 pm »
Piccolodmq for getting stationary NPC, you need set him MovementType to 0 not in "creature_темплате" , but only in "creature" table, for each spawned NPC's.
Of course, you need teach him a range spell (with no cost)
Also it is desirable to enabled vmaps/mmaps.
« Last Edit: January 01, 1970, 01:00:00 am by Admin »

Piccolodmq

  • Registred Member
  • Model Change Addict
  • *****
  • Posts: 200
    • View Profile
Re: How to make an NPC that wont move.
« Reply #5 on: February 28, 2017, 10:42:42 pm »
O right, thank you.   This works as well
« Last Edit: January 01, 1970, 01:00:00 am by Admin »