Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
@DeathCorpse - ATTACKER problem
Author Message
xwerswoodx
Journeyman
*

Posts: 86
Likes Given: 4
Likes Received: 7 in 4 posts
Joined: Jun 2012
Reputation: 0

UoMMO

Post: #1
@DeathCorpse - ATTACKER problem
I am trying to do experience system but there is a problem because ATTACKER doesn't work under @DeathCorpse, but I search little and some developers gives feedback that it works under deathcorpse so where I am doing wrong?

Code:
[Events e_npc_level]
On=@DeathCorpse
IF !<dTAG0.LEVEL>
TAG0.LEVEL=1
ENDIF
SERV.ALLCLIENTS SYSMESSAGE A: <ATTACKER.LAST>
IF (<BRAIN> == brain_monster)
  LOCAL.TOT=<EVAL <TAG0.LEVEL> * 2>
  LOCAL.TOT=<EVAL <DLOCAL.TOT> / <ATTACKER>>
  FOR y 0 <EVAL <ATTACKER> - 1>
    SERV.ALLCLIENTS SYSMESSAGE X: <ARGO.NAME> - <ATTACKER> - <SRC.NAME> - <SRC.ATTACKER.0> - <ATTACKER.<DLOCAL.y>>
    REF1=<ATTACKER.<DLOCAL.Y>>
    ARGO.ATTACKER.ADD=<REF1>
    IF <REF1.ISINPARTY>
      LOCAL.PEXP=<EVAL <DLOCAL.TOT> / <REF1.PARTY.MEMBERS>>
      FOR x 0 <eval <REF1.PARTY.MEMBERS> - 1>
        ARGO.ATTACKER.ADD=<REF1.PARTY.MEMBER.<DLOCAL.x>>
        REF1.PARTY.MEMNER.<DLOCAL.x>.GIVEXP <DLOCAL.PEXP>
      ENDFOR
    ELSE
      REF1.GIVEXP <DLOCAL.TOT>
    ENDIF
  ENDFOR
ENDIF

Code:
[Function GIVEXP]
LOCAL.GIVEN <DARGS>
IF <ISINPARTY>
  TAG0.EXP += <PARTY.MEMBERS>
  SYSMESSAGE <REF5.LANG youhaveearned> <PARTY.MEMBERS> <REF5.LANG experience>
ENDIF

IF <UoMMO_CHECKPRE exp>
  LOCAL.GIVEN +=<EVAL <DLOCAL.GIVEN> / 2>
ENDIF
TAG0.EXP +=<DLOCAL.GIVEN>
SYSMESSAGE <REF5.LANG youhaveearned> <DLOCAL.GIVEN> <REF5.LANG experience>

<ATTACKER> - RETURN 0
<ATTACKER.LAST> - RETURN 0

Errors: It says eval doesn't divide by 0 (which is equals to <ATTACKER>)
Code:
06:01:ERROR:(sphere_events_uommo.scp,126)Exp_GetVal: Divide by 0
06:01:ERROR:(sphere_events_uommo.scp,129)Undefined keyword 'ATTACKER.ADD'
06:01:ERROR:(sphere_events_uommo.scp,129)Undefined keyword 'ARGO.ATTACKER.ADD'
06:01:ERROR:(sphere_events_uommo.scp,129)Undefined keyword 'ATTACKER.ADD'
06:01:ERROR:(sphere_events_uommo.scp,129)Undefined keyword 'ARGO.ATTACKER.ADD'
(This post was last modified: 01-31-2017 04:11 PM by xwerswoodx.)
01-31-2017 04:06 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #2
RE: @DeathCorpse - ATTACKER problem
Argo is actually an item (the corpse item), and items doesn't have the attacker property.
01-31-2017 08:14 PM
Find all posts by this user Like Post Quote this message in a reply
xwerswoodx
Journeyman
*

Posts: 86
Likes Given: 4
Likes Received: 7 in 4 posts
Joined: Jun 2012
Reputation: 0

UoMMO

Post: #3
RE: @DeathCorpse - ATTACKER problem
Yeah, I just tried it but the problem is, <UID> (which is npc) doesn't attacker either.

On=@Death, I can see attackers, but on=@Deathcorpse, Attacker returns 0 for NPC, I change my code that to save attackers (maybe someone need it);

Code:
[Events e_npc_level]
On=@Death
IF !<dTAG0.LEVEL>
TAG0.LEVEL=1
ENDIF

IF <dATTACKER>
  FOR x 0 <EVAL <ATTACKER> - 1>
    REF1=<ATTACKER.<DLOCAL.X>>
    SERV.LIST.<UID>.ADD <REF1>
  ENDFOR
ENDIF

