What's new

[TrinityCore] Simple portal creation with Smart AI

chocochaos

Verified Member
14
2014
4
Location
The Netherlands
Most people make custom portals by modifying an existing portal spell's coordinates in the spell_target_position. That's messy, and you quickly run out of spells to use when you are making a lot of portals (as part of an event, for example).

Here's the sql (obviously, replace all instances of xxx with whatever value you want there):
Code:
SET @entry := xxx; -- New game object id for the portal object
SET @text := 'xxx'; -- Tooltip to show when hovering over portal
SET @display := 1327; -- Display id to use for the portal

-- Coordinates to port to:
SET @map := xxx; -- Map id
SET @x := xxx;
SET @y := xxx;
SET @z := xxx;
SET @o := xxx; -- Orientation in radians, 0 is north

INSERT INTO `gameobject_template` VALUES (@entry,10,@display,@text,'','','',0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'SmartGameObjectAI','',1);
INSERT INTO `smart_scripts` VALUES (@entry,1,0,0,64,0,100,0,0,0,0,0,62,@map,0,0,0,0,0,0,0,0,0,@x,@y,@z,@o,CONCAT(@text, ' - On click - Teleport'));

For example, a portal to shatterspear village:
Code:
SET @entry := 500001; -- New game object id for the portal object
SET @text := 'Portal to Shatterspear Village'; -- Tooltip to show when hovering over portal
SET @display := 1327; -- Display id to use for the portal

-- Coordinates to port to:
SET @map := 1; -- Map id
SET @x := 7367.77;
SET @y := -1560.74;
SET @z := 163.45;
SET @o := 2.55; -- Orientation in radians, 0 is north

INSERT INTO `gameobject_template` VALUES (@entry,10,@display,@text,'','','',0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,'SmartGameObjectAI','',1);
INSERT INTO `smart_scripts` VALUES (@entry,1,0,0,64,0,100,0,0,0,0,0,62,@map,0,0,0,0,0,0,0,0,0,@x,@y,@z,@o,CONCAT(@text, ' - On click - Teleport'));
 

ExO

Admin
5,098
2014
1,492
hi . one question. nice script ,but if i need port to other phase?

Could you elloborate if possible?

Anyways, then you find more teleport spells and use it the same way, if that's what you mean :)
 

eyerobot

Gold Supporter
Superior Member
917
2015
23
Location
Barryton Michigan USA
Nice work!
If you want players in a specific phase when they arrive, You would probably have to cast a phase spell on them once they arrive, You can do this in the spell area table. Just use a spell such as 59074, Set it to autocast in that specific map only. And any player entering that area will be in that phase. Or an alternative way would be to use an invis spell on your npc's in that area, And cast detect invis on the players using the smart script. You need to do these things because the smart script teleport to location command doesnt use phasing as an option.

Oh the smart scripts generally work on any server that supports smart scripts. It would be the gameobject_template table that you would need to edit manually.
 

pvphacks101

Verified Member
8
2018
0
help /* SQL Error (1136): Column count doesn't match value count at row 1 */ I laso tried your premade one dosent work
 

Chaotic

Gold Supporter
27
2018
0
Location
USA
help /* SQL Error (1136): Column count doesn't match value count at row 1 */ I laso tried your premade one dosent work

Depending on the database you are using(Trinity Core,Arcemu,Mangos) it needs to be modifird to fit in yours. Open up gameobject_template if Trinity, in Navicat or similar tool, and manually enter the numbers is the best way I can explain. Count the above and edit it accordingly.
 
Last edited:

ReeZe

ReeZe Gold
Verified Member
23
2021
2
For 4.3.4 EMUCOACH V14:

SQL:
SET @entry := xxx; -- New game object id for the portal object
SET @text := 'xxx'; -- Tooltip to show when hovering over portal
SET @display := 1327; -- Display id to use for the portal

-- Coordinates to port to:
SET @map := xxx; -- Map id
SET @x := xxx;
SET @y := xxx;
SET @z := xxx;
SET @o := xxx; -- Orientation in radians, 0 is north


INSERT INTO `gameobject_template` VALUES (@entry, 10, @display, @text, '', '', '', 0, 0, 1.75, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 'SmartGameObjectAI', '', 13623);
INSERT INTO `smart_scripts` VALUES (@entry, 1, 0, 0, 64, 0, 100, 0, 0, 0, 0, 0, 0, 62, @map, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, @x, @y, @z, @o, CONCAT(@text, ' - On click - Teleport'));
 

6yTblJIka

Verified Member
10
2022
0
SET @entry := xxx; -- New game object id for the portal object
SET @text := 'xxx'; -- Tooltip to show when hovering over portal
SET @display := 1327; -- Display id to use for the portal

-- Coordinates to port to:
SET @map := xxx; -- Map id
SET @x := xxx;
SET @y := xxx;
SET @z := xxx;
SET @o := xxx; -- Orientation in radians, 0 is north

INSERT INTO `gameobject_template`
(`entry`, `type`, `displayId`, `name`, `IconName`, `castBarCaption`, `unk1`, `size`,
`Data0`, `Data1`, `Data2`, `Data3`, `Data4`, `Data5`, `Data6`, `Data7`, `Data8`,
`Data9`, `Data10`, `Data11`, `Data12`, `Data13`, `Data14`, `Data15`, `Data16`,
`Data17`, `Data18`, `Data19`, `Data20`, `Data21`, `Data22`, `Data23`,
`AIName`, `ScriptName`, `VerifiedBuild`)

VALUES (@entry, 10, @display, @text, '', '', 0, 1.75,
0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 1, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0,
'SmartGameObjectAI', '', 13623);

INSERT INTO `smart_scripts` VALUES (@entry, 1, 0, 0, 64, 0, 100, 0, 0, 0, 0, 0, 0, 62, @map, 0, 0, 0, 0, 0, 7, 0, 0, 0, 0, @x, @y, @z, @o, CONCAT(@text, ' - On click - Teleport'));


[Image in game] CLICK

fix for TC 3.3.5
 
Last edited:
Top