News:

SMFNew Installed

+-+-

User+-

Welcome, Guest.
Please login or register.
 
 
 

Login with your social network

Forgot your password?

Site Stats+-

Members
Total Members: 728
Latest: Cho
New This Month: 0
New This Week: 0
New Today: 0
Stats
Total Posts: 10932
Total Topics: 795
Most Online Today: 389
Most Online Ever: 854
(September 18, 2024, 07:49:37 am)
Users Online
Members: 0
Guests: 281
Total: 281

Author Topic: Counting summoned creatures -- add stat adding too many?  (Read 2119 times)

0 Members and 130 Guests are viewing this topic.

Counting summoned creatures -- add stat adding too many?
« on: »
I'm creating a druid class and I'm using the SynergiesMod as an example (Necromancer specifically). I'm trying to show a UI so that the user knows how many summons they have. The pets are casting a skill on the owner (actually the way Salan has it, it is cast on EVERYBODY with a unit filter). That skill has this code:
Code: [Select]
[SKILL]
<STRING>NAME:DRUID_BIRDS_OF_PREY_INCREMENT
<STRING>ACTIVATION_TYPE:NORMAL
<STRING>TARGET_ALIGNMENT:GOOD
<FLOAT>RANGE:100
<INTEGER>COOLDOWNMS:500000
<FLOAT>TURNRATEOVERRIDE:-1
<BOOL>ALLOWS_TURNING:0
<STRING>TARGET:SELF
<INTEGER64>UNIQUE_GUID:-7592736233991313849
[LEVEL1]
<FLOAT>RANDOMRANGE:0
[EVENT_END]
<STRING>FILE:media/skills/druid/count_summons/counterdmgshape.layout
<BOOL>PLACEONTARGET:1
<BOOL>DAMAGESHAPES_HIT_ONCE:1
<BOOL>APPLYEFFECTS:1
[TARGET_SPECIFIC_UNITS]
<STRING>UNIT:HUM_DRUID_M
<STRING>UNIT:HUM_DRUID_F
[/TARGET_SPECIFIC_UNITS]
[EFFECTS]
<STRING>TARGET:EVERYBODY
[EFFECT]
<STRING>NAME:DRUID_BIRDS_OF_PREY_COUNT
<STRING>ACTIVATION:DYNAMIC
<STRING>DURATION:INSTANT
<STRING>TYPE:ADD STAT
<FLOAT>MIN:1
<FLOAT>MAX:1
<FLOAT>CHANCE:100
[/EFFECT]
[/EFFECTS]
[/EVENT_END]
[/LEVEL1]
[/SKILL]

