ArcEmu: [rc]teleporternpc1.0 - 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

[rc]teleporternpc1.0 because the world needs another one of these...

#1 User is offline   cybersquare420 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 161
  • Joined: 01-April 10
  • Gender:Male
  • Location:Northern MI, USA

Posted 09 April 2010 - 12:12 PM

so, im no coder by a long shot... this is my first ever attempt at lua... so be nice. however im pretty happy with its functionality and decided someone else might like it too... feel free to change/improve/suggest... like i said i am UBER-NOOB wit teh LUA.... lol

this version incorperated admin, race, level, and class checks to keep griefers from abusing the tele to get places they should not be able to get... (ie the outlands, etc)

i have the sql too if anyone wants it... but i assume you all got that handled... lol

credits: psychobandit for giving me the basics script that got me started on this... and whoever it was that coded that script originally... lol

enjoy!

Attached File(s)


0

#2 User is offline   Shadoxfix 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 312
  • Joined: 30-December 09
  • Gender:Male
  • Location:Netherlands

Posted 09 April 2010 - 01:20 PM

Did you test everything?
0

#3 User is offline   cybersquare420 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 161
  • Joined: 01-April 10
  • Gender:Male
  • Location:Northern MI, USA

Posted 09 April 2010 - 02:19 PM

i think so... post back if u find any bugs and ill do my best to fix them...
0

#4 User is offline   psychobandit 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 174
  • Joined: 09-May 09
  • Gender:Male

Posted 10 April 2010 - 01:02 AM

Now that's funny....you have put back quite a bit of the code I had taken out because it just had WAY too much useless crap in it (*edit* useless to me :) )!
I guess I should also clarify, The reason I can't give credit to the original creator is because I got the code from many sources & then picked out what I wanted. So, if you really want to have a noted credit inside it, you should change it to "The many unknown people who created the original code" :lol:
0

#5 User is offline   Shadoxfix 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 312
  • Joined: 30-December 09
  • Gender:Male
  • Location:Netherlands

Posted 10 April 2010 - 01:26 AM

View Postcybersquare420, on 09 April 2010 - 02:19 PM, said:

i think so... post back if u find any bugs and ill do my best to fix them...

