Torchmodders

Modding => Modding Questions => Topic started by: Haxley on August 16, 2016, 09:14:30 pm


Title: Force-cast skill from target
Post by: Haxley on August 16, 2016, 09:14:30 pm
One of my skill mechanics requires a skill to be casted with the target as the parent.

The real focus: It will cause the target to have a 'pull' effect on other enemies around it, causing it to act as a sort of magnet in order to cluster the others around it.


So far I've tried many variations of the pull/pull effect affix, and it looks like I can get a makeshift result by using Cast Skill on an affix, but the result is still not 'correct'.

Long story short, I want to make one enemy draw in other enemies around in, for a short duration.

Is there a way to go about this that I may be overlooking?

edit: I found:
Code: [Select]
<BOOL>CASTFROMTARGET:1
[EXECUTE_SKILL]
<STRING>SKILL:SKILLHERE
[/EXECUTE_SKILL]

But I'm not sure how to implement it, I couldn't produce anything using it; I'm still learning the ins and outs of the skill mechanics so I apologize if this is something simple
Title: Re: Force-cast skill from target
Post by: Phanjam on August 17, 2016, 10:28:48 am
Heyya Hax! Mechanically that's practically identical to the Alch "Emberstrike" skill in TL1CP.

Emberstrike first spawns the puller unit with a layout, then puts an affix on it to give it the pulling skill.  Here's the trigger block for that...

Code: [Select]
[EVENT_TRIGGER]
<STRING>FILE:media/skills/alchemist/emberstrike/ES_PULL_SPAWNER.layout
<BOOL>PLACEONTARGET:true
<BOOL>STATSHIDDEN:true
[AFFIXES]
<STRING>TARGET:PET
<INTEGER>AFFIXLEVEL:1
<STRING>AFFIX:EMBERSTRIKE_CAST_PULL1
[/AFFIXES]
[/EVENT_TRIGGER]

The affix just gives the unit the skill...

Code: [Select]
[AFFIX]
<STRING>NAME:EMBERSTRIKE_CAST_PULL1
<INTEGER>RANK:0
<INTEGER>MIN_SPAWN_RANGE:0
<INTEGER>MAX_SPAWN_RANGE:999
<FLOAT>DURATION:0
<INTEGER>WEIGHT:0
<INTEGER>SLOTS_OCCUPY:0
[EFFECT]
<STRING>NAME:ES_PULL_SKILL1
<STRING>ACTIVATION:DYNAMIC
<STRING>DURATION:INSTANT
<STRING>TYPE:CAST SKILL
<FLOAT>MIN:100
<FLOAT>MAX:100
[/EFFECT]
[/AFFIX]

And the pull skill itself is...

Code: [Select]
[SKILL]
<STRING>NAME:ES_PULL_SKILL1
<TRANSLATE>DISPLAYNAME:Emberstrike Pull Skill
<STRING>ACTIVATION_TYPE:NORMAL
<STRING>TARGET_ALIGNMENT:EVIL
<STRING>TARGET_TYPE:SELF
<FLOAT>RANDOMRANGE:0
<FLOAT>RANGE:8
<FLOAT>MANA_GRAPH_SCALE:0
<FLOAT>SPEED:0
<INTEGER>COOLDOWNMS:2000
<FLOAT>FINDTARGETANGLE:360
<FLOAT>TURNRATEOVERRIDE:-1
<BOOL>DONT_STOP_ON_DEATH:1
<BOOL>CAN_BE_SILENCED:0
<INTEGER64>UNIQUE_GUID:9161673935867999901
[LEVEL1]
[EVENT_START]
<STRING>FILE:media/skills/alchemist/emberstrike/es_pull_shape1.layout
<INTEGER>MAX_UNITS_HIT:100
[/EVENT_START]
[EVENT_UNITHIT]
[AFFIXES]
<STRING>TARGET:ENEMY
<INTEGER>AFFIXLEVEL:1
<STRING>AFFIX:EMBERSTRIKEPULL
[/AFFIXES]
[/EVENT_UNITHIT]
[/LEVEL1]
[/SKILL]

That first layout in the pull skill has like a 4-second timeline, so the pull effect gets applied for that duration to any unit inside the damage shape.

Finally the pull affix is...

Code: [Select]
[AFFIX]
<STRING>NAME:EMBERSTRIKEPULL
<INTEGER>RANK:0
<INTEGER>MIN_SPAWN_RANGE:0
<INTEGER>MAX_SPAWN_RANGE:999
<FLOAT>DURATION:0
<INTEGER>WEIGHT:0
<INTEGER>SLOTS_OCCUPY:0
[EFFECT]
<STRING>ACTIVATION:DYNAMIC
<STRING>DURATION:INSTANT
<STRING>TYPE:PULL
<FLOAT>TIME:3
<FLOAT>EFFECT_DURATION:-1
[/EFFECT]
[EFFECT]
<STRING>ACTIVATION:DYNAMIC
<STRING>DURATION:4
<STRING>TYPE:PERCENT ATTACK SPEED
<FLOAT>MIN:-50
<FLOAT>MAX:-50
[/EFFECT]
[EFFECT]
<STRING>ACTIVATION:DYNAMIC
<STRING>DURATION:4
<STRING>TYPE:PERCENT SPEED
<FLOAT>MIN:-50
<FLOAT>MAX:-50
[/EFFECT]
[/AFFIX]

Hope this helps ya!
Title: Re: Force-cast skill from target
Post by: Haxley on August 18, 2016, 07:26:35 am
Thanks so much for the reply, Phan! I'm at work right this second but I'm going to work to flush in your code and see if I can get my skill working.

I knew I could depend on you brainiacs behind the TL1CP :P

