Jump to content

Raid ID

Closed 2.8.5

IIIaKa
IIIaKa

Posted

Hi, I can't understand what raid ID is for. It's always equal to "0" and it never changes anywhere.

gbEnw8L.png

IIIaKa

Posted (edited)

1)Is there a hook that triggers when the owner of a raid base changes?
Or a method through which I can obtain the owner of a raid base by passing its ID or Location?

2)I have a Dictionary<string, RBData>. My plugin is loaded after a couple of bases have spawned. How can I add them?

3)How can I assign/remove owner to raid via external plugin?

4)There is no radius argument in the OnPlayerEnteredRaidableBase and OnPlayerExitedRaidableBase hooks.

4)Is there a method wich eject player from raid via external plugin?

5)Wouldn't it be better in the OnRaidableBasePurchased hook to leave the userID as type ulong? It's passed everywhere as ulong, but here it's passed as a string.

6)Is there hook when loot container destroys?

7)Is there hook for: "
Lock Treasure Max Inactive Time (Minutes) (20.0) - Resets the raid as public after this time"?

The advance thanks for the answers!

Edited by IIIaKa
IIIaKa

Posted

Hi, are there any updates regarding this?

nivex

Posted

@Death@Raul-Sorin Sorban there might be an issue with the notification system. I am having issues with not being notified of tickets, or responses to tickets. this typically happens when the user reacts to a post and responds to it at the same time. but as seen here, there were no reactions but simply a response that I wasn't notified of. I would have responded otherwise. thanks for looking into these issues as always.

 

nivex

Posted

 sorry @IIIaKaI'm not sure what's happening. if you don't receive a response within a day or two then you can DM me or @ping me instead

1. no, this information is not readily available. I will add an API for that by using the Vector3. string ID does not serve a purpose in this plugin. it is used by another private plugin. intruders is anyone inside of the event. raiders is anyone that has actively participated. if you want a thorough list then leave intruders set to false.

Quote

List<BasePlayer> players = RaidableBases.Call<List<BasePlayer>>("GetPlayersFrom", player.transform.position);

        [HookMethod("GetPlayersFrom")]
        public List<BasePlayer> GetPlayersFrom(Vector3 position, float x = 0f, bool intruders = false)
        {
            for (int i = 0; i < Raids.Count; i++)
            {
                if (InRange2D(Raids[i].Location, position, Raids[i].ProtectionRadius + x))
                {
                    return intruders ? Raids[i].GetIntruders() : Raids[i].GetRaiders();
                }
            }
            return null;
        }

and a second API per your request. keep in mind if the base is not locked then it will return a participant of the event instead

Quote

BasePlayer owner = RaidableBases.Call<BasePlayer>("GetOwnerFrom", entity.transform.position);

        [HookMethod("GetOwnerFrom")]
        public BasePlayer GetOwnerFrom(Vector3 position, float x = 0f)
        {
            for (int i = 0; i < Raids.Count; i++)
            {
                if (InRange2D(Raids[i].Location, position, Raids[i].ProtectionRadius + x))
                {
                    return Raids[i].GetOwner();
                }
            }
            return null;
        }

2. use the OnRaidableBaseStarted hook to see when bases have spawned

3. /rbe clearowner requires that you be in the game and at the specific base. /rbe setowner nivex can be used in game or in the server console.

4. added radius to the end of the hook arguments in the next update

5. no, I had a specific reason for doing this but don't recall what it was

6. no, use the hooks provided by Oxide

7. let me know if this will be sufficient

in ResetPublicOwner method:

                if (Interface.CallHook("OnRaidableResetPublicOwner", ownerId, Location, ProtectionRadius, GetRaiders(), Entities.ToList()) != null)
                {
                    return;
                }

in ResetPayLock method:

                if (Interface.CallHook("OnRaidableResetPayLock", ownerId, Location, ProtectionRadius, GetRaiders(), Entities.ToList()) != null)
                {
                    return;
                }

 

IIIaKa

Posted (edited)

@nivex
2. The OnRaidableBaseStarted hook is triggered when a base appears, and my plugin is loaded. However, if a base appeared before my plugin was loaded, then my plugin will not handle OnRaidableBaseStarted. So, are there ways to get the list of bases?

