Originally Posted by
Chaos-Energy
That's the method I originally used but I changed it to using models because the active waiting method feels a lot less responsive to me. Throwing a log on a bonfire takes 6 in-game ticks which is 3.6 seconds so in the best case scenario we only know we're not burning after 3.6 seconds of actually having stopped. Another reason I opted for the models option is that the script doesn't get stuck in an active waiting loop. While burning we can still loop through all the other checks really quickly (Fire Spirits or execute the, albeit limited, antiban). The disadvantage is indeed the fact that everyone has to get their own models but I feel the benefits outweigh the advantages.
I had no idea about this. Can't even remember me ever getting the ProSocks plugin so thanks for this.
I use this for my divination script, you could use it.
Generally players ID's are more unique than the surrounding models. They generally have a TID of 1000+, with said you could easily sort out the player ID and have the script get it.
The following will make a box around the center point (where your character is) and it'll assign the ID found of the TID>=1000 and assign it to playerID, just call getPlayerID in script start up.
Simba Code:
function getPlayerID(): uInt32;
var
models: glModelArray;
wantedPoint, clientCenter: TPoint;
playerBox: TBox;
i: integer;
begin
models:=ogl.getModels();
clientCenter:=ogl.getClientMidPoint();
playerBox:=intToBox(clientCenter.x-60, clientCenter.y-25, clientCenter.x+40, clientCenter.y+40);
if length(models) then
begin
for i := 0 to models.maxIndex() do
begin
if (models[i].TID >= 1000) then
begin
wantedPoint:=models[i].toPoint();
if pointInBox(wantedPoint, playerBox) then
begin
result:=(models[i].ID);
playerID:=(result);
end;
end;
end;
end;
end;
Example of usage (in your scenario)
Simba Code:
function isFiremaking(): boolean;
begin
if ogl.getModels(playerID).isEmpty() then
begin
exit(true);
end else
exit(false);
end;