Forums WoW Modding Support Archives Azerothcore Discord Archives [DiscordArchive] I am right in thinking that Lua scripts go in `bin/lua_scripts/`?

[DiscordArchive] I am right in thinking that Lua scripts go in `bin/lua_scripts/`?

[DiscordArchive] I am right in thinking that Lua scripts go in `bin/lua_scripts/`?

rektbyfaith
Administrator
0
02-19-2025, 01:30 AM
#1
Archived author: Michael Crilly • Posted: 2025-02-19T01:30:25.042000+00:00
Original source

I am right in thinking that Lua scripts go in `bin/lua_scripts/`?
rektbyfaith
02-19-2025, 01:30 AM #1

Archived author: Michael Crilly • Posted: 2025-02-19T01:30:25.042000+00:00
Original source

I am right in thinking that Lua scripts go in `bin/lua_scripts/`?

rektbyfaith
Administrator
0
02-19-2025, 01:31 AM
#2
Archived author: metallinos • Posted: 2025-02-19T01:31:21.718000+00:00
Original source

The path is set in your mod-eluna conf, I think by default it's just lua_scripts in root dir, not bin/lua_scripts
rektbyfaith
02-19-2025, 01:31 AM #2

Archived author: metallinos • Posted: 2025-02-19T01:31:21.718000+00:00
Original source

The path is set in your mod-eluna conf, I think by default it's just lua_scripts in root dir, not bin/lua_scripts

rektbyfaith
Administrator
0
02-19-2025, 01:33 AM
#3
Archived author: metallinos • Posted: 2025-02-19T01:33:38.037000+00:00
Original source

How about this:
1. Try using PlayDirectSound instead of PlaySound
2. Your OnUse function fires on spawn of the gameobject (event 2), but on spawn there's no player object interacting with the gameobject yet, so you likely have to remove that or make that fire another function
3. Your gossip and on use functions prevent each other from functioning normally by returning on each other. You should return true on use of gameobject events to prevent normal action, and return false on gameobject gossip events to prevent normal action, and not fire both at the same time
4. You don't really need both a GameObjectGossip on hello and an OnUse; either can send a gossip menu just fine
rektbyfaith
02-19-2025, 01:33 AM #3

Archived author: metallinos • Posted: 2025-02-19T01:33:38.037000+00:00
Original source

How about this:
1. Try using PlayDirectSound instead of PlaySound
2. Your OnUse function fires on spawn of the gameobject (event 2), but on spawn there's no player object interacting with the gameobject yet, so you likely have to remove that or make that fire another function
3. Your gossip and on use functions prevent each other from functioning normally by returning on each other. You should return true on use of gameobject events to prevent normal action, and return false on gameobject gossip events to prevent normal action, and not fire both at the same time
4. You don't really need both a GameObjectGossip on hello and an OnUse; either can send a gossip menu just fine

rektbyfaith
Administrator
0
02-19-2025, 01:36 AM
#4
Archived author: metallinos • Posted: 2025-02-19T01:36:41.569000+00:00
Original source

So the Gossip On Hello stuff is generally intended for gossip menus, I think maybe you're not trying to send a gossip menu? If not, just this works:

```
local LevelUpGameObject = 123456

local function OnUse(event, go, player)
player:SendBroadcastMessage("You feel a strange power as you read the book...") -- Message to the player
playerTonguelayDirectSound(8959) -- Example: Play a mystical sound effect

player_level = player:GetLevel()

if player_level < 10
then
player:SetLevel(10)
end

if player_level >= 10 and player_level < 20
then
player:SetLevel(20)
end
return true
end

RegisterGameObjectEvent(LevelUpGameObject, 14, OnUse)
```
rektbyfaith
02-19-2025, 01:36 AM #4

Archived author: metallinos • Posted: 2025-02-19T01:36:41.569000+00:00
Original source

So the Gossip On Hello stuff is generally intended for gossip menus, I think maybe you're not trying to send a gossip menu? If not, just this works:

```
local LevelUpGameObject = 123456

local function OnUse(event, go, player)
player:SendBroadcastMessage("You feel a strange power as you read the book...") -- Message to the player
playerTonguelayDirectSound(8959) -- Example: Play a mystical sound effect

player_level = player:GetLevel()

if player_level < 10
then
player:SetLevel(10)
end

if player_level >= 10 and player_level < 20
then
player:SetLevel(20)
end
return true
end

RegisterGameObjectEvent(LevelUpGameObject, 14, OnUse)
```

rektbyfaith
Administrator
0
02-19-2025, 01:36 AM
#5
Archived author: metallinos • Posted: 2025-02-19T01:36:49.398000+00:00
Original source

Oh and 8959 is apparently a sort of error sound lol
rektbyfaith
02-19-2025, 01:36 AM #5

Archived author: metallinos • Posted: 2025-02-19T01:36:49.398000+00:00
Original source

Oh and 8959 is apparently a sort of error sound lol

rektbyfaith
Administrator
0
02-19-2025, 01:41 AM
#6
Archived author: metallinos • Posted: 2025-02-19T01:41:00.345000+00:00
Original source

I also see you put a test kick function in there, on a "Global" object; globals don't require a global object so anything with the global tag in the docs can simply be run like "Kick(player)" without any object like Global:Kick(player)
rektbyfaith
02-19-2025, 01:41 AM #6

Archived author: metallinos • Posted: 2025-02-19T01:41:00.345000+00:00
Original source

I also see you put a test kick function in there, on a "Global" object; globals don't require a global object so anything with the global tag in the docs can simply be run like "Kick(player)" without any object like Global:Kick(player)

Recently Browsing
 
Recently Browsing