ArcEmu: A Door - 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

  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

A Door Can I pull it off?

#1 User is offline   Ceres 

  • Member
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 26-May 10
  • Gender:Male

Posted 27 December 2010 - 11:17 PM

Ok, I've sort of gotten the hang of lua. I still have no idea what most functions do, but I'm certain I want to do something as follows:

While building up a nicer GM island for my server, I thought up of a gate that auto-opens once a GM comes close to it. Is it possible to script this in lua, or do I need to do it in C++?

Note: I'm starting this from nil, so there is no code as of yet.

EDIT
I felt a need to allow you guys to see my first script. I have included it along with the needed SQL files. Just spawn creature 90002 and creature 90003 in front of him. (the lua file is in txt format, so you might want to resave it as lua)
Attached File  90003-Zghtayr.sql (1.2K)
Number of downloads: 4
Attached File  90002-Arctica the Night Wolf.sql (1.24K)
Number of downloads: 2
Attached File  banning.txt (2.37K)
Number of downloads: 15
Posted Image
0

#2 User is offline   dfighter 

  • Titles are overrated
  • PipPipPipPipPipPipPipPipPipPip
  • Group: Administrator
  • Posts: 5,189
  • Joined: 14-June 08
  • IRC:dfighter
  • Gender:Male
  • Server OS:Linux

Posted 28 December 2010 - 12:09 AM

< Insert mandatory luA bash line here that usually earns a ;) from fangirls or +rep >

I'd definitely write a C++ addon for this. Maybe even add that Star Trek door opening sound when the door is opened.
One thing is sure, with no code it's not gonna' work anytime soon :P
"The demand for free goods is infinite."
1

#3 User is offline   Shrexx 

  • Member
  • Pip
  • Group: Members
  • Posts: 37
  • Joined: 29-March 10
  • Gender:Male

Posted 28 December 2010 - 02:35 AM

Uhm..

I'm not trying but I think it would work in Lua also, because I've seen on another Forum a NPC that begins to spam fireworks if you are near enough.

Add a GM check, do it for a door. And I think it should work ;)
0

#4 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 28 December 2010 - 03:28 AM

:P but isnt this soo simple?

ok i have not done this in years, but uh i think it should work anyhow like this...

midoor = 123456

...

  local x = pUnit:GetX()
  local y = pUnit:GetY()
  local z = pUnit:GetZ()
  local door = pUnit:GetGameObjectNearestCoords(x,y,z,midoor)
  if (door ~= nil) then
   if (player:IsGm() == true) then
     door:Activate()
   end
  end

...


how do i know? i don't! But i used to write as good lua as needed to get hated by people on mmowned and acweb.. so this might even work... ;)
Posted Image I do not join. I lead.
0

#5 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 28 December 2010 - 04:07 AM

The pink teleporters in the DK starting zone check each second if there's a player near and if so, teleport him. The script is on the ArcEmu svn.
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#6 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 28 December 2010 - 04:23 AM

View PostSaintJamesApostle, on 28 December 2010 - 04:07 AM, said:

The pink teleporters in the DK starting zone check each second if there's a player near and if so, teleport him. The script is on the ArcEmu svn.


oh nice. i remember last time i used them they'd crash, but uh, how long might this be ago? ;)
Posted Image I do not join. I lead.
0

#7 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 28 December 2010 - 05:30 AM

Now they work pretty much fine, just don't use them with a fly around or you will end up like Jeff Goldblum.
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
1

#8 User is offline   Ceres 

  • Member
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 26-May 10
  • Gender:Male

Posted 28 December 2010 - 10:30 AM

Ok, I've got as far as copy-pastaing iEzri's code. Did a couple of modifications, correct me if I'm wrong somewhere.

local midoor = 57384



function Door_Open(pUnit, Event)
 local x = pUnit:GetX()
 local y = pUnit:GetY()
 local z = pUnit:GetZ()
 local door = pUnit:GetGameObjectNearestCoords(x,y,z,midoor)
 if (door ~= nil) then
  if (player:IsGm() == true) then
     door:Activate()
  end
 end
end

Posted Image
0

#9 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 28 December 2010 - 11:09 AM

View PostCeres, on 28 December 2010 - 10:30 AM, said:

 if (player:IsGm() == true)


what a strange scripting language is Lua, " == true " ;)
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#10 User is offline   Ceres 

  • Member
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 26-May 10
  • Gender:Male

Posted 28 December 2010 - 11:26 AM

View PostSaintJamesApostle, on 28 December 2010 - 11:09 AM, said:

what a strange scripting language is Lua, " == true " ;)


Same with C++
= - Sets something
== - is something
Posted Image
0

#11 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 28 December 2010 - 11:36 AM

function Door_Open(pMisc, event, player)
 local x = pMisc:GetX()
 local y = pMisc:GetY()
 local z = pMisc:GetZ()
 local door = player:GetGameObjectNearestCoords(x,y,z,pMisc)
 if (door ~= nil) then
  if (player:IsGm() == true) then
     door:Activate()
  end
 end
end

RegisterGameObjectEvent(57384, 4, Door_Open)


Is that allright now?
is this the right register?

omg i cannot even remember anymore.. im sorry, i guess im too old for lua ;)
Posted Image I do not join. I lead.
0