3. I mean to do this programmly through a plugin. In my PVE plugin, there is a system of "privatization" to prevent griefing.
Currently, when a player enters a free base, they are offered with clickable UI to buy the base. The purchase happens after deducting funds, and then using covalence.Server.Command($"rbevent setowner {playerID}");.
The problem is that I can't determine if the base has been successfully assigned to the player or not. That's why I was asking about the hook in point 1.
5. Can’t we just add an overloaded hook with ulong type alongside?
6. I just saw that in your plugin, the UI updates the loot count when a container destroyed.
If there's a way to pass the base position and loot amount through a hook, it would help avoid unnecessary calculations and be very convenient. Also, if possible, please add the loot amount to the OnRaidableBaseStarted hook.
8. I noticed that the base's despawnDateTime can change during time. Is there a hook for that as well?
9. Is it posible to set skinID for GunTrapFlameTurret and SamSite?

Edited by IIIaKa
nivex

Posted

2. no. you need to keep your plugin loaded. there is no reason to keep a plugin unloaded. you can unsubscribe unneeded hooks if you are worried about performance.

3. as I said, the command is limited. you can set an owner, but you cannot remove one. covalence.Server.Command($"rbe setowner {playerID}");. should use rbe not rbevent

5. that's redundant. a string is sufficient

6. ok, I have added the loot amount to OnRaidableBaseStarted and any other hook using `hookObjects`

added void OnRaidableLootDestroyed(Vector3 pos, float radius, int lootAmountRemaining, StorageContainer container)
added void OnRaidableLootDestroyed(Vector3 pos, float radius, int lootAmountRemaining, IOEntity io)

7. no. I added it for you.

8. no.

added Interface.CallHook("OnRaidableDespawnUpdate", hookObjects); to UpdateDespawnDateTime

9. why? do you want it set to 14922524 also?

why do you want all of this?

IIIaKa

Posted (edited)

@nivex
2. I probably didn't express myself correctly. These are very rare cases, but they can still happen.
For example, your plugin is installed on the server, several bases are spawned, and the server admin decides to add my plugin. After loading the plugin, my plugin won't know about the already existing bases because the OnRaidableBaseStarted hook was triggered before my plugin was added to the server. Or, for example, an update for my plugin is released, and the server admin updates the plugin, resulting in my plugin again not knowing about the existing bases.
3. It's a pity that there is no programmatic way to implement this.
5. It's a pity, as the userID is initially stored as a ulong type and no additional calculations are required.
9. In my PvE plugin to prevent griefing, everything is privatized, and therefore, targeting of all traps is disabled. But for raid bases, I want to enable them only for raiders.
I have to constantly check the position of these traps in the CanBeTargeted hooks, but if you add a skinID to them, it would allow me to avoid position checks in many cases (for traps not from raid bases).

 

object CanBeTargeted(BasePlayer player, FlameTurret flameTurret)
{
  if (player.userID.IsSteamId())
  {
    if (TryGetRaidBase(flameTurret.transform.position, out var rbData) && rbData.CanInteractWithRaid(player))
      return null;
    return false;
  }
  return null;
}

//If traps have a skin ID
object CanBeTargeted(BasePlayer player, FlameTurret flameTurret)
{
  if (player.userID.IsSteamId())
  {
    if (flameTurret.skinID == _rbSkinID && TryGetRaidBase(flameTurret.transform.position, out var rbData) && rbData.CanInteractWithRaid(player))
      return null;
    return false;
  }
  return null;
}



Thank you!

Edited by IIIaKa
nivex

Posted (edited)

2. understood. added

        [HookMethod("GetAllEvents")]
        public List<(Vector3 pos, int mode, bool allowPVP, string a, float b, float c, float loadTime, ulong ownerId, BasePlayer owner, List<BasePlayer> raiders, List<BasePlayer> intruders, List<BaseEntity> entities, string baseName, DateTime spawnDateTime, DateTime despawnDateTime, float radius, int lootRemaining)> GetAllEvents(Vector3 position, float x = 0f)
        {
            return Raids.Select(raid => (raid.Location, (int)raid.Options.Mode, raid.AllowPVP, raid.ID, 0f, 0f, raid.loadTime, raid.ownerId, raid.GetOwner(), raid.GetRaiders(), raid.GetIntruders(), raid.Entities.ToList(), raid.BaseName, raid.spawnDateTime, raid.despawnDateTime, raid.ProtectionRadius, raid.GetLootAmountRemaining())).ToList();
        }

3. added rbe clearowner nivex / rbe clearowner 76561198212544308 useable from server console

9. ok. I will apply a skinID 14922524 when CreateSpawnCallback is called

Edited by nivex
nivex

Posted

Changed Status from Pending to Closed

1.6m

Downloads

Total number of downloads.

7.7k

Customers

Total customers served.

115.3k

Files Sold

Total number of files sold.

2.3m

Payments Processed

Total payments processed.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.