PDA

View Full Version : Charges!



Kluckmuck
01-21-2011, 05:06 AM
So this is the first time I'm trying todo a charge based skill, and the most advanced I've done yet so obviously there are alot of bugs.
Basicly I want a channeling spell that gives you 1 charge for every 0.1 seconds you channel. The amount of charges you can store are based on lvl (20/40/60/80/100/100). When you reach maximum charges (or detonate it manually, dont really know how to this either, maybe double click if it works for abilitys) I want it to spawn a affector that does AoE damage based on how many charges you have.
And heres the code:

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




statuseffecttooltip="State_Behemoth_Ability2"
icon="icon.tga"
anim="ability_3"
casttime="500"
castactiontime="690"
channeltime="2000,4000,6000,8000,10000"
ischanneling="true"

maxlevel="6"
requiredlevel="1"

actiontype="target_self"
casteffecttype=""

manacost="0"
cooldowntime="7000"

targetscheme=""

maxcharges="20,40,60,80,100"
initialcharges="0"
>

<onlearn>
<setcharges a="1" />
</onlearn>

<onchannelframe>
<printdebuginfo />
<condition test="charges == 20">
<playeffect effect="/heroes/behemoth/ability_03/effects/impact.effect" />
</condition>
<condition test="charges == 40">
<playeffect effect="/heroes/behemoth/ability_03/effects/impact.effect" />
</condition>
<condition test="charges == 60">
<playeffect effect="/heroes/behemoth/ability_03/effects/impact.effect" />
</condition>
<condition test="charges == 80">
<playeffect effect="/heroes/behemoth/ability_03/effects/impact.effect" />
</condition>
<condition test="charges == 100">
<playeffect effect="/heroes/behemoth/ability_03/effects/impact.effect" />
</condition>
<pushstack a="20,40,60,80,100" />
<condition test="charges == result">
<spawnaffector name="Affector_Explode" target="source_entity" proxy="source_entity" />
<playeffect effect="/heroes/behemoth/ability_03/effects/impact.effect" />
</condition>
<applystate name="State_Explode" target="source_entity" proxy="this_entity" pushentity="true"/>
</onchannelframe>

<onchannelstart>
<playeffect effect="effects/cast.effect" source="target_position" occlude="true"/>
</onchannelstart>
</ability>


<?xml version="1.0" encoding="UTF-8"?>
<state
name="State_Explode"

icon="icon.tga"
passiveeffect="effects/state.effect"
effecttype="StatusDebuff"
duration="2000,4000,6000,8000,10000"
impactinterval="100"

>

<onimpact>
<addcharges count="1" entity="this_spawner_entity">
</onimpact>

</state>


<?xml version="1.0" encoding="UTF-8"?>
<affector
name="Affector_Explode"

radius="150"
targetselection="all"
targetscheme="enemy_units"
effecttype="Magic"
destroytrees="true"
model=""

impacteffect="/heroes/krixi/effects/ability_01/ability_01.effect"
>
<onimpact>
<damage effecttype="Magic" amount="80,95,110,125,140,155" />
<popup name="Spell_dmg" a="result" source="target_entity" target="source_entity"/>
</onimpact>
</affector>


Any help is appreciated :magm:

Oloko
01-21-2011, 08:16 AM
Your ability says maxlevel="6", but you only have 5 set of maxcharges. Anyway, here is the ability:


<onlearn>
<setcharges a="0" />
</onlearn>

<onimpact />

<onchannelstart>
<playeffect effect="effects/cast.effect" source="target_position" occlude="true"/>
<applystate name="State_Explode" target="source_entity" ischannel="true" />
</onchannelstart>

<onchannelframe>
<pushstack a="20,40,60,80,100" />
<condition test="charges == result">
<order command="stop" source="source_entity" target="source_entity" />
</condition>
</onchannelframe>
Here is the self state. Make sure not to useeffecttype="StatusDebuff" since it could be purged. Be sure to keep <addcharges count="0" entity="this_spawner_entity" /> since it's used to get the number of charges on the ability.


<state
name="State_Explode"

icon="icon.tga"
passiveeffect="effects/state.effect"
impactinterval="100"
>

<onimpact>
<addcharges count="1" entity="this_spawner_entity" />
</onimpact>

<onexpired>
<addcharges count="0" entity="this_spawner_entity" />
<evaluate a="result" b="80,95,110,125" op="mult" />
<spawnaffector name="Affector_Explode" target="source_entity" param="result" />
<playeffect effect="/heroes/behemoth/ability_03/effects/impact.effect" />
<setcharges entity="this_spawner_entity" a="0" />
</onexpired>
</state>Here is the affector:


<affector
name="Affector_Explode"

radius="150"
targetselection="all"
targetscheme="enemy_units"
effecttype="Magic"
destroytrees="true"
model=""