I am summoning two birds. I can see both being summoned in the log and that both birds are casting the skill. What is odd is that my UI is showing 3 or sometimes 4, not 2. I don't know where the extra value is coming from. I've also seen (if I don't set the max pets attribute on the monster) that sometimes 4 get summoned instead of 2 even though my unit spawner specifically summons 2. The console only ever shows 2 being summoned which is odd to me as well.

Obviously not ideal at all. I haven't checked it in the game yet, only guts.

Any idea on what may be causing such an issue?

Top portion of the summon skill:
Code: [Select]
[SKILL]
<STRING>NAME:DRUID_BIRDS_OF_PREY
<TRANSLATE>DISPLAYNAME:Birds of Prey
<TRANSLATE>BASE_DESCRIPTION:You summon birds of prey to fight for you. Initially two birds are summoned.
<TRANSLATE>TIER1_DESCRIPTION:Summon duration increased to 30 seconds
<TRANSLATE>TIER2_DESCRIPTION:Decreased cooldown to 15 seconds
<TRANSLATE>TIER3_DESCRIPTION:Three birds are summoned
<STRING>SKILL_ICON:skillicon_druid_birds_of_prey
<STRING>SKILL_ICON_INACTIVE:skillicon_druid_birds_of_prey_gray
<STRING>ACTIVATION_TYPE:NORMAL
<STRING>ANIMATION:Emo_Cmon
<FLOAT>RANDOMRANGE:0
<FLOAT>RANGE:8
<STRING>MANA_COST_GRAPH:MANACOST_NORMAL
<FLOAT>TURNRATEOVERRIDE:-1
<STRING>REQUIREMENT_GRAPH:SKILLTIER1
<BOOL>CAN_BE_SILENCED:0
<INTEGER>LEVEL_REQUIRED:0
<BOOL>IGNORES_LOS:1
<BOOL>REQUIRES_PATHABLE:1
<STRING>TARGET:POSITION
<INTEGER>MAX_INVEST_LEVEL:15
<INTEGER64>UNIQUE_GUID:1963353408761571897
[LEVEL1]
<FLOAT>RANDOMRANGE:0
<INTEGER>COOLDOWNMS:45000
[EVENT_START]
<STRING>FILE:media/skills/druid/birds_of_prey/warmup.layout
<BOOL>ATTACHIGNORESOBSTRUCTIONS:1
<STRING>TRIGGERNAME:hit
[/EVENT_START]
[EVENT_TRIGGER]
<STRING>FILE:media/skills/druid/birds_of_prey/summon_1.layout
<BOOL>NOSTEALEFFECTS:0
<BOOL>PLACEONTARGET:1
<BOOL>DAMAGESHAPES_HIT_ONCE:1
<BOOL>STATSHIDDEN:1
[EFFECTS]
<STRING>TARGET:SELF
[EFFECT]
<STRING>NAME:DRUID_BIRDS_OF_PREY_COUNT
<STRING>ACTIVATION:DYNAMIC
<STRING>DURATION:INSTANT
<STRING>TYPE:CLEAR STAT
<FLOAT>MIN:0
<FLOAT>MAX:0
<FLOAT>CHANCE:100
[/EFFECT]
[/EFFECTS]
[AFFIXES]
<INTEGER>AFFIXLEVEL:20
<STRING>TARGET:PET
<STRING>AFFIX:DRUID_SUMMON_DURATION
[/AFFIXES]
[/EVENT_TRIGGER]
[EVENT_TRIGGER_FOUR]
<BOOL>CAN_CLONE:0
[AFFIXES]
<STRING>AFFIX:DRUID_DUMMY_BOP_DAMAGE_1
[/AFFIXES]
[AFFIXES]
<INTEGER>AFFIXLEVEL:20
<STRING>TARGET:PET
<STRING>AFFIX:DRUID_SUMMON_DURATION
[/AFFIXES]
[/EVENT_TRIGGER_FOUR]
[/LEVEL1]

Summon_1.layout:
Code: [Select]
[Layout]
<INTEGER>VERSION:4
<UNSIGNED INT>COUNT:2
[OBJECTS]
[BASEOBJECT]
[PROPERTIES]
<STRING>DESCRIPTOR:Timeline
<STRING>NAME:Timeline
<INTEGER64>ID:6370551146719403079
<INTEGER64>PARENTID:-1
<BOOL>START ON LOAD:false
<STRING>NAME:Timeline
[TIMELINEDATA]
<INTEGER64>ID:6370551146719403079
[TIMELINEOBJECT]
<INTEGER64>OBJECTID:8417972837338781406
[TIMELINEOBJECTEVENT]
<STRING>OBJECTEVENTNAME:Spawn Units
[TIMELINEPOINT]
<FLOAT>TIMEPERCENT:0
<STRING>INTERPOLATION:Linear
[/TIMELINEPOINT]
[/TIMELINEOBJECTEVENT]
[/TIMELINEOBJECT]
[/TIMELINEDATA]
[/PROPERTIES]
[CHILDREN]
[/CHILDREN]
[/BASEOBJECT]
[BASEOBJECT]
[PROPERTIES]
<STRING>DESCRIPTOR:Unit Spawner
<STRING>NAME:Unit Spawner
<INTEGER64>ID:8417972837338781406
<INTEGER64>PARENTID:-1
<STRING>RELEASE ORDER:Random
<STRING>MAX RADIUS:0,4
<UNSIGNED INT>COUNT:2
<BOOL>SPAWN ON CREATE:false
<BOOL>SPAWN IN CENTER:true
<STRING>RESOURCE:DRUID_BIRD_OF_PREY_1
[/PROPERTIES]
[CHILDREN]
[/CHILDREN]
[/BASEOBJECT]
[/OBJECTS]
[/Layout]


Share on Bluesky Share on Facebook


Re: Counting summoned creatures -- add stat adding too many?
« Reply #1 on: »
1. One possibility is that there's no guarantee for the order of the CLEAR STAT and the ADD STAT calls in your skill. That might explain random behavior. In order to guarantee CLEAR STAT comes first, put it in an EVENT_START block. If you don't want to do that (because the spell is cancellable, interruptible, whatever), then you can get a probabilistic guarantee that the CLEAR STAT will come first by adjusting the timeline in layout so that the unit spawner doesn't flip on for at least 100ms or so. If I remember correctly, EVENT_TRIGGER blocks are executed in order, so you could also use two separate EVENT_TRIGGER blocks to enforce the call order. (Aside: I always use SET STAT rather than CLEAR STAT so that I'm 100% confident of what my stat is getting set to.)

2. Another possibility is maybe you're using an animation that pops the trigger twice? Try setting the EVENT_TRIGGER block containing your layout to <BOOL>CAN_CLONE:0