On=@DeathCorpse
IF ((<BRAIN> == brain_monster) && (<SERV.LIST.<UID>.COUNT> > 0))
  LOCAL.TOT=<EVAL <TAG0.LEVEL> * 2>
  LOCAL.TOT=<EVAL <DLOCAL.TOT> / <SERV.LIST.<UID>.COUNT>>
  FOR a 0 <EVAL <SERV.LIST.<UID>.COUNT> - 1>
    REF2=<SERV.LIST.<UID>.<DLOCAL.A>>
    IF <REF2.ISINPARTY>
      LOCAL.TOT=<EVAL <DLOCAL.TOT> / <REF2.PARTY.MEMBERS>>
      FOR b 0 <EVAL <REF2.PARTY.MEMBERS> - 1>
        REF3=<REF2.PARTY.MEMBER.<DLOCAL.B>>
        SERV.LIST.<ARGO>.ADD <REF3>
        REF3.GIVEXP <DLOCAL.TOT>
      ENDFOR
    ELSE
      REF2.GIVEXP <DLOCAL.TOT>
      SERV.LIST.<ARGO>.ADD <REF2>
    ENDIF
  ENDFOR
  SERV.LIST.<UID>.CLEAR
ENDIF
02-01-2017 01:42 AM
Find all posts by this user Like Post Quote this message in a reply
Catalan_mistral
Journeyman
*

Posts: 54
Likes Given: 2
Likes Received: 6 in 5 posts
Joined: Jan 2017
Reputation: 0



Post: #4
RE: @DeathCorpse - ATTACKER problem
Sorry if i'm talking crap, can you not make use of the MORE2 on the corpse, as that holds the serial of the person who did the killing blow?

The One and Only......
02-01-2017 02:16 AM
Find all posts by this user Like Post Quote this message in a reply
xwerswoodx
Journeyman
*

Posts: 86
Likes Given: 4
Likes Received: 7 in 4 posts
Joined: Jun 2012
Reputation: 0

UoMMO

Post: #5
RE: @DeathCorpse - ATTACKER problem
Yes I think we can but under @DeathCorpse I and SRC is equals to <MORE2>, I ckeched it Smile
02-01-2017 02:19 AM
Find all posts by this user Like Post Quote this message in a reply
Coruja
Sphere Developer
*****

Posts: 987
Likes Given: 5
Likes Received: 226 in 187 posts
Joined: Jul 2012
Reputation: 7

Dimension Shard

Post: #6
RE: @DeathCorpse - ATTACKER problem
I can't remember correctly, but I think when an char kills another char, sphere will call triggers using this sequence:
1) @Kill
2) @Death
3) @DeathCorpse

and the ATTACKER list is cleared on @Kill or @Death, so there's no way to get it on @DeathCorpse

anyway, if you don't want to do nothing with the corpse, maybe it's better change your event to only use @Death instead @DeathCorpse
02-01-2017 02:31 AM
Find all posts by this user Like Post Quote this message in a reply
xwerswoodx
Journeyman
*

Posts: 86
Likes Given: 4
Likes Received: 7 in 4 posts
Joined: Jun 2012
Reputation: 0

UoMMO

Post: #7
RE: @DeathCorpse - ATTACKER problem
I remember @Death before than @Kill but this is not important (just for information if someone need it), because I needed to check attacker (list) on deathcorpse and it's possible to get corpse uid only on @Deathcorpse, I thought we can use ATTACKER under @Deathcorpse because I found this topic which has a post from XUN (Developer) with ATTACKER under @Deathcorpse,

https://forum.spherecommunity.net/Thread...elp?page=2

Because I tried to add EXP command which makes you clear corpses near you and get experience, but I try to add block that you don't get if you don't have any damage on it. So I tried to check attackers on from corpse but it's 0 so I tried to add attackers under DeathCorpse but it's cleared like you said. But in the link Xun send a post with attacker under deathcorpse and I thought I did something wrong.

Also I don't wanna post new topic for that, is there any Trigger or Setting to block items get damage? I tried @Damage but it's not working, and I didn't find any settings under Sphere.ini
(This post was last modified: 02-01-2017 02:49 AM by xwerswoodx.)
02-01-2017 02:46 AM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #8
RE: @DeathCorpse - ATTACKER problem
I tried <attacker> inside @deathcorpse and it actually works for me Shock
02-01-2017 04:00 AM
Find all posts by this user Like Post Quote this message in a reply
xwerswoodx
Journeyman
*

Posts: 86
Likes Given: 4
Likes Received: 7 in 4 posts
Joined: Jun 2012
Reputation: 0

UoMMO

Post: #9
RE: @DeathCorpse - ATTACKER problem
(02-01-2017 04:00 AM)darksun84 Wrote:  I tried <attacker> inside @deathcorpse and it actually works for me Shock

Which version are you using? I am using 0.56c, maybe older versions has it.
02-01-2017 02:22 PM
Find all posts by this user Like Post Quote this message in a reply
darksun84
Sir Spamalot
****

Posts: 1,687
Likes Given: 246
Likes Received: 162 in 151 posts
Joined: Mar 2012
Reputation: 35



Post: #10
RE: @DeathCorpse - ATTACKER problem
Ah i am using 56d, however from the revision:

27-11-2006, Vjaka
- Added: ATTACKER keyword to access last attackers of a character. Usage:
<attacker> returns amount of attackers
<attacker.x> returns UID of the attacker (or 0 if there is no attacker)
<attacker.x.dam> returns total damage done by the attacker
The list is being cleared upon death after @DeathCorpse trigger.
(This post was last modified: 02-01-2017 07:02 PM by darksun84.)
02-01-2017 07:00 PM
Find all posts by this user Like Post Quote this message in a reply
Post Reply 


Forum Jump:


User(s) browsing this thread: 1 Guest(s)