#12 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 28 December 2010 - 11:39 AM

View PostCeres, on 28 December 2010 - 11:26 AM, said:

Same with C++
= - Sets something
== - is something

I meant that player:IsGm() already returns a bool so " if( player:IsGm() ) " is enough. Or at least it is in C++, no idea about Lua
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#13 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 28 December 2010 - 11:50 AM

View PostSaintJamesApostle, on 28 December 2010 - 11:39 AM, said:

I meant that player:IsGm() already returns a bool so " if( player:IsGm() ) " is enough. Or at least it is in C++, no idea about Lua


so it would be:

  if player:IsGm() then
     door:Activate()
  end


? ;) i should get back to work... ^^
Posted Image I do not join. I lead.
0

#14 User is offline   Ceres 

  • Member
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 26-May 10
  • Gender:Male

Posted 28 December 2010 - 12:16 PM

Lemme check. Will report in about a minute

--------REPORT--------
Lua file door.lua
Status - Did Load without error.
Did it work - Negative
Lua file:
local midoor = 57384

function Door_Open(pUnit, Event)
 local x = pUnit:GetX()
 local y = pUnit:GetY()
 local z = pUnit:GetZ()
 local door = pUnit:GetGameObjectNearestCoords(x,y,z,midoor)
 if (door ~= nil) then
  if (player:IsGm()) then
     door:Activate()
  end
 end
end

RegisterGameObjectEvent(57384, 4, Door_Open)

Posted Image
0

#15 User is offline   jackpoz 

  • ArcEmu Lemon Priest
  • PipPipPipPipPipPipPipPip
  • Group: Developers
  • Posts: 2,153
  • Joined: 19-June 08
  • Gender:Male
  • Location:Italy
  • Server OS:Windows

Posted 28 December 2010 - 12:19 PM

hey, don't look at me, you are the Lua expert ^^
Posted Image We develop dreams. Your dreams ;)
Posted ImagePosted Image
0

#16 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 28 December 2010 - 12:57 PM

function Door_Open(pMisc, event, player)
 local x = pMisc:GetX()
 local y = pMisc:GetY()
 local z = pMisc:GetZ()
 local door = player:GetGameObjectNearestCoords(x,y,z,pMisc)
 if (door ~= nil) then
  if player:IsGm() then
     door:Activate()
  end
 end
end

RegisterGameObjectEvent(57384, 4, Door_Open)


ceres can you try this?
Posted Image I do not join. I lead.
0

#17 User is offline   Ceres 

  • Member
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 26-May 10
  • Gender:Male

Posted 28 December 2010 - 01:38 PM

View PostiEzri, on 28 December 2010 - 12:57 PM, said:

function Door_Open(pMisc, event, player)
 local x = pMisc:GetX()
 local y = pMisc:GetY()
 local z = pMisc:GetZ()
 local door = player:GetGameObjectNearestCoords(x,y,z,pMisc)
 if (door ~= nil) then
  if player:IsGm() then
     door:Activate()
  end
 end
end

RegisterGameObjectEvent(57384, 4, Door_Open)


ceres can you try this?


Didn't work, sorry
Posted Image
0

#18 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 28 December 2010 - 02:34 PM

View PostCeres, on 28 December 2010 - 01:38 PM, said:

Didn't work, sorry


maybe its also GetGameObjectNearestCoords(x,y,z)... :unsure: you will have to debug this yourself as i am not able to test it. I don't have vc here so i cannot look up the functions, i don't see the output as i dont even have a box since for a year or so... :(

i hope you'll get it to work... and if not maybe marforius can?

i am sorry to leave this as is and you like this kemo sabe, but it just has been too long ago and all this was replaced by xml and soap already ages ago... :(
Posted Image I do not join. I lead.
0

#19 User is offline   Ceres 

  • Member
  • Pip
  • Group: Members
  • Posts: 44
  • Joined: 26-May 10
  • Gender:Male

Posted 28 December 2010 - 03:09 PM

iEzri. One last thing. thank you for your support, but a friend this this for me. here's his code:
function Gate_OnSpawn(pGameObject)
    pGameObject:RegisterEvent("Pcheckzzz", 2000, 0) 
	end

function Pcheckzzz(pGameObject, event)
    for a, plrs in pairs(pGameObject:GetInRangePlayers()) do
        if plrs ~= nil then
            if pGameObject:GetDistanceYards(plrs) < 5 then
				if player:IsGm() then
					pGO:Activate()
			
                

end
	end
		end
			end
				end
			
				RegisterGameObjectEvent(57755, 2, "Gate_OnSpawn")

Posted Image
0

#20 User is offline   iEzri 

  • < Ace of spades >
  • Group: Contributor
  • Posts: 1,692
  • Joined: 22-December 08
  • Gender:Female
  • Interests:I'm likely to cause mischief
  • Server OS:Linux

Posted 28 December 2010 - 04:27 PM

View PostCeres, on 28 December 2010 - 03:09 PM, said:

iEzri. One last thing. thank you for your support, but a friend this this for me. here's his code:


nice :unsure:
Posted Image I do not join. I lead.
0

Share this topic:


  • (2 Pages)
  • +
  • 1
  • 2
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users