View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0002424SphereServerexecutable - genericpublic29-10-14 13:0111-04-15 16:12
ReporterRizz 
Assigned ToXuN 
PrioritynormalSeveritymajorReproducibilityalways
StatusresolvedResolutionfixed 
PlatformOSOS Version
Product Version 
Target VersionFixed in Version0.56c Nightly 
Summary0002424: Cannot change wartarget dclick on status in warmode
DescriptionYou cannot change your wartarget doubleclicking on a different char status.
Steps To Reproduce1 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
TagsNo tags attached.
Nightly VersionAutomated (specify build number)
Experimental FlagsNone
Option FlagsNone
Internal Build Number2089
Attached Files

- Relationships

-  Notes
(0002524)
Rizz (reporter)
29-10-14 13:02

If i revert to r2056 this works.
(0002527)
XuN (developer)
29-10-14 14:40

Cannot replicate with latest build and default scripts.
(0002529)
Rizz (reporter)
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 (developer)
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 (reporter)
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 (developer)
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 (reporter)
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 (developer)
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 (reporter)
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 (developer)
31-10-14 19:32
edited on: 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 (developer)
02-11-14 10:56

I assume this is working fine, reopen if not.
(0002559)
Rizz (reporter)
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 (developer)
04-11-14 16:47

Can you download and test again from the same link? I made some changes.
(0002562)
Rizz (reporter)
04-11-14 20:13

Same problem plus now sphere gives me error on owner.isplayer
(0002581)
Rizz (reporter)
10-12-14 00:25

Any news?
(0002651)
XuN (developer)
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 (reporter)
19-03-15 21:43

Still not working.
(0002739)
XuN (developer)
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 (reporter)
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 (developer)
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 (reporter)
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 (reporter)
09-04-15 21:31

Any news?
(0002760)
XuN (developer)
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 (reporter)
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 (developer)
11-04-15 16:12

I hate you, I was going crazy for a bug already fixed! Closing this :)

- Issue History
Date Modified Username Field Change
29-10-14 13:01 Rizz New Issue
29-10-14 13:02 Rizz Note Added: 0002524
29-10-14 14:40 XuN Note Added: 0002527
29-10-14 23:27 Rizz Note Added: 0002529
29-10-14 23:28 Rizz Note Edited: 0002529 View Revisions
30-10-14 09:01 XuN Note Added: 0002530
30-10-14 11:18 Rizz Note Added: 0002531
30-10-14 14:02 XuN Note Added: 0002532
30-10-14 18:05 Rizz Note Added: 0002533
30-10-14 18:08 Rizz Note Edited: 0002533 View Revisions
30-10-14 18:10 Rizz Note Edited: 0002533 View Revisions
30-10-14 19:44 XuN Note Added: 0002534
30-10-14 23:38 Rizz Note Added: 0002535
30-10-14 23:47 Rizz Note Edited: 0002535 View Revisions
31-10-14 19:32 XuN Note Added: 0002536
31-10-14 19:32 XuN Note Edited: 0002536 View Revisions
02-11-14 10:56 XuN Note Added: 0002546
02-11-14 10:56 XuN Status new => resolved
02-11-14 10:56 XuN Fixed in Version => 0.56c Nightly
02-11-14 10:56 XuN Resolution open => fixed
02-11-14 10:56 XuN Assigned To => XuN
02-11-14 19:17 Rizz Note Added: 0002559
02-11-14 19:17 Rizz Status resolved => feedback
02-11-14 19:17 Rizz Resolution fixed => reopened
04-11-14 16:47 XuN Note Added: 0002561
04-11-14 20:13 Rizz Note Added: 0002562
04-11-14 20:13 Rizz Status feedback => assigned
10-12-14 00:25 Rizz Note Added: 0002581
29-12-14 21:45 Terrikate Issue Monitored: Terrikate
24-01-15 19:10 XuN Note Added: 0002651
19-03-15 21:43 Rizz Note Added: 0002738
20-03-15 09:41 XuN Note Added: 0002739
20-03-15 11:08 Rizz Note Added: 0002740
20-03-15 13:36 XuN Note Added: 0002741
21-03-15 21:34 Rizz Note Added: 0002743
09-04-15 21:31 Rizz Note Added: 0002759
10-04-15 11:45 XuN Note Added: 0002760
11-04-15 13:01 Rizz Note Added: 0002761
11-04-15 16:12 XuN Note Added: 0002763
11-04-15 16:12 XuN Status assigned => resolved
11-04-15 16:12 XuN Resolution reopened => fixed


Copyright © 2000 - 2010 MantisBT Group
Powered by Mantis Bugtracker