Post Reply 
 
Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Combat - swing timer
Author Message
Indiaret
Apprentice
*

Posts: 45
Likes Given: 3
Likes Received: 1 in 1 posts
Joined: Apr 2016
Reputation: 0



Post: #1
Combat - swing timer
Hi,

Trying to make swing delay between triggers hittry and hit, and cannot resolve it. Using sphere 56d.

I tried timerd, argn1 in @HitTry but nothing works for it. Still same fast attack no matter what is in this variables. In @SkillStart timerd works properly for swing delay.
Is there any error or how can i change it ? Tried also local.animDelay, but it dont work precisely.

I have this source code for combat:
Code:
[events e_combat_test]
on=@SkillStart
timerd=30 //Delay before hitcheck

on=@Attack
tag.lt=<src>

on=@HitCheck
if (<region.safe> || <src.region.safe>)
    return -1
endif
if (<region.nopvp> || <src.region.nopvp>)
  if (<src.isplayer>)
    return -1
  endif
endif
if ((<flags>&statf_dead) || (<flags>&statf_stone)|| (<flags>&statf_sleeping))
    return -1
endif
if (<flags>&statf_freeze)
    return 1
endif
if ((<src.flags>&statf_dead) || <src.hits><1)
    return -1
endif
if !(<canSeeLos <src>>)
  return 1
endif

if (<weapon>)
  if (<IsSkillRanged <action>>) // Archery
    if (<weapon.range> != 6)
      weapon.range=6
    endif
  else
    if (<argn1>==1) //Naprah
      if !(<tag.hittryRangeSet>)
        weapon.range=1
        tag.hittryRangeSet=1
      endif
    elif (<argn1>==2) //Hit
      if !(<tag.hitRangeSet>)
        weapon.range=2
        tag.hitRangeSet=1
      endif
    endif
  endif
endif
return 0

on=@HitTry
timerd=6000
sysmessage argn1: <argn1>
argn1=6000
sysmessage argn1 after: <argn1>
return 0

on=@Hit
tag.hittryRangeSet=0
tag.hitRangeSet=0

on=@HitMiss
tag.hittryRangeSet=0
tag.hitRangeSet=0

Thanks.
03-02-2019 03:03 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: #2
RE: Combat - swing timer
combat swing have 2 stages: the anim (hit) delay and the total swing delay

the anim delay (LOCAL.AnimDelay) is always 7ms and then the char keep waiting the reimaining delay (ARGN1) until next swing. Eg: if your attack have swing delay 2.0s, the char will deal the damage at 0.7s and will keep waiting more 1.3s to start next swing

so you must balance these 2 values (LOCAL.AnimDelay and ARGN1) when customize swing delay on @HitTry trigger. Also note that these values can be only changed on @HitTry trigger
03-02-2019 04:33 AM
Find all posts by this user Like Post Quote this message in a reply
Indiaret
Apprentice
*

Posts: 45
Likes Given: 3
Likes Received: 1 in 1 posts
Joined: Apr 2016
Reputation: 0



Post: #3
RE: Combat - swing timer
Thanks for answer ...

but that its problem. LOCAL.Animdelay works correctly like u wrote, but argn1 do not. Eg: I have now in script:
Local.animdelay=30 and argn1=100 in trigger @HitTry.
... So my character should deal damage after 3s according to LOCAL.AnimDelay and wait to trigger @Hit next 7s according to argn1, right ? It dont work if I understood well Ranting.

Argn1 have not influence on this. Exactly after 3s it deal damage and combat repeats again.
03-02-2019 05:49 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: #4
RE: Combat - swing timer
try check if you don't have any other event/trigger conflicting with @HitTry / ARGN1 value, I did some quick tests here using this example below and it seems to be working fine
Code:
[EVENTS e_char_event_test]
ON=@HitTry
LOCAL.AnimDelay=30
ARGN1=100
it deal the damage in 3s and keep waiting more 7s until next swing
03-02-2019 08:29 AM
Find all posts by this user Like Post Quote this message in a reply
Indiaret
Apprentice
*

Posts: 45
Likes Given: 3
Likes Received: 1 in 1 posts
Joined: Apr 2016
Reputation: 0



Post: #5
RE: Combat - swing timer
Tried your event ... it works only if u have not other triggers, because argn1 does not stop other triggers. After hit, so after LOCAL.AnimDelay (3s), it starts next triggers ... so @Hit, @SkillAbort, @SkillPreStart and @SkillStart it waits chosen 7s in this trigger.

I have @SkillStart with timerd so it interrupted our argn1 with this, right ? Argn1 in my case can't work properly.

Second problem that Local.animDelay have not synchronized hit with animation. It hits after animation has ended. Hit should be in the middle of animation when i swing exactly close to the character. Is it possible to delay it somehow ?
03-02-2019 10:21 PM
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: Combat - swing timer
probably the TIMER / TIMERD on your script is messing with sphere default action timer. Usually it's not a good idea set an TIMER value directly on chars to avoid conflict with hardcoded values, so if you're already using ARGN1 / LOCAL.AnimDelay on @HitTry trigger, this will already set the char action timer so you don't need to set TIMER=x again
03-10-2019 08:17 AM
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)