This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.
Messages - jar0fair
16
« on: August 01, 2015, 04:21:54 pm »
Hiya,
I've been playing around with a code for a simple teleporter npc that only has one location. I've checked the code over and over again, and I just can't see why it is giving an error. Here is the code:
-- Variables local npcid = 50003
-- On Triggers function OnTalk(Unit, Event, player) Player:GossipMenuAddItem(2, "I am ready to go ashore.", npcid , 1) Player:GossipMenuAddItem(2, "Never mind.", npcid , 2) Player:GossipSendMenu(1, unit) end
function OnSelect(Unit, Event, player, intid, code) if (intid == 1) then Player:Teleport(810, 13613.44842, 13608.508789, 12.098165, 1.535403) Player:GossipComplete() end
if (intid == 2) then Player:GossipComplete() end end
-- RegisterUnitEvents RegisterCreatureGossipEvent(npcid, 1, OnTalk) RegisterCreatureGossipEvent(npcid, 2, OnSelect) And whenever I click on the NPC I get an error in the server console saying
"lua:6: calling "GossipMenuAddItem" on bad self (bad argument : Player expected, got table)
Does anyone have any idea what might be going on here?
17
« on: August 01, 2015, 02:57:08 pm »
Alright, I see the error now. Change local guid = plr:GetGUID() to local guid = plr:GetGUIDLow()
The difference here is that GetGUID returns an uint64 number which is represented as an object. Each GetGUID returns a different object causing the lua table to map them to different locations. GetGUIDLow returns a normal number. To properly make the uint64 work as table key it might need to be converted to strings, but using lowguid is easier for this and might be faster. Thank you so much! Both of you. It is finally working how I would like it to. Me and my entire team are very grateful.
18
« on: August 01, 2015, 12:34:40 am »
Try this. I basically just added back in the GetWorldObject you removed.
-- Cauldron local CauldronItem = 200001 local CauldronObj = 186472 -- Chair local ChairItem = 200002 local ChairObj = 186732 -- bed local BedItem = 200003 local BedObj = 13948 -- vendor tent local VendortentItem = 200004 local VendortentObj = 4000668
local spawn = {}
local function SpawnObj(plr, entry, despawn_time) local guid = plr:GetGUID() if spawn[guid] then local spawnedGobject = plr:GetMap():GetWorldObject(spawn[guid]) if spawnedGobject then spawnedGobject:RemoveFromWorld(true) spawn[guid] = nil else plr:SendNotification("You need to be closer to the existing object to despawn it") end else local x, y, z, o = plr:GetLocation() local gobject = plr:SummonGameObject(entry, x, y, z, o, despawn_time) if gobject then spawn[guid] = gobject:GetGUID() end end end
local function Cauldron(event, plr, item, target) SpawnObj(plr, CauldronObj, 0) end
local function Chair(event, plr, item, target) SpawnObj(plr, ChairObj, 0) end
local function Bed(event, plr, item, target) SpawnObj(plr, BedObj, 5) end
local function VendorTent(event, plr, item, target) SpawnObj(plr, VendortentObj, 0) end
RegisterItemEvent(CauldronItem, 2, Cauldron) RegisterItemEvent(ChairItem, 2, Chair) RegisterItemEvent(BedItem, 2, Bed) RegisterItemEvent(VendortentItem, 2, VendorTent)
Nope, It doesn't remove the objects, and I am not sure why, because, it really seems like would, reading the code.
19
« on: July 31, 2015, 11:54:03 pm »
This is because in your code you check
if spawn then But spawn is always defined. The check is useless. The code inside the IF statement is run and it errors because the value for the key plr:GetGUID() is nil in the spawn table.
What you should check instead is
if spawn[plr:GetGUID()] then Thanks, I appreciate everyone's help But...This just isn't working. The code now spawns the object, but it's back to the original state. It spawns unlimited amounts and does not despawn, even though the code tells it to. I am not sure what I am missing. -- Cauldron local CauldronItem = 200001 local CauldronObj = 186472 -- Chair local ChairItem = 200002 local ChairObj = 186732 -- bed local BedItem = 200003 local BedObj = 13948 -- vendor tent local VendortentItem = 200004 local VendortentObj = 4000668
local spawn = {}
local function SpawnObj(plr, entry, despawn_time) if spawn[plr:GetGUID()] then
spawn[plr:GetGUID()]:RemoveFromWorld(true) spawn[plr:GetGUID()] = nil else gobject = plr:SummonGameObject(entry, plr:GetX(), plr:GetY(), plr:GetZ(), plr:GetO(), despawn_time) spawn[plr:GetGUID()] = gobject:GetGUID() end end
local function Cauldron(event, plr, item, target) SpawnObj(plr, CauldronObj, 0) end
local function Chair(event, plr, item, target) SpawnObj(plr, ChairObj, 0) end
local function Bed(event, plr, item, target) SpawnObj(plr, BedObj, 5) end
local function VendorTent(event, plr, item, target) SpawnObj(plr, VendortentObj, 0) end
RegisterItemEvent(CauldronItem, 2, Cauldron) RegisterItemEvent(ChairItem, 2, Chair) RegisterItemEvent(BedItem, 2, Bed) RegisterItemEvent(VendortentItem, 2, VendorTent)
20
« on: July 31, 2015, 02:30:59 pm »
local spawn = {}
local function SpawnObj(plr, entry, despawn_time) if spawn then local spawnedGobject = plr:GetMap():GetWorldObject(spawn[plr:GetGUID()]) if spawnedGobject then spawnedGobject:RemoveFromWorld(true) spawn[plr:GetGUID()] = nil end else local gobject = plr:SummonGameObject(entry, plr:GetX(), plr:GetY(), plr:GetZ(), plr:GetO(), despawn_time) spawn[plr:GetGUID()] = gobject:GetGUID() end end Thanks, that actually helped, and I've redone what I had before. I feel like I am getting really close but, I still can't get it to function. I've tried several different ways and invariably I am getting an error, when I use any of the items in game, in the following line:
local spawnedGobject = plr:GetMap():GetWorldObject(spawn[plr:GetGUID()])
"bad argument #1 to "GetWorldObject' (bad argument : unsigned long long expected, got nil)
21
« on: July 31, 2015, 01:33:43 am »
Wow 10/10, thanks. This works, and the objects despawn on teh second use. But, are you ready for the next issue? If I spawn the chair, and then someone else has the chair item, and they try to spawn one, it de-spawns mine. I'm wondering if there is a way to have the code function differently for each player. Create a table and use it like this: gameobjectlist[playerguid] = gobject:GetGUID()
If you can't do it with that hint, just tell us and we'll show you. (This is better for learning purposes instead of spoon feeding you )
Thank you, I really am trying to learn how to do this stuff myself but, I am pretty new yet. Getting pretty frustrated with myself for not being able to figure it out. I've seen how to structure a table once or twice, but I don't think I am doing it right. This is what I did. local spawns = { GUIDL owner = unit }
local function SpawnObj(plr, entry, despawn_time)
if spawns[2] then
local spawnedGobject = plr:GetMap():GetWorldObject(GUIDL)
if spawnedGobject then
spawnedGobject:RemoveFromWorld(true)
spawns = { GUIDL = nil owner = unit }
end
else
local gobject = plr:SummonGameObject(entry, plr:GetX(), plr:GetY(), plr:GetZ(), plr:GetO(), despawn_time)
spawns = { GUIDL = gobject:GetGUID() owner = unit }
end
end
22
« on: July 30, 2015, 01:31:45 pm »
Wow 10/10, thanks. This works, and the objects despawn on teh second use. But, are you ready for the next issue? If I spawn the chair, and then someone else has the chair item, and they try to spawn one, it de-spawns mine. I'm wondering if there is a way to have the code function differently for each player.
23
« on: July 30, 2015, 01:01:42 am »
Thanks, so I tried to integrate your code in a way that made sense to me. But, It isn't working. I'm sorry if I'm retarded. Please don't hit me.
-- Cauldron local CauldronItem = 200001 local CauldronObj = 186472 -- Chair local ChairItem = 200002 local ChairObj = 186732 -- bed local BedItem = 200003 local BedObj = 13948 -- vendor tent local VendortentItem = 200004 local VendortentObj = 4000668 local GUIDL = 0
local function SpawnObj(plr, entry, despawn_time) tar = plr:SummonGameObject(entry, plr:GetX(), plr:GetY(), plr:GetZ(), plr:GetO(), despawn_time) GUIDL = tar:GetGUID()
end
local function Cauldron(event, plr, item, target) if GUIDL:IsInWorld() == "IsInWorld" then GUIDL:RemoveFromWorld( deleteFromDB ) else SpawnObj(plr, CauldronObj, 0 ) end
end
local function Chair(event, plr, item, target) SpawnObj(plr, ChairObj, 0) end
local function Bed(event, plr, item, target) SpawnObj(plr, BedObj, 5) end
local function VendorTent(event, plr, item, target) SpawnObj(plr, VendortentObj, 0) end
RegisterItemEvent(CauldronItem, 2, Cauldron) RegisterItemEvent(ChairItem, 2, Chair) RegisterItemEvent(BedItem, 2, Bed) RegisterItemEvent(VendortentItem, 2, VendorTent)
24
« on: July 29, 2015, 10:54:47 pm »
To answer your first question I am running An Eluna Trinity core, and I know your name, Rochet, I'm using some of your systems. Thank for those, btw. The code I am using basically spawns a temporary object when it's corresponding Item is used, where the player stands. When the player logs off, the object disappears. It's pretty simple at the moment and lacks the capabilities I mentioned in my op.
-- Cauldron local CauldronItem = 200001 local CauldronObj = 186472 -- Chair local ChairItem = 200002 local ChairObj = 186732 -- bed local BedItem = 200003 local BedObj = 13948 -- vendor tent local VendortentItem = 200004 local VendortentObj = 4000668
local function SpawnObj(plr, entry, despawn_time) plr:SummonGameObject(entry, plr:GetX(), plr:GetY(), plr:GetZ(), plr:GetO(), despawn_time) end
local function Cauldron(event, plr, item, target) SpawnObj(plr, CauldronObj, 0) end
local function Chair(event, plr, item, target) SpawnObj(plr, ChairObj, 0) end
local function Bed(event, plr, item, target) SpawnObj(plr, BedObj, 5) end
local function VendorTent(event, plr, item, target) SpawnObj(plr, VendortentObj, 0) end
RegisterItemEvent(CauldronItem, 2, Cauldron) RegisterItemEvent(ChairItem, 2, Chair) RegisterItemEvent(BedItem, 2, Bed) RegisterItemEvent(vendortentItem, 2, VendorTent) The idea here is that this script could grow as I add more objects to the list.
In a perfect world, what I want it to do, is what the temporary spawning in "Go Move" does, only to remove the object, you would simply use the item once more.
25
« on: July 29, 2015, 10:24:52 pm »
Greetings,
I am hoping that I might find some advice on getting a system working which would allow our players to use items in their bags to spawn temporary objects. I currently have a lua script which can add the objects well enough. But, what I can’t figure out how to do, is to give the player the ability to remove the object by using the item again. At the moment, it just spawns another object. While I’m at it, I would also like to ensure that the item will only allow one instance of the object to be spawned at any given time. The main issue I see is that once the item is spawned, it is temporary, so it does not have a GUID, and thus, I can’t target it for removal.
If anyone has any ideas on how to make this work, I would really appreciate the input.
Thanks.
26
« on: July 28, 2015, 12:09:41 am »
You actually don't have to make it indexed and loose the alpha transparency.
This program has settings for clothing and character texture and wont loose the alpha transparency by making it indexed. This program requires a pngs, which can't be saved with alpha transparency.
27
« on: July 20, 2015, 09:10:39 pm »
You guys, I appreciate your input, this community is very helpful. But, I was intentionally vague before. My team and I have a pretty good idea about what we want to do. We have a large custom zone that should be more than adequate for the population we are expecting to start with. We are not creating a permanent world, as our story will move to other settings eventually. As for the coin system, there is more to it than just handing out coins, and we hope for a much more complicated system in the future. Currently, we do not have the technical know-how to achieve custom talent trees and reputations, which would be required. Precicely why I have posted here, in this recruitment page.
I am hoping to find someone who is interested in helping a start-up server develop original systems to promote and immersive roleplay experience.
28
« on: July 19, 2015, 05:21:23 pm »
Hiya,
I have been trying to figure a way to have the server add a certain amount of gold for every hour of time played. For example. Let's say that I have been playing a character for 3 hours. Every hour I play, A gold coin is added to my currency. If I play for 45 minutes, and log off, and log back on for 15 minutes, I would receive another gold coin.
Are there any guides that might help me achieve this?
Thanks so much.
29
« on: July 18, 2015, 06:37:40 pm »
We are creating our own version of a human town which exists in lore. We are doing this to create a more realistic and lively place in which to roleplay. The systems we are trying to implement are simple, and are targeted at creating a player driven economy. What I had in mind was a basic cojn system, which generates coins for players based on time in game.
30
« on: July 17, 2015, 03:46:40 am »
We are a new private roleplaying server with a dedicated community and experienced, friendly staff. We're planning to offer a truly immersive and enjoyable experience with a unique story, custom worlds, and simple but useful systems. We are in need of one more member in our team. We're looking for anyone with programming and scripting experience in LUA, and preferably C++ as well, to help us create and implement some of our concepts server side. Experience with role playing is a plus, as we will be a roleplay only server. Please take a look at our project, here, for an idea of what we've been working on. http://forums.fallenrp.com/index.php?/t ... en-exodus/Please contact me if you are interested in learning more about the opportunity, and what we plan to do.
|