SphereCommunity
Prevent players from losing fame against NPC's - Printable Version

+- SphereCommunity (https://forum.spherecommunity.net)
+-- Forum: Sphere 0.56d (/Forum-Sphere-0-56d)
+--- Forum: Script Help (/Forum-Script-Help)
+--- Thread: Prevent players from losing fame against NPC's (/Thread-Prevent-players-from-losing-fame-against-NPC-s)



Prevent players from losing fame against NPC's - pointhz - 10-31-2013 02:14 AM

Hello everyone I'm new around here and don't have much experience on scripting.

I would like to know how can I prevent players from losing fame when they die against NPC's.

When players kill players or die to players the fame calculation is at an event used by all players, under the @kill trigger. It will calculate fame for both victim and killers.

If the victim is a monster the fame won't change to the killer (player).

However, if the victim is the player and the killer is a monster there is something changing the player fame.

Anyone have any idea what can be causing this?

The message is most the times "you have lost huge amounts of fame"

Thanks in advance.


RE: Prevent players from losing fame against NPC's - XuN - 10-31-2013 03:02 AM

http://wiki.sphere.torfo.org/index.php/@FameChange


RE: Prevent players from losing fame against NPC's - pointhz - 10-31-2013 03:54 AM

Thanks for your answer, but where should I use that trigger?

If I use on players for example, how do I say "if there fame is about to change because of NPC's then dont change"?

Tried using it several times and never worked.


RE: Prevent players from losing fame against NPC's - XuN - 10-31-2013 04:57 AM

You could make some workaround like this
Code:
ON=@DeathCorpse
ref1=<attacker.last>
if (<ref1.npc>>0)
tag.nofameloss
endif

ON=@FameChange
if (<tag0.nofameloss>)
tag.nofameloss
return 1
endif



RE: Prevent players from losing fame against NPC's - Alaric - 10-31-2013 06:35 AM

(10-31-2013 04:57 AM)XuN Wrote:  You could make some workaround like this
Code:
ON=@DeathCorpse
ref1=<attacker.last>
if (<ref1.npc>>0)
tag.nofameloss
endif

ON=@FameChange
if (<tag0.nofameloss>)
tag.nofameloss
return 1
endif

on=@death and i would suggest loop through all attackers, if there is a player => fame down, if not, fame wont change


RE: Prevent players from losing fame against NPC's - pointhz - 10-31-2013 06:58 AM

Thanks to both of you! It worked.

Just another question.

When it calculates fame, if I set it to gain 500 it gains 500, but if I set it to lose 500 it will lose more. Why is that? Any way to fix?


RE: Prevent players from losing fame against NPC's - Alaric - 10-31-2013 08:09 AM

Are you changing argn1 and returning 0 in the trigger, or how do you modify it?


RE: Prevent players from losing fame against NPC's - Rattlehead - 10-31-2013 09:28 AM

post the line where you subtract the fame so we can see if its something to do with hex.


RE: Prevent players from losing fame against NPC's - pointhz - 10-31-2013 09:48 AM

Let's assume LOCAL.FAMECHANGE is always 500.

This is the killer fame change:

Code:
FAME    = <eval (<FAME> + <LOCAL.FAMECHANGE>)>
   IF ( <FAME> > 10000 )
      FAME    = 10000
   ELSEIF ( <FAME> == 0 )
      FAME    = 0
   ENDIF

And this the victim fame change:

Code:
LOCAL.FAMECHANGE = <EVAL (0 - <LOCAL.FAMECHANGE>)>
   OBJ.FAME    = <OBJ.FAME> + <LOCAL.FAMECHANGE>
   IF ( <OBJ.FAME> > 10000 )
      OBJ.FAME    = 10000
   ELSEIF ( <OBJ.FAME> == 0 )
      OBJ.FAME    = 0
   ENDIF

Although the local.famechange is exactly the same (500) the victim will always lose way more.


RE: Prevent players from losing fame against NPC's - Alaric - 11-01-2013 12:17 AM

hmmm, you mean this?
Code:
on=@famechange
   <qval <argn1> < 0 ? argn1=-500:argn1=500>
   return 0
I'm confused... somebody else must try to help you. It sometimes take me a long time to understand what others want to help with. Confused