Thanks again man! \o/

- Will post back with an edit/update about how it's going
Title: Re: Force-cast skill from target
Post by: Phanjam on August 19, 2016, 04:06:46 am
Hope it works for u!

I forgot to mention, the pulling unit is a "dummy" unit spawned by the skill for no other purpose but to cast the pull skill. It's set to be invisible and to have a duration of only 4 seconds, same as the duration of the timeline.

EDIT
Here's the innards of the dummy unit .DAT file...

Code: [Select]
[UNIT]
<STRING>BASEFILE:media/units/monsters/base.dat
<STRING>NAME:ES_INVIS_PULLER
<FLOAT>MINHP:40
<FLOAT>MAXHP:60
<FLOAT>SCALE:1
<FLOAT>FOLLOW_RADIUS:0
<FLOAT>MOTION_RADIUS:20
<INTEGER>MAXIMUM_PET_INSTANCES:100
<INTEGER>ARMOR:100
<INTEGER>MINDAMAGE:50
<INTEGER>MAXDAMAGE:75
<FLOAT>WALKINGSPEED:0
<FLOAT>RUNNINGSPEED:0
<FLOAT>TURN_RATE:0
<FLOAT>VIEW_ANGLE:360
<STRING>STRIKE_SOUND:WoodFlesh
<STRING>ATTACK_SOUND:StaffSwing
<STRING>MISS_SOUND:Miss
<TRANSLATE>DISPLAYNAME:Emberstrike Invisible Puller
<INTEGER>DAMAGE_POISON:0
<INTEGER>DAMAGE_PHYSICAL:100
<FLOAT>ATTACKANGLE:360
<FLOAT>DAMAGE_REACT_RADIUS:20
<FLOAT>COLLISION_RADIUS:0
<INTEGER>XP:0
<STRING>UNITTYPE:PETNOFOLLOW
<STRING>RESOURCEDIRECTORY:media/models/ImaginaryPet
<STRING>PET_FAMILY_NAME:PULLINVIS
<BOOL>SPAWN_INVISIBLE:true
<BOOL>CREATE_INVISIBLE:true
<BOOL>DESTROY_ON_DEATH:true
<BOOL>COLLIDEABLE:false
<BOOL>OCCUPIESNODES:false
<BOOL>DAMAGEABLE:false
<BOOL>CANMOUSEOVER:false
<BOOL>TARGETABLE:false
<BOOL>RENDERBEHIND:false
<BOOL>SPAWNGOLD:false
<BOOL>NO_UNARMED_ATTACKS:true
<BOOL>DIES_ON_WARP:true
<BOOL>RIMLIT:false
<BOOL>DIES_ON_MASTER_DEATH:true
<BOOL>AUTO_WEAPON_SWAP:false
<STRING>UNIT_GUID:5797509301893795377
<FLOAT>SIGHT_RADIUS:20
[EFFECT]
<STRING>ACTIVATION:DYNAMIC
<STRING>DURATION:4
<STRING>TYPE:SUMMON DURATION
<BOOL>NOGRAPH:true
<BOOL>SAVE:true
<FLOAT>MIN:4
<FLOAT>MAX:4
[/EFFECT]
[/UNIT]
Title: Re: Force-cast skill from target
Post by: Chthon on August 19, 2016, 03:22:56 pm
Just FYI: You can use the method described by Phanjam directly on an enemy. Just apply a CAST SKILL effect to the enemy with duration of INSTANT and a chance of 100%, and the monster will immediate cast the specified skill. (Remember to design the force-cast subskill from the monster's point of view (i.e., other monsters are allies)).
Title: Re: Force-cast skill from target
Post by: Phanjam on August 20, 2016, 10:49:01 am
Thanks Chthon!
Title: Re: Force-cast skill from target
Post by: Haxley on August 21, 2016, 02:17:14 am
This is still stumping me so bad.

Using Cthons method of attaching a CASTSKILL on the target sorta works, I can't get it to target other enemies and NOT me.

The idea is for the enemy itself to project the pull effect so when other enemies are hit they are draw to -it-

I must be doing something wrong but your suggestion seems fairly accurate, Cthon, my issue is I can't figure out how to get the enemy to target the other enemies and not me, my pet or the real player allies.
Title: Re: Force-cast skill from target
Post by: Phanjam on August 21, 2016, 07:56:13 am
Thats where i think you need to take note of Chthon's point...
Remember to design the force-cast subskill from the monster's point of view (i.e., other monsters are allies).
I think there's an ALIGNMENT setting for skills, so for this one you need to align it as GOOD so it targets the monsters allies instead of you.
Title: Re: Force-cast skill from target
Post by: Haxley on August 21, 2016, 10:07:51 am
It still seems to pull me to the enemy instead of the other monsters, I'll do a lot more testing and see what I come up with
Title: Re: Force-cast skill from target
Post by: Phanjam on August 22, 2016, 07:17:35 am
I u like u can paste the code in a reply here; id be happy to take a look :)
Title: Re: Force-cast skill from target
Post by: Haxley on September 15, 2016, 08:05:36 am
I've been trying to attach this for weeks x.x

I'm still getting the result of: The enemy casts the skill, and I get drawn in.

This is regardless of how I set the targeting of the pull skill itself, I've tried setting it up as offensive to hit ALIGNMENT:EVIL, and it hit me, as expected.

I've tried setting it up as a 'defensive' skill that targets 'Alignment:GOOD', and I've even tried using PLAYERSANDPETS in the affix target. No matter what, for some reason I cannot get the affix to apply onto the enemy
Title: Re: Force-cast skill from target
Post by: Chthon on September 27, 2016, 04:56:41 pm
Please post your code. I'll try to debug it this upcoming weekend.