Hello there :wave:
In my spare time I have managed to struggle together a small guide on how to make a few tricks, they could be used in custom instances, around the world, or anything your imagination can come up with!
The first one I will tell you can be a trap of used as a event. What will happen is when a player uses (right clicks) the gameobject we use, npc's can spawn anywhere on the same map for any amount of time as any faction. For example, somone opens a gate and 3 minions spawn + a boss at the back of the room for 5mins, and you have to kill him before he despawns! It could be a trap where you click on a chest and 2 npc's spawn ready to guide the treasures!
Here is the script:
Code:
function zzzGameobjectTrap_onUse (pUnit, Event)
pUnit:SpawnCreature (IDOfCreature, x, y, z, o, faction, duration)
end
RegisterGameObjectEvent (IDofGameobject, 2, "zzzGameobjectTrap_onUse")
The bits in red we are going to need to change:
IDOfCreature, change to the id of the npc you want to spawn.
x, In game where you want the npc to spawn type ".gps", this will tell you the map, x, y, z, o, zone etc.
y, Same as above
z, Same as above but add 1-2 to the number
o, Is which way the npc is going to spawn, so make sure your facing the right way when you do ".gps"
IDOfGameobject, is the ID of the gameobject you want to spawn the npc's when we use it. The type MUST be 10 or it will not work.
We now put that into a notepad, then saveas, all files, "whateveryouwanttocallit.lua" then put it in your scripts folder and restart your server.
With that script you can spawn as many creatures as you want, so if i wanted more than one i would type:
Code:
function zzzGameobjectTrap_onUse (pUnit, Event)
pUnit:SpawnCreature (IDOfCreature, x, y, z, o, faction, duration)
pUnit:SpawnCreature (IDOfCreature, x, y, z, o, faction, duration)
pUnit:SpawnCreature (
IDOfCreature, x, y, z, o, faction, duration)
pUnit:SpawnCreature (
IDOfCreature, x, y, z, o, faction, duration)
end
RegisterGameObjectEvent (IDofGameobject, 2, "zzzGameobjectTrap_onUse")
Note - Try to use the same script for one map, if you use the same script for a second place it wont work as the register and function is the same. Change them.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
For my second trick, I am going to tell you how to make a gameobject cast a spell when you click on it. This does not require a script.
This can be used to create buffs or mid-fight tactics inside custom instances (anti magic shield etc), or just a catapult for example (knockback).
Steps:
1: Create a gameobject with any id (This will be used to spawn it)
2: Make the type 22
3: Name of what players will see when they hover there mouse over it.
3: Make the displayid of what you want it to look like (259 for a chest)
4: Spell Focus is the id of the spell we want it to cast. Some spells may not work, for example i will do "5" Which will kill the player instantly.
Your done, restart server and do .gobject spawn (id of your gameobject)
Note - Some spells can be abused, for example on some servers (not all) if you put 5, and the player clicks on another player than uses the chest it will kill the other player not him, so be warned.
Thankyou for reading this post!
Please comment!
Edit: Ignore the code box mistakes and issues, i cant get it any better, gah!