SphereServer BugTracker - SphereServer
View Issue Details
0002424SphereServerexecutable - genericpublic29-10-14 13:0111-04-15 16:12
Rizz 
XuN 
normalmajoralways
resolvedfixed 
 
0.56c Nightly 
Automated (specify build number)
None
None
2089
0002424: Cannot change wartarget dclick on status in warmode
You cannot change your wartarget doubleclicking on a different char status.
1 warmode
2 attack a npc doubleclicking on his status
3 attack another npc doubleclicking on his status

You'll see you won't change the wartarget and you'll continue to attack the first npc
No tags attached.
Issue History
29-10-14 13:01RizzNew Issue
29-10-14 13:02RizzNote Added: 0002524
29-10-14 14:40XuNNote Added: 0002527
29-10-14 23:27RizzNote Added: 0002529
29-10-14 23:28RizzNote Edited: 0002529bug_revision_view_page.php?bugnote_id=0002529#r732
30-10-14 09:01XuNNote Added: 0002530
30-10-14 11:18RizzNote Added: 0002531
30-10-14 14:02XuNNote Added: 0002532
30-10-14 18:05RizzNote Added: 0002533
30-10-14 18:08RizzNote Edited: 0002533bug_revision_view_page.php?bugnote_id=0002533#r734
30-10-14 18:10RizzNote Edited: 0002533bug_revision_view_page.php?bugnote_id=0002533#r735
30-10-14 19:44XuNNote Added: 0002534
30-10-14 23:38RizzNote Added: 0002535
30-10-14 23:47RizzNote Edited: 0002535bug_revision_view_page.php?bugnote_id=0002535#r737
31-10-14 19:32XuNNote Added: 0002536
31-10-14 19:32XuNNote Edited: 0002536bug_revision_view_page.php?bugnote_id=0002536#r739
02-11-14 10:56XuNNote Added: 0002546
02-11-14 10:56XuNStatusnew => resolved
02-11-14 10:56XuNFixed in Version => 0.56c Nightly
02-11-14 10:56XuNResolutionopen => fixed
02-11-14 10:56XuNAssigned To => XuN
02-11-14 19:17RizzNote Added: 0002559
02-11-14 19:17RizzStatusresolved => feedback
02-11-14 19:17RizzResolutionfixed => reopened
04-11-14 16:47XuNNote Added: 0002561
04-11-14 20:13RizzNote Added: 0002562
04-11-14 20:13RizzStatusfeedback => assigned
10-12-14 00:25RizzNote Added: 0002581
29-12-14 21:45TerrikateIssue Monitored: Terrikate
24-01-15 19:10XuNNote Added: 0002651
19-03-15 21:43RizzNote Added: 0002738
20-03-15 09:41XuNNote Added: 0002739
20-03-15 11:08RizzNote Added: 0002740
20-03-15 13:36XuNNote Added: 0002741
21-03-15 21:34RizzNote Added: 0002743
09-04-15 21:31RizzNote Added: 0002759
10-04-15 11:45XuNNote Added: 0002760
11-04-15 13:01RizzNote Added: 0002761
11-04-15 16:12XuNNote Added: 0002763
11-04-15 16:12XuNStatusassigned => resolved
11-04-15 16:12XuNResolutionreopened => fixed

Notes
(0002524)
Rizz   
29-10-14 13:02   
If i revert to r2056 this works.
(0002527)
XuN   
29-10-14 14:40   
Cannot replicate with latest build and default scripts.
(0002529)
Rizz   
29-10-14 23:27   
(edited on: 29-10-14 23:28)
Ok is my problem with the scripts.
The problem stats here:


ON=@ATTACK
f_war_targ_clear <src.uid>


[FUNCTION f_war_targ_clear]
REF1 = <UID>
REF2 = <ARGS>
FORCHARMEMORYTYPE memory_war_targ

    IF (<link.uid> != <ref2>)
    
        color=<color>&~memory_war_targ
        
        if !<color>
            remove
        endif
        
    endif
ENDFOR

This is supposed to delete the multi target and keep only one target.
Works on build <= 2056

Did i make something wrong or there is a real problem with the build?

(0002530)
XuN   
30-10-14 09:01   
So what you want is to keep only one attacker and deleting others, right?

You might want to try with Attackers instead of memories:

ON=@Attack
f_war_targ_clear <src>

[function f_war_targ_clear]
if !(<Attacker>)
 return 0
endif
ref1=<args>
for <eval <attacker>-1> 0
 ref2=<attacker.<dlocal._for>.uid>
 if (<ref2.uid>==<uid>)
  continue
 endif
 if (<ref2.isplayer>)
  continue
 endif
 // the rest, who is not me or a player, will be removed from attackers.
 attacker.delete <ref2>
