Jump to content

Need help with IsPCLevelOffset


Noggog

Recommended Posts

So, I'm trying to determine whether a creature's Offset flag is set or not.

 

Use the IsPCLevelOffset function seems to be the right one. However, when I do something like:

 

let bool := CreatureRat.isPClevelOffset

 

or

 

let bool := Call isPCLevelOffset

It either fails at runtime, or warns me saying the reference "left of the dot must be persistent or a quest"

 

 

Okay, persistent? I have to spawn a rat, and then check if it was spawned using an offset? Is there really no way to check the offset flag without making a persistent reference?

 

 

Thanks in advance! 8)

Probably just some stupid syntax thing. Always gets me

Edited by Leviathan1753
Link to comment
Share on other sites

I'm not entirely sure, but I don't think it will work on a dynamic reference. The level offset is a property of the base object anyway, so try calling getbaseobject and using the return value instead.

 

Alternatively, IIRC just comparing the PC's level (getlevel - player.getlevel) and the level of the mob should give you a !=0 when the offset flag is set. That should work on dynamic references too.

Edited by Skevitj
Link to comment
Share on other sites

Awesome, thanks a lot! 8) Huzzah for the neverending fountain of Nexus Knowledge!

 

EDIT:

Hmm, messed around with it a bit, these failed too:

 

       short min
       ref base

;	set min to (CreatureGoblin4Shaman.getlevel - player.getlevel)
;	printc "Goblin is %g", min

;	set base to CreatureGoblin4Shaman.getBaseObject

	set base to CreatureGoblin4Shaman
	set min to (base.getlevel - player.getlevel)
	printc "Goblin is %g", min

 

 

And yeah, I realized I started this in the wrong forum... 8\

Edited by Leviathan1753
Link to comment
Share on other sites

Gelevel will fail if used with the base object (given that the level is a property of the dynamic object, just as the level offset is a property of the base), but if the dynamic one is failing too I'd say its probably because you can't have three functions in a statement. Try:

 

set min to CreatureGoblin4Shaman.getlevel
set min to min - player.getlevel
printc "...", min

 

I don't know if this is the problem, but I've had functions compile without an error and then fail at run time because there were too many functions on a line.

 

v v As Astymma said, the result is accurate if player.getlevel != 1. If it isn't, it depends on the sign of the offset ( >0 it is accurate, <0 will return an offset of 0)

Edited by Skevitj
Link to comment
Share on other sites

I'm not entirely sure, but I don't think it will work on a dynamic reference. The level offset is a property of the base object anyway, so try calling getbaseobject and using the return value instead. Alternatively, IIRC just comparing the PC's level (getlevel - player.getlevel) and the level of the mob should give you a !=0 when the offset flag is set. That should work on dynamic references too.

 

Except in the case where offset is negative and player level is 1... the critter will also end up level 1. you'll probably have to obtain the level offset from the base ref, then apply it to player level while using a floor value of 1.

Edited by Astymma
Link to comment
Share on other sites

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...