PDA

View Full Version : [Support] Spell Effects



Nytemair
05-29-2011, 05:07 AM
Howdy again!

This time my problem doesn't lie in the spell not working, rather the spell looking rather odd.

My general concept is to have a turret spawn above the hero's head, which attacks the closest enemy within range. I based it off Pharaoh's Hellfire and added a projectile, but the turret that is supposed to spawn above my hero, simply spawns on ground level.

Code:
ability.entity:


<?xml version="1.0" encoding="UTF-8"?>
<ability
name="Ability_Chain_Gun"



icon="/heroes/engineer/ability_02/icon.tga"

anim="ability_1"
casttime="0"
castactiontime="0"

maxlevel="1"
requiredlevel="1"

actiontype="target_self"
targetscheme="visible_enemy_units"
targetradius="700"

manacost="0"
cooldowntime="20000"
>
<onimpact >
<spawnunit name="Gadget_Chain_Gun" target="target_entity" bind="target_entity" pushentity="true" lifetime="7000" offsetspace="target_entity" offset="0 0 200" facing="target_entity" />
<spawnaffector name="Affector_Chain_Gun" target="source_entity"/>
</onimpact>
</ability>

gadget.entity


<?xml version="1.0" encoding="UTF-8"?>
<gadget
name="Gadget_Chain_Gun"

model="/heroes/engineer/ability_02/effects/top/model.mdf"
passiveeffect="effects/state.effect"
isselectable="false"
attacktype="none"

sightrangeday=""
sightrangenight=""

deathtime="0"
corpsetime="0"

fadetime="0"

invulnerable="true"
flying="false"
drawonmap="false"
>

</gadget>

To reiterate, the turret spawns, but is bound to my hero on ground level. (Basically in his feet).

Can someone help? <3

Oloko
05-29-2011, 12:17 PM
I know that the bind action has a &quot;vertical&quot; attribute that if set to true will not affect the binded entity's Z position.

So you may want to try adding it to the spawnunit action to see if it works, I never tried so I don't know.

<spawnunit name="Gadget_Chain_Gun" target="target_entity" bind="target_entity" pushentity="true" lifetime="7000" offsetspace="target_entity" offset="0 0 200" facing="target_entity" vertical="true" />

Otherwise you can simply remove the bind from the spawnunit action and use the bind action:

<spawnunit name="Gadget_Chain_Gun" target="target_entity" pushentity="true" lifetime="7000" offsetspace="target_entity" offset="0 0 200" facing="target_entity" />
<bind target="stack_entity" entity="source_entity" vertical="true" />

I'm pretty sure this would work.

Nytemair
05-29-2011, 09:38 PM
Did you learn all this coding somewhere or did you go through the files heaps? :/

Thanks so much hahaa :D

edit: just tested them both, even changed vertical to false and still nothing :/

could it be possible that the model's axis' are upside down? i was thinking of trying -200 on Z but not sure :/

Edit edit: what about flying/flying height? would that work at all?

Nytemair
05-29-2011, 10:26 PM
Just looked through Flint's ultimate, this is where I got the idea for the turret above my head.

Basically both Flint's and Empath's ultimates create effects above the target's head, not gadgets. The effect's coding says this:

position="0 0 250"

I'm guessing that's how they get the effect above the target, but I doubt it's doable with a gadget.

Edit: Just tried making the gadget a flying unit and setting the flyheight to 200 but still no dice. I think it has something to do with binding a flying unit to a ground unit - effectively grounding the flying one.

The spell when cast goes:

Cast -> Turret goes 6782762 miles into the air in a split second, then re-appears at heroes feet. The turret no longer faces the direction my hero is facing now either :[.

Oloko
05-30-2011, 10:10 AM
For the facing, do you want it to face the hero that casted the spell? If that's the case, you will need to change the facing="source_entity". Or maybe you want the turret to turn with the targeted hero, so that it will shoot where the hero is looking? If thats the case, then you will need to set the attribute turn="true" in your <bind /> action.
Also don't bind the entity in the <spawnunit /> action since I think it will bind the given entity to the spawned unit (that mean the targeted hero to the gadget in your case). I think you could use the mount attribute in the <spawnunit /> action, but you are better off using the <bind /> action since you want something more specific.

As for the offset not working, I'll try to take a look tonight or tomorrow since I'm at work right now.

tojooko
05-30-2011, 03:12 PM
Well, I've no idea why Oloko's code doesn't work. I made working code based on Empath's ult

gadget.entity:


<onframe>
<teleport source="this_entity" target="this_owner_entity" interpolate="true" facetarget="true" offset="0 0 300" />

</onframe>


I hope it will help.

About using effect: I'm not sure that will you be able to use animation of turret in effect so... I wouldn't use it

I'll try to work with <bind when I find some time

Nytemair
05-31-2011, 02:04 AM
@Oloko - I wanted the turret to turn with the hero, I'll try <turn> out. I've played around with <mount> as well which didn't help much.

@tojooko - I never thought to teleport it, is that very demanding on the engine?

And the turret has no animations, and is only the top half (no tripod/legs) so I'm thinking of scrapping the idea entirely :/.

Oloko
05-31-2011, 07:19 AM
Ok, so for some strange reason, the documentation said the opposite of what it his. Setting the vertical attribute to true WILL change the Z position, but if its false, it will not.
So I tested the following script and it works:

<spawnunit name="Pet_Engineer_Ability2" target="target_position" pushentity="true" offset="0 0 250" />
<bind entity="target_entity" target="stack_entity" vertical="false" turn="true" />

I simply added flying="true" inside Pet_Engineer_Ability2 otherwise it will always spawn on the ground.

One issue remaining is that the base of the turret will not follow. That is because the base of the turret is created via an effect (base.effect) that does not "move" with the turret. You will need to change the effect file to make it follow the turret. I don't know if it's really complex since I haven't worked a lot with effects.

Nytemair
05-31-2011, 07:28 AM
Ah no wonder I was confused, hope you fixed it! :D

As to your script - I'll try it out when I get a chance but at the moment I'm head first in getting the game modes/arena selection of my map down so people can test it.

Kinda annoying how the turret base doesn't follow, I noticed that while I was probing around engineer's abilities, about the time I realised that projectiles should always have a trail effect hahaha.