endfor
(0002531)
Rizz   
30-10-14 11:18   
I would like to keep the attackers list (so i can make some checks) but then i need to focus only on one wartarg to avoid this problem:

1) you attack A
2) A goes out of range or you just prefer to change your target
3) then you attack B
4) B goes out of range and A comes in again
5) you start to hit A and then when B comes in again you still hit A

With previous build i also noticed some problem using attacklast bcuz, in some circustances, you supposed to hit A but you hit B.
Players complained bcuz, of course, this always happened when you are near to kill someone and then you shot to the wrong one.

Now you are telling me that this beahviour is related to the attackers list, so i'm just wondering if my code works bcuz attackers list is not working on my release.
(0002532)
XuN   
30-10-14 14:02   
I never said this was related to attacker's list, only suggested you to use it :)

I made changes on 'target selection' when added the Threat variable, but they are ONLY applied for NPCs.

Attackers list is meant to override periodically the memories and finally get rid of them so, like you would have to do before attackers were implemented, you should work with the idea of having attackers as the base to work on and any other system to be custom... don't rely on memories anymore since they are condemned to die (in attacker's terms at least).

Tell me what checks are you using with attackers, I might find you a way to solve your problem using the system anyway.
(0002533)
Rizz   
30-10-14 18:05   
(edited on: 30-10-14 18:10)
Thx XuN for interesting in my case :D

I use attackers to made some checks on "who deals more damage and who was the last one".

In example in the arena i use this code:

ON=@KILL
IF (<src.uid> == <argo.ATTACKER.MAX>)
        IF (<argo.isplayer>)
        
            LOCAL.src_punti_arena=<src.account.dTAG.punti_arena>
            LOCAL.argo_punti_arena=<argo.account.dTAG.punti_arena>
            LOCAL.src_punti_arena +=1
            LOCAL.argo_punti_arena -=2
            src.account.TAG.punti_arena=<dLOCAL.src_punti_arena>
            argo.account.TAG.punti_arena=<dLOCAL.argo_punti_arena>
            src.sysmessage @021,3,1 You gain 1 point
            argo.sysmessage @021,3,1 You lose 2 point
        
        ENDIF
    ENDIF


I use to prevent players escaping with gate or teleport; example:

IF (<src.ATTACKER.LAST> != 0) && (<src.ATTACKER.LAST.ELAPSED> < 20)

    src.sysmessage You must wait until 20 seconds from your last hit suffered!
    src.sysmessage Devi attendere 20 secondi dal tuo ultimo colpo subito!
    src.message <src.ATTACKER.LAST.ELAPSED>
    return 1
    
ENDIF
src.go 1106,419,-80,2

I use for multiple reward while killing mobs or enemy guildmates

ON=@Death
IF (<ATTACKER>)
FOR y 0 <EVAL <ATTACKER>-1>
....
....

ON=@DEATHCORPSE
LOCAL.n=1

FOR X 0 <src.attacker>

IF (<src.attacker.<eval <LOCAL.X>>.dam> > 0)
....
....

These kind of stuff.
That's why i would like to keep all the attackers list but only one wartarg.

Actually how is working the wartarg? It checks trough the attackers list to find the closest one and than attack?

(0002534)
XuN   
30-10-14 19:44   
It's an interesting feature to add: ignore a target.

Test this build: https://www.dropbox.com/s/k1aqepw37wytzn9/SphereSvr.exe?dl=0 [^]

It includes a new 'ignore' variable to attacker's lists, setting it to 1 will make the character to skip this one when looking for a target. Can also be set using argn1=1 inside @CombatAdd.

To anwser your question this is the proccess of looking for target (Note that this is a fast adaptation to sphere script, syntax is not going to look similar... is just an orientation):

local.closest = 0 // nearest distance of last eligible target.
local.threat = 0 // same but for threat, only used if ini's setting is on
local.target = 0 //who am i going to attack?
for 0 attackers
 if attacker.x.ignore
  continue
 endif
 local.dist = <attacker dist>
 if <action> == archery
  if local.dist > archerymaxdist || local.dist < archerymindist //ini's settings
   continue
  endif
  if target = attacker.x.uid
   continue
  endif
 endif
 if local.dist > 14 //view sight
  continue
 endif
 if !canseelos attacker.x.uid
  continue
 endif
 if (serv.npcai & npc_ai_threat) && threat < attacker.x.threat
  local.threat = attacker.x.threat
  local.closest = attacker.x.distance
  local.target = attacker.x
 elseif (local.dist < local.closest)
  local.closest = attacker.x.distance
  local.target = attacker.x
 endif
endfor
target=<local.target>
(0002535)
Rizz   
30-10-14 23:38   
(edited on: 30-10-14 23:47)
I've tried this way:


ON=@ATTACK
f_war_targ_clear_v2 <src.uid>


[FUNCTION f_war_targ_clear_v2]