an if statement should always be this right?
if(###code###) then
0

#6 User is offline   cybersquare420 

  • Enthusiast
  • PipPipPip
  • Group: Members
  • Posts: 161
  • Joined: 01-April 10
  • Gender:Male
  • Location:Northern MI, USA

Posted 10 April 2010 - 07:18 AM

View PostShadoxfix, on 10 April 2010 - 01:26 AM, said:

an if statement should always be this right?
if(###code###) then


thats possible from a form perspective... like i said im no coder, and very new to lua... i tried to employ good practices in the comment and structure department to make it easier for anyone with real coding skills to understand what i did, and be able to fix it easily... lol... but the code works as written... although i am sure it could be made prettier and could likely use some optimizing... but not only am i not into coding much, but i freaking hate it!!! its too tedious for this guy...
all that said i edited the version i am running a bit more and added a lvl 68+ check on the gmisland destination and made a mall there with all the epic gear vendors... so high lvl characters can gear up without having to travel all over hell's half acre.... if anyone cares ill post it as well... but it isnt really a fix or major change so i am not gonna post it seperately... its just a little tweak i am using... but i am always up for sharing... :)

-cyber-

TBH i would not have released this my kinder-coding skills at all, but there is a lot of complaints about leachers in the forums and i dont wanna be "that guy". The only content i had to offer was the above script.... so there it is... it isnt much, but its all i goit to give for the time being. :P

edit: DOH!! i guess i will be uploading the changes after all... i realized there was one line of somewhat amusing debug code left in the other version... so here is an update including the high lvl gmisland access for a mall, and the debug code removed. :)

-- teleport system for arcemu 3.3.2
-- credit to the original authors... i dont know who they were... for giving me the basic idea and framework
-- requires an npc with id == 40000
-- feel free to edit or redistribute this code freely... just give fair credit...
-- enjoy
-- version 1.0
-- author cybersquare420 and some other coders from the long lost past...


-- menus displayed according to race, class, level, and gm-status


function NPC_Gossip(Unit, Event, player, pMisc)
	local race=player:GetPlayerRace()
	local level=player:GetPlayerLevel()
	local class=player:GetPlayerClass()
	local admin=player:IsGm()

	-- menu displayed to admins

	if admin==true then
		Unit:GossipCreateMenu(3544, player, 0)
			Unit:GossipMenuAddItem(4, "Stormwind", 1, 0)
			Unit:GossipMenuAddItem(4, "Ironforge", 2, 0)
			Unit:GossipMenuAddItem(4, "Darnassus", 3, 0)
			Unit:GossipMenuAddItem(4, "Exodar", 4, 0)
			--Unit:GossipMenuAddItem(4, "Valiance Keep", 5, 0)
			Unit:GossipMenuAddItem(4, "Orgrimmar", 6, 0)
			Unit:GossipMenuAddItem(4, "Undercity", 7, 0)
			Unit:GossipMenuAddItem(4, "Thunder Bluff", 8, 0)
			Unit:GossipMenuAddItem(4, "Silvermoon City", 9, 0)
			--Unit:GossipMenuAddItem(4, "Warsong Hold", 10, 0)
			Unit:GossipMenuAddItem(4, "Shattrath", 11, 0)
			Unit:GossipMenuAddItem(4, "Dalaran", 12, 0)
			Unit:GossipMenuAddItem(4, "Booty Bay", 13, 0)
			Unit:GossipMenuAddItem(4, "Ratchet", 14, 0)
			Unit:GossipMenuAddItem(4, "Gadgetzan", 15, 0)
			--Unit:GossipMenuAddItem(4, "Evergrove", 16, 0)
			--Unit:GossipMenuAddItem(4, "Sanctum of the Stars", 17, 0)
			Unit:GossipMenuAddItem(4, "The Ebon Hold", 18, 0)
			Unit:GossipMenuAddItem(4, "GM Island", 19, 0)
			Unit:GossipMenuAddItem(4, "Remove Rez Sickness", 20, 0)
		Unit:GossipSendMenu(player)
	end	

	if admin==false then

		-- menu displayed to non-admin Alliance characters

		if race==1 or race==3 or race==4 or race==7 or race==11 then
			Unit:GossipCreateMenu(3543, player, 0)
				Unit:GossipMenuAddItem(4, "Stormwind", 1, 0)
				Unit:GossipMenuAddItem(4, "Ironforge", 2, 0)
				Unit:GossipMenuAddItem(4, "Darnassus", 3, 0)
				Unit:GossipMenuAddItem(4, "Exodar", 4, 0)
				Unit:GossipMenuAddItem(4, "Valiance Keep", 5, 0)
				Unit:GossipMenuAddItem(4, "Booty Bay", 13, 0)
				Unit:GossipMenuAddItem(4, "Ratchet", 14, 0)
				Unit:GossipMenuAddItem(4, "Gadgetzan", 15, 0)
				if level>=58 then
					Unit:GossipMenuAddItem(4, "Shattrath", 11, 0)
					Unit:GossipMenuAddItem(4, "Evergrove", 16, 0)
					Unit:GossipMenuAddItem(4, "Sanctum of the Stars", 17, 0)
					if level>=68 then
						Unit:GossipMenuAddItem(4, "Dalaran", 12, 0)
						Unit:GossipMenuAddItem(4, "Shangri-La", 19, 0)
					end
				end
				if class==6 then
					Unit:GossipMenuAddItem(4, "The Ebon Hold", 18, 0)
				end
				Unit:GossipMenuAddItem(4, "Remove Rez Sickness", 20, 0)
			Unit:GossipSendMenu(player)

		-- menu displayed to non-admin Horde characters

		else
			Unit:GossipCreateMenu(3543, player, 0)
				Unit:GossipMenuAddItem(4, "Orgrimmar", 6, 0)
				Unit:GossipMenuAddItem(4, "Undercity", 7, 0)
				Unit:GossipMenuAddItem(4, "Thunder Bluff", 8, 0)
				Unit:GossipMenuAddItem(4, "Silvermoon City", 9, 0)
				Unit:GossipMenuAddItem(4, "Warsong Hold", 10, 0)
				Unit:GossipMenuAddItem(4, "Booty Bay", 13, 0)
				Unit:GossipMenuAddItem(4, "Ratchet", 14, 0)
				Unit:GossipMenuAddItem(4, "Gadgetzan", 15, 0)
				if level>=58 then
					Unit:GossipMenuAddItem(4, "Shattrath", 11, 0)
					Unit:GossipMenuAddItem(4, "Evergrove", 16, 0)
					Unit:GossipMenuAddItem(4, "Sanctum of the Stars", 17, 0)
					if level>=68 then
						Unit:GossipMenuAddItem(4, "Dalaran", 12, 0)
						Unit:GossipMenuAddItem(4, "Shangri-La", 19, 0)
					end
				end	
				if class==6 then
					Unit:GossipMenuAddItem(4, "The Ebon Hold", 18, 0)
				end				
				Unit:GossipMenuAddItem(4, "Remove Rez Sickness", 20, 0)
			Unit:GossipSendMenu(player)
		end
	end		
end

-- teleport destinations

function NPC_OnSelect(Unit, Event, player, id, intid, code, pMisc)
	local race=player:GetPlayerRace()
	local level=player:GetPlayerLevel()
	local class=player:GetPlayerClass()
	local admin=player:IsGm()

	-- Stormwind

	if(intid == 1) then
		player:Teleport(0, -8832.94, 625.79, 93.92)
		Unit:GossipComplete(player)
	end

	-- Ironforge

	if(intid == 2) then
		player:Teleport(0, -4924.38, -950.87, 501.55)
		Unit:GossipComplete(player)
	end

	-- Darnassus

	if(intid ==3) then
		player:Teleport(1, 9945.68, 2482.68, 1316.19)
		Unit:GossipComplete(player)
	end

	-- Exodar

	if(intid == 4) then
		player:Teleport(530, -3946.06, -11727.78, -138.92)
		Unit:GossipComplete(player)
	end

	-- Valliance Keep

	if(intid == 5) then
		player:Teleport(571, 2219, 5305, 10.6)
		Unit:GossipComplete(player)
	end
	
	--Orgimmar

	if(intid == 6) then
		player:Teleport(1, 1502.71, -4415.42, 21.55)
		Unit:GossipComplete(player)
	end

	-- Undercity

	if(intid == 7) then
		player:Teleport(0, 1560.45, 244.33, -43.10)
		Unit:GossipComplete(player)
	end

	--Thunderbluff

	if(intid == 8) then
		player:Teleport(1, -1195.44, 34.78, 132.40)
		Unit:GossipComplete(player)
	end

	-- Silvermoon City

	if(intid == 9) then
		player:Teleport(530, 9496.04, -7282.29, 14.32)
		Unit:GossipComplete(player)
	end

	-- Warsong Hold

	if(intid == 10) then
		player:Teleport(571, 2852, 6200, 104.3)
		Unit:GossipComplete(player)
	end

	-- Shattrath

	if(intid == 11) then
		player:Teleport(530, -1721.94, 5382.32, 1.54)
		Unit:GossipComplete(player)	
	end

	-- Dalaran

	if(intid == 12) then
		player:Teleport(571, 5809.81, 651.38, 647.5)
		Unit:GossipComplete(player)
	end

	-- Booty Bay

	if(intid == 13) then
		player:Teleport(0, -14414, 430, 9)
		Unit:GossipComplete(player)
	end

	-- Ratchet

	if(intid == 14) then
		player:Teleport(1, -936, -3740, 9)
		Unit:GossipComplete(player)
	end

	-- Gadgetzan

	if(intid == 15) then
		player:Teleport(1, -7140, -3821, 8.8)
		Unit:GossipComplete(player)
	end

	-- EverGrove

	if(intid == 16) then
		player:Teleport(530, 2966, 5513, 143.6)
		Unit:GossipComplete(player)
	end

	-- Sanctum of the stars

	if(intid == 17) then
		player:Teleport(530, -4089, 1116, 42)
		Unit:GossipComplete(player)
	end

	-- The Ebon Hold

	if(intid == 18) then
		player:Teleport(609, 2364, -5659, 382.3)
		Unit:GossipComplete(player)
	end

	-- GM Island

	if(intid == 19) then
		player:Teleport(1, 16223, 16265, 13.3)
		Unit:GossipComplete(player)
	end

	-- resurection sickness remover

	if (intid == 20) then
		if (player:HasAura(15007) == true) then
			player:SendBroadcastMessage("Resurrection Sickness Removed!")
			player:RemoveAura(15007)
			Unit:GossipComplete(player)
		else
			player:SendBroadcastMessage("You don't have resurrection sickness!")
			Unit:GossipComplete(player)
		end
	end
end

-- reference to npc-teleport-dude

RegisterUnitGossipEvent(40000, 1, "NPC_Gossip")
RegisterUnitGossipEvent(40000, 2, "NPC_OnSelect")

0

#7 User is offline   Ima Ninja 

  • Newbie
  • Group: Members
  • Posts: 5
  • Joined: 20-October 09

Posted 29 April 2010 - 12:59 AM

Thanks :)
0

#8 User is offline   Hoffa 

  • Sup dawg
  • Group: Retired
  • Posts: 1,159
  • Joined: 11-December 08
  • Gender:Male
  • Location:Sweden
  • Interests:Trolling

Posted 29 April 2010 - 02:29 AM

You should try meta tables instead of over 9000 if statements.


local Locations = { 
Stormwind = { 0, -8928, 540, 95 }, 
Ironforge = { 0, -4981, -881, 502 },
Exodar = { 530, -4014, -11895, -1.5 }, 
Orgrimmar = { 1, 1502, -4415, 22 } 
}  
setmetatable( Locations, { __index = function() return nil end } )
teleport = function( map, player )
   
   local r = Locations[ map ] 
 
   if( r ) then 

      player:Teleport( r[1], r[2], r[3], r[4] ) 

   end 

end

-- Usage
teleport( "Stormwind", PlayerObject )




Posted ImagePosted Image



This person is known for trolling, flaming and extreme ignorance. Respond to at own risk.
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