3. Is the damage shape in the pet skill looping? Is the timeline?

4. Aside: I've encountered lots of outright buggy behavior doing stat manipulation in an EFFECTS block. Sometimes doing the exact same thing in an AFFIXES block fixes the problem. No idea why.

5. Aside: Same deal with doing stat manipulation in an EVENT_END block. In fact, I have never -- not even once -- got a stat manipulation to work properly in an EVENT_END block. Again, sometimes the exact same thing will work if it's moved to a different kind of block. In this case, I think that part of the problem (but maybe not the whole problem) is due to the fact that skills seem to have an unmodifiable minimum running time that makes the EVENT_END come a lot later than you'd think it should.

6. Totally unrelated to your problem, but needed for your skill: The pet skill should use FORCE_OWNER as the target type for the effects. The major reason for this is to make it work right in multiplayer. You don't want to go around incrementing other player's pet counters. A secondary reason is that it allows you to not have to use a damage shape, which helps performance and avoids any possibility of mucking up the layout.

7. Aside: You're going to need something to decrement the counter when the pets die. But you probably already knew that.

Re: Counting summoned creatures -- add stat adding too many?
« Reply #2 on: »
Unfortunately that did not help. The increment damage shape is on a delay, but even so, the CLEAR STAT really isn't needed as the stat is 0. So it is going from 0 to 2, 3 or 4. I tried the CAN_CLONE, and it did not make a difference. The ANIMATION file only has one HIT too, so there should not be multiple firing. The timeline is set to looping false and I'm not familiar with a looping property of a spawner (the code is in my original post for the layout).

I'll try moving the effects to an AFFIX, that is good to know about it possibly being buggy.

I was curious about "FORCE_OWNER" and actually I was going to use "OWNER". The issue I had is that I can find no document on what FORCE_OWNER is. Is there some documentation that I am missing?

At this point I'm just trying to get it to work. This is originally from SynergiesMod. I had my own version with no pet skills at all that I set the stat in the summon block and used a "CAST SKILL ON DEATH FROM EFFECT OWNER", but for some reason that always worked in guts, but in the real game it was not always firing. It seemed to fail if the summon was further from me when it died. I'm going to keep trying. Thanks for the input.

Re: Counting summoned creatures -- add stat adding too many?
« Reply #3 on: »
By adding the affix, the console log shows that the COUNT affix (cast from the pet spell) is being applied twice. Even adding the CAN_CLONE to the EVENT_START does not help. It may simply be an issue with a spell that has no animation that is NORMAL activation. I'll try making it a PASSIVE or giving it an animation and see if I have better luck.

Re: Counting summoned creatures -- add stat adding too many?
« Reply #4 on: »
While I am still curious of why this is buggy, I think I'm going to strip this code. Only 2 of my summons have multiple minions and I'm thinking it is not worth the effort of implementing, especially if the count is not always accurate.

Re: Counting summoned creatures -- add stat adding too many?
« Reply #5 on: »
I believe there should be some way to get the general control flow you're working on to work. Even if you're ready to throw in the towel on this plan, there's at least two more ways to do this:

1. Have the summon skill increment the counter directly, so you only need to manage decrements from the pets dying.

2. Make a looping skill that counts the pets periodically.

Re: Counting summoned creatures -- add stat adding too many?
« Reply #6 on: »
Quote
        [EVENT_END]
            <STRING>FILE:media/skills/druid/count_summons/counterdmgshape.layout
            <BOOL>PLACEONTARGET:1
            <BOOL>DAMAGESHAPES_HIT_ONCE:1
            <BOOL>APPLYEFFECTS:1

Try deleting this line.

Iirc, <Bool>ApplyEffects causes an Event class to apply its effects to its target independently of a damage shape.  Using a damage shape in conjunction with this variable has given me instances in the past where I had doubly applied Affixes and Effects.  It shouldn't affect the number of creatures summoned, however.

Re: Counting summoned creatures -- add stat adding too many?
« Reply #7 on: »
Quote
        [EVENT_END]
            <STRING>FILE:media/skills/druid/count_summons/counterdmgshape.layout
            <BOOL>PLACEONTARGET:1
            <BOOL>DAMAGESHAPES_HIT_ONCE:1
            <BOOL>APPLYEFFECTS:1

Try deleting this line.

Iirc, <Bool>ApplyEffects causes an Event class to apply its effects to its target independently of a damage shape.  Using a damage shape in conjunction with this variable has given me instances in the past where I had doubly applied Affixes and Effects.  It shouldn't affect the number of creatures summoned, however.

Bet that's it. I'm kicking myself for not seeing that one.

 

Recent Topics+-