ref1=<args> //the one i chose to attack

if !(<Attacker>)
    return 0
endif


if (<ref1> != <attacker.target>)
    serv.b debug 1



    for (0 <eval <attacker>-1>)
        
        ref2=<attacker.<dlocal._for>.uid>
        
        if (<ref2.uid>==<uid>)
            continue
        endif
        
        if (<ref2> != <ref1>)
            attacker.<dlocal._for>.ignore=1
            serv.uid.<attacker.<dlocal._for>>.say ignored: <attacker.<dlocal._for>.ignore>
        endif

    endfor

endif

serv.b target <serv.uid.<attacker.target>.name>

But i cannot change war target.

Seems i cannot set ignore=1 to the attacker.

(0002536)
XuN   
31-10-14 19:32   
Try it again, I fixed some issues and made some changes, its working for me.

@CombatAdd <--- use this and NOT @Attack
if (<attacker>)
 Argn2=1 // Argn2 is now Ignore, argn1 is default threat (if used).
endif

Edit: Use the same link, I updated the build in it.

(0002546)
XuN   
02-11-14 10:56   
I assume this is working fine, reopen if not.
(0002559)
Rizz   
02-11-14 19:17   
Tried your script and i downloaded the new sphere from the same link.
Still not working at all, i attach a video:

https://www.dropbox.com/s/lh6qzwpn55ykrpb/Video_1414955401.wmv?dl=0 [^]

(i was not at home so i could not try)
(0002561)
XuN   
04-11-14 16:47   
Can you download and test again from the same link? I made some changes.
(0002562)
Rizz   
04-11-14 20:13   
Same problem plus now sphere gives me error on owner.isplayer
(0002581)
Rizz   
10-12-14 00:25   
Any news?
(0002651)
XuN   
24-01-15 19:10   
Been away for some time, can you tell me what's working and what's not right now with all the current updates? Need you to test in latest builds :) Thanks in advance.
(0002738)
Rizz   
19-03-15 21:43   
Still not working.
(0002739)
XuN   
20-03-15 09:41   
It is working fine to me with latest nightly.

Added 2 llamas with 10k hp, placed both at the same distance of 3 tiles and started shooting them, switching from time to time and my character always attacks the correct one. I moved myself to be in a distance of 3 tiles away from one llama and 6 tiles away from the other one and still working. This was tested with a Bow.

Using a melee weapon it is slightly different, if you are attacking one that is not in the required range it will automatically find best next target and attacks it regardless of the choosen target coming near to you, so if it comes in range you'll have to attack it again. Not sure if this have to be working this way but its how its and it's been working.
(0002740)
Rizz   
20-03-15 11:08   
Yesterday I tried with 2 llamas and one c_man at different distances (but in the same screen of course), once I attacked the first llama was impossible for me to change target. Tested with a fast bow.

I will try again. Did you add some script?

Anyway in my opinion, target needs to change only on player request otherwise this will result too much messy.
In a PVP (where usually you have to change target frequently) you cannot miss the last shot bcuz your opponent runs 3 tiles away from a previous target. Even in PVM.

I need to stay on the last target I choese.
(0002741)
XuN   
20-03-15 13:36   
Target sticks on what you 'dclick' but on certain situations (enemy out of range ie) it switchs to keep hitting obviously, IMO its working fine...

I'm using this function to test:

[function ble]
serv.newnpc c_llama
new.hits 10000
new.dex
new.p=


new.move 3

serv.newnpc c_llama
new.hits 10000
new.dex
new.p=


new.move -3
ref1=<new>

serv.newitem i_bow,1,1
serv.newitem=i_arrow,1000,1
dex=10000
attack=<ref1>

Lets stick to the 'bug' itself, if you want to change behaviour this is another thing, we must first see if its still not changing target at desire (what it does after enemy 'dissapeared' can be discussed later).

(0002743)
Rizz   
21-03-15 21:34   
Tried again: as you can see from the video I am able to hit only the neareast target even if i try to change.

https://www.dropbox.com/s/z064w7zbny7rptz/nearest.wmv?dl=0 [^]
(0002759)
Rizz   
09-04-15 21:31   
Any news?
(0002760)
XuN   
10-04-15 11:45   
I'm using the code I pasted in last reply, creating 2 llamas and setting my dex to high values (for fastest testing), I move between both llamas (having both in my attacker list) and distance means nothing. Tell me what .show serv.build gives you because in latest nightly this is not replicable with default script pack.
(0002761)
Rizz   
11-04-15 13:01   
I cannot tell you bcuz I deleted that version.
I tried the last one (downloaded yesterday) and it works with default scriptpack (the one i tried before didn't work even with the default scripts).

So i think this is fixed now.
(0002763)
XuN   
11-04-15 16:12   
I hate you, I was going crazy for a bug already fixed! Closing this :)