impacteffect="/heroes/krixi/effects/ability_01/ability_01.effect"
>
<onimpact>
<damage effecttype="Magic" amount="1" b="param" op="mult" />
<popup name="Spell_dmg" a="result" source="target_entity" target="source_entity"/>
</onimpact>
</affector>This is the basic idea, there is multiple way to do it. I tested it myself, so it should work fine.

Kluckmuck
01-21-2011, 12:10 PM
Epic! btw, do you know how to use doubleactivate? When I check the items that use them there is zero info except doubleactivate="true"....

And I just use <inventory1="Ability_Blink" target="source_entity" /> to set the skill. Dont know if it works, but I cant see why not.

Oloko
01-21-2011, 07:10 PM
Epic! btw, do you know how to use doubleactivate? When I check the items that use them there is zero info except doubleactivate="true"....

And I just use <inventory1="Ability_Blink" target="source_entity" /> to set the skill. Dont know if it works, but I cant see why not.

My guess is that the flag doubleactivate start a hard-coded order to your hero to use the item and target himself with it.

<inventory1 ... /> is not a valid command, so its no wonder that it doesn't work. If you could explain what you are trying to do, I might be able to help you more.

Kluckmuck
01-21-2011, 07:40 PM
I'm trying to create a shop were you can buy abilitys and level, just like in Warlock. And are you sure? They use it in hero.entity to set your spells.
Edit: Would you need a custom ui for it?

Oloko
01-21-2011, 08:35 PM
I'm trying to create a shop were you can buy abilitys and level, just like in Warlock. And are you sure? They use it in hero.entity to set your spells.
Edit: Would you need a custom ui for it?

I know they set the inventory in hero.entity, all I am saying is to edit those values, you will need a modifier.
You can do what you are talking about, I did it this way in my version of Warlock:

You set a modifier for every spell in your hero.entity file, like this:


<modifier key="lightning" modpriority="100"
inventory4="Ability_Lightning"
/>

<modifier key="scourge" modpriority="100"
inventory8="Ability_Scourge"
/>

...You set all the inventory value empty at first, so that you have no spell when you start.
Then you create states that give the modifier like for lightning:


<state
name="State_Lightning_Learn"

ishidden="true"
modifierkey="lightning"
deathpersist="true"
>
</state>
So when you put this state on your hero, he will gain the lightning modifier, which will give him the lightning spell at the same time. The deathpersist is really important, since he would loose all of his spell if he died and it wasn't deathpersist.

Then to buy the spell, you would create the following item:


<item
name="Item_Spells_Lightning1"

icon="/heroes/kunas/icons/ability_1.tga"

cost="9"

actiontype="passive"
>
<onpurchase>
<applystate name="State_Lightning_Learn" target="target_entity" continuous="true" />
<pushability source="target_entity" name="Ability_Lightning" />
<setlevel entity="stack_entity" value="1" />
<delete target="this_entity" />
</onpurchase>
</item>The <applystate name="State_Lightning_Learn" target="target_entity" continuous="true" />, like I said, would give the hero the spell.
<pushability source="target_entity" name="Ability_Lightning" /> is used to get the actual spell and add it to a queue. This will let you manipulate it.
<setlevel entity="stack_entity" value="1" /> will set the level of the spell in the queue (lightning in this case) to level 1.
thehn using <delete target="this_entity" /> we delete the item from the inventory of the hero.

Of course this mean the player need to at least have a slot opened in his inventory.
This is only the basic on how to do this. You will need more scripts to get a leveling system for your spell.

Kluckmuck
01-22-2011, 04:22 AM
Thanks, good to know its possible! Are you soon done with warlock then?

I had a issue getting items to work too... They didnt really show up in my shop. I added it in entities_en.str file, is there any other random place?

Edit: What if I make a custom ui that pops up when you buy the item, where I can choose where to set the skill? And then I just have eight different modifiers and states. I havent tried using custom ui, so I dont really know whats possible.

Oloko
01-22-2011, 10:51 AM
Thanks, good to know its possible! Are you soon done with warlock then?

I had a issue getting items to work too... They didnt really show up in my shop. I added it in entities_en.str file, is there any other random place?

Edit: What if I make a custom ui that pops up when you buy the item, where I can choose where to set the skill? And then I just have eight different modifiers and states. I havent tried using custom ui, so I dont really know whats possible.

To change items inside a shop, you need to get in the /items/shops/ folder or resources0.s2z.
In that folder, you have all shops in the game. So copy those that you want to edit. In my case, I usually copy all of them, since I don't want to have official HoN items in my map.
Inside each shop item, you will have a list of item with <ětem name="..." />.
So remove those you don't want and add those that you want.

As for the UI, I can't help you much, since I don't make custom UI. I know that inside each shop entity, you have a slot attribute that seems to be used in the UI. I'm pretty sure you could create your own shop UI and makes it look like you want.

Kluckmuck
01-22-2011, 11:22 AM
Yeah, forgot it wouldnt work anyways as you would need more then 20 modifiers.
Is it possible todo
<setlevel entity="stack_entity" value="+1" />
?
Or how would you do to just increase the skill one lvl
And how many spells can you have at the same time?