|
|
To create your own uniytype its pretty easy, you only have to add unittype="myunittypename" in your entity file.
Then to add this unittype to the target scheme that can target tree, you need to edit the base.gamemechanic file. Search in all the <targetscheme .../> where you can find "tree" in it and add your unittype there too. The thing I'm not too sure about is that some spell uses destroytrees="true" and <killtrees />. I doubt it would work with those spells. Since Loggers Hatchet uses <killtrees />, I'm not too sure it would work, it would at best let you target the gadget, but the gadget wouldn't die. Otherwise you would need to script every ability that destroy trees to do it via scripting to cut down your gadget too.
This is the best solution I can think of, but it still isn't that great.
Last edited by Oloko; 01-10-2011 at 04:58 AM.
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
To create your own uniytype its pretty easy, you only have to add unittype="myunittypename" in your entity file.
Then to add this unittype to the target scheme that can target tree, you need to edit the base.gamemechanic file. Search in all the <targetscheme .../> where you can find "tree" in it and add your unittype there too. The thing I'm not too sure about is that some spell uses destroytrees="true" and <killtrees />. I doubt it would work with those spells. Since Loggers Hatchet uses <killtrees />, I'm not too sure it would work, it would at best let you target the gadget, but the gadget wouldn't die. Otherwise you would need to script every ability that destroy trees to do it via scripting to cut down your gadget too.
This is the best solution I can think of, but it still isn't that great.
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
El problem:
First you use the ability and this happens:
So far so good, working as intended. But then for the actual state. I've got this in there:Code:<onimpact> <applystate name="State_Jungler_Ability1" duration="8000" target="target_entity" proxy="source_entity" /> </onimpact>
The idea is that you link an allied hero so that you take 25% of the incoming damage against him and he only takes 75%. The part that isn't working is the 25% damage portion. The targeted unit takes 25% less damage so that is all good, but the <damage> line isn't working. I've tried using proxy_entity in the target field but no dice. Source_entity doesn't work either and I very much doubt target_entity would work either (I'll test that but I'm pretty sure it can't work like that).Code:<onattackeddamageevent> <damageeffecttype effecttype="DOT" /> <else> <setvar0 a="damage_attempted" b="0.25" op="mult" /> <damage target="source_entity" source="" amount="var0" /> <setvalue name="damage_attempted" a="damage_attempted" b="0.75" op="mult" /> </else> </onattackeddamageevent>
So how do I make the damage refer to the person using this ability? This_owner_entity? Do I need to use something besides <onattackeddamageevent>?
In my mind there is no problem here yet it does not function.
El problem:
First you use the ability and this happens:
So far so good, working as intended. But then for the actual state. I've got this in there:Code:<onimpact> <applystate name="State_Jungler_Ability1" duration="8000" target="target_entity" proxy="source_entity" /> </onimpact>
The idea is that you link an allied hero so that you take 25% of the incoming damage against him and he only takes 75%. The part that isn't working is the 25% damage portion. The targeted unit takes 25% less damage so that is all good, but the <damage> line isn't working. I've tried using proxy_entity in the target field but no dice. Source_entity doesn't work either and I very much doubt target_entity would work either (I'll test that but I'm pretty sure it can't work like that).Code:<onattackeddamageevent> <damageeffecttype effecttype="DOT" /> <else> <setvar0 a="damage_attempted" b="0.25" op="mult" /> <damage target="source_entity" source="" amount="var0" /> <setvalue name="damage_attempted" a="damage_attempted" b="0.75" op="mult" /> </else> </onattackeddamageevent>
So how do I make the damage refer to the person using this ability? This_owner_entity? Do I need to use something besides <onattackeddamageevent>?
In my mind there is no problem here yet it does not function.
Im trying to make a spell, but I'm having some trouble with it (not that experienced).
What is the easiest way to lose some charges per second whenever you gain charges on the spell?
Last edited by Sixerzi; 01-10-2011 at 04:03 PM.
Im trying to make a spell, but I'm having some trouble with it (not that experienced).
What is the easiest way to lose some charges per second whenever you gain charges on the spell?
I don't think you can spawn trees like that and if you could, I think it might have some strange effect (like trees respawning in the minddle of the lane).
I think there was a discussion about spells using trees in this thread, you might want to search the thread for it.
It is target_entity, you can do <printdebuginfo /> to find out all the entites related to the event when you need to do something like this. Also, you should look at the Barbed Armor (excrutiator) state to do yours, because you probably want to damage the owner of gadgets and entities like that.
Well there is a lot of way to do this depending on how your ability work. It might be a bit complex for someone new to scripting, but you can look at Balphagore's ultimate that looses charge.
The basic idea is to have a state applied to your unit that will do the following:
The thing here is that the state remove a charge to the ability every second, so if you gained a charge 0.001 sec before the state impact interval started, you would loose your charge instantly. So you will have to call this state as soon as you gain a charge and probably makes it stop when it reaches 0 charges.PHP Code:<state
name="State_XXX_AbilityX_Removecharges"
icon="icon.tga"
ishidden="true"
impactinterval="1000"
effecttype=""
>
<onimpact>
<removecharge entity="this_spawner_entity" />
</onimpact>
</state>
Last edited by Oloko; 01-10-2011 at 04:47 PM.
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
I don't think you can spawn trees like that and if you could, I think it might have some strange effect (like trees respawning in the minddle of the lane).
I think there was a discussion about spells using trees in this thread, you might want to search the thread for it.
It is target_entity, you can do <printdebuginfo /> to find out all the entites related to the event when you need to do something like this. Also, you should look at the Barbed Armor (excrutiator) state to do yours, because you probably want to damage the owner of gadgets and entities like that.
Well there is a lot of way to do this depending on how your ability work. It might be a bit complex for someone new to scripting, but you can look at Balphagore's ultimate that looses charge.
The basic idea is to have a state applied to your unit that will do the following:
The thing here is that the state remove a charge to the ability every second, so if you gained a charge 0.001 sec before the state impact interval started, you would loose your charge instantly. So you will have to call this state as soon as you gain a charge and probably makes it stop when it reaches 0 charges.PHP Code:<state
name="State_XXX_AbilityX_Removecharges"
icon="icon.tga"
ishidden="true"
impactinterval="1000"
effecttype=""
>
<onimpact>
<removecharge entity="this_spawner_entity" />
</onimpact>
</state>
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
I actually allready tried that, but cant seem to get it to work. (Doesnt remove any charges)
Here is my code at the moment:
PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<ability
name="Ability_Yrrac2"
icon="icon.tga"
maxlevel="4"
requiredlevel="1,3,5,7"
actiontype="passive"
attackspeedpercharge="0.01"
maxcharges="100"
>
<ondamaged>
<addcharges count="1, 2, 3, 4" />
</ondamaged>
<condition test="not_hasstate State_Removecharges and charges gt 0" target="source_entity">
<applystate name="State_Removecharges" duration="100000" />
</condition>
</ability>PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<state
name="State_Removecharges"
icon="icon.tga"
ishidden="true"
impactinterval="1000"
effecttype=""
>
<onimpact>
<removecharge entity="this_spawner_entity" />
</onimpact>
</state>
Last edited by Sixerzi; 01-11-2011 at 03:10 AM.
I actually allready tried that, but cant seem to get it to work. (Doesnt remove any charges)
Here is my code at the moment:
PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<ability
name="Ability_Yrrac2"
icon="icon.tga"
maxlevel="4"
requiredlevel="1,3,5,7"
actiontype="passive"
attackspeedpercharge="0.01"
maxcharges="100"
>
<ondamaged>
<addcharges count="1, 2, 3, 4" />
</ondamaged>
<condition test="not_hasstate State_Removecharges and charges gt 0" target="source_entity">
<applystate name="State_Removecharges" duration="100000" />
</condition>
</ability>PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<state
name="State_Removecharges"
icon="icon.tga"
ishidden="true"
impactinterval="1000"
effecttype=""
>
<onimpact>
<removecharge entity="this_spawner_entity" />
</onimpact>
</state>
You have a scripting error here first. When thing doesn't work like that, you can try removing the ishidden on your state to see if it does spawn or add some <printdebuginfo /> to see if certain part of your code trigger.
You can't put scripts outside of an "event", so your condition part that add the state wouldn't work. Since you only want the state to start when you have charges you can do the following:
I also removed the duration and set the flag continuous to true, since you want the state to be applied until you have no charges left. So we will leave it to the state to remove itself when there is no charges remaining.PHP Code:<ability
name="Ability_Yrrac2"
icon="icon.tga"
maxlevel="4"
requiredlevel="1,3,5,7"
actiontype="passive"
attackspeedpercharge="0.01"
maxcharges="100"
>
<ondamaged>
<addcharges count="1, 2, 3, 4" />
<condition test="not_hasstate State_Removecharges" target="source_entity">
<applystate name="State_Removecharges" target="source_entity" proxy="this_entity" continuous="true" />
</condition>
</ondamaged>
</ability>
I use here a <addcharges ... /> that adds 0 charges because it is the only way to know how many charges another entity has by obtaining the result of the operation. So if the result is greater than 0, we need to keep removing charges, otherwise we will expire the state since there is no more need for it.PHP Code:<state
name="State_Removecharges"
icon="icon.tga"
ishidden="true"
impactinterval="1000"
effecttype=""
>
<onimpact>
<addcharges entity="this_proxy_entity" count="0" />
<condition test="result gt 1">
<removecharge entity="this_proxy_entity" />
</condition>
<else>
<removecharge entity="this_proxy_entity" />
<expire />
</else>
</onimpact>
</state>
I think this would work, I don't have the time to test it myself, but if there is something not working I'll try it out.
Also I would recommend you to change the name of your state to something more specific to your hero, since you might end up having another hero with the same state name but with other effects.
Edit: fixed script errors.
Last edited by Oloko; 01-18-2011 at 09:54 AM. Reason: script errors fixed
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
You have a scripting error here first. When thing doesn't work like that, you can try removing the ishidden on your state to see if it does spawn or add some <printdebuginfo /> to see if certain part of your code trigger.
You can't put scripts outside of an "event", so your condition part that add the state wouldn't work. Since you only want the state to start when you have charges you can do the following:
I also removed the duration and set the flag continuous to true, since you want the state to be applied until you have no charges left. So we will leave it to the state to remove itself when there is no charges remaining.PHP Code:<ability
name="Ability_Yrrac2"
icon="icon.tga"
maxlevel="4"
requiredlevel="1,3,5,7"
actiontype="passive"
attackspeedpercharge="0.01"
maxcharges="100"
>
<ondamaged>
<addcharges count="1, 2, 3, 4" />
<condition test="not_hasstate State_Removecharges" target="source_entity">
<applystate name="State_Removecharges" target="source_entity" proxy="this_entity" continuous="true" />
</condition>
</ondamaged>
</ability>
I use here a <addcharges ... /> that adds 0 charges because it is the only way to know how many charges another entity has by obtaining the result of the operation. So if the result is greater than 0, we need to keep removing charges, otherwise we will expire the state since there is no more need for it.PHP Code:<state
name="State_Removecharges"
icon="icon.tga"
ishidden="true"
impactinterval="1000"
effecttype=""
>
<onimpact>
<addcharges entity="this_proxy_entity" count="0" />
<condition test="result gt 1">
<removecharge entity="this_proxy_entity" />
</condition>
<else>
<removecharge entity="this_proxy_entity" />
<expire />
</else>
</onimpact>
</state>
I think this would work, I don't have the time to test it myself, but if there is something not working I'll try it out.
Also I would recommend you to change the name of your state to something more specific to your hero, since you might end up having another hero with the same state name but with other effects.
Edit: fixed script errors.
Maps:
Enfo's Team Survival Beta [Dream] - v1.019 (18/07/2011)
BeHoNeled Alpha (Bejeweled clone) [Dream]
(Thanks Oloko, your tips already helped me a lot)
Alright, my hero has an ability wich kills a tree (or a fake tree wich I added to the targetsheme) and spawns a gadget on its location.
This perfectly works if I use it on a real tree. However If I use it on one of my fake trees It kills the (fake)tree as intended and spawns the gadget somewhere NEXT to its position. I just can't figure out why it does not spawn it right on the targets position.PHP Code:<onimpact>
<killtrees />
<kill target="target_entity" source="source_entity" />
<spawnunit name="Gadget_RulerOfNaturetreeheal" count="1" target="target_position"/>
</onimpact>
Fake tree:
I guess I also should mention that the fake trees are spawned with <spawnlinearaffector.... >PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<gadget
name="Gadget_RulerOfNature_Ability1"
icon="icon.tga"
portrait="icon.tga"
model="/world/props/trees/t_1/model.mdf"
skin=""
passiveeffect=""
spawneffect="/shared/effects/respawn.effect"
respawneffect=""
isselectable="true"
iscontrollable="false"
invulnerable="false"
selectsound=""
orderconfirmedsound=""
spawnanim=""
unittype="faketree"
maxhealth="200,400,600,800"
healthregen="1,2,3,4"
maxmana="0"
manaregen="0"
armor="0"
magicarmor="0"
immunity="GadgetImmunity"
preglobalscale="2.205"
modelscale="1.0"
effectscale="0.9"
boundsheight="64"
boundsradius="20"
selectionradius="20"
targetoffset="0 0 0"
deniable="true"
canrotate="false"
ismobile="false"
isflying="false"
clearvision="false"
drawonmap="false"
attacktype="none"
corpsetime="0"
deathtime="0"
corpsefadetime="2500"
corpsefadeeffect="/world/props/trees/t_1/death.effect"
blocking="true"
goldbountymin="10"
goldbountymax="20"
>
<onspawn>
<spawnaffector name="Affector_RulerOfNature_Ability1" proxy="this_entity"/>
</onspawn>
</gadget>
Ability_entity:
PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<ability
name="Ability_RulerOfNature1"
icon="icon.tga"
anim="ability_1"
casttime="0"
castactiontime="0"
maxlevel="4"
requiredlevel="1,3,5,7"
actiontype="target_vector"
targetradius="100"
targetmaterial="/shared/materials/area_cast_indicator.material"
casteffecttype="Magic"
cooldowntime="10"
manacost="50,60,70,80"
range="800"
>
<onimpact>
<spawnlinearaffector name="Affector_RulerOfNature_Ability1_Wall" target="target_position" direction="target_position" firsttarget="" directionvalue="250"
targetvalue="-250" angle="30,90,110,210" targetorigin="delta_position" directionorigin="delta_position" targetmodifier="pointpastline" directionmodifier="pointpastline" />
<spawnlinearaffector name="Affector_RulerOfNature_Ability1_Effect" target="target_position" direction="delta_position" firsttarget="" directionvalue="250"
targetvalue="-250" targetorigin="delta_position" directionorigin="delta_position" targetmodifier="pointpastline" directionmodifier="pointpastline" />
</onimpact>
</ability>
Affector_Wall:
PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<linearaffector
name="Affector_RulerOfNature_Ability1_Wall"
minlength="0"
maxlength="500"
subsegmentoffset="90"
subsegmentlength="84"
>
<onimpact>
<spawnunit name="Gadget_RulerOfNature_Ability1" target="target_position" />
</onimpact>
</linearaffector>
Thanks in advance. <3 you guys![]()
(Thanks Oloko, your tips already helped me a lot)
Alright, my hero has an ability wich kills a tree (or a fake tree wich I added to the targetsheme) and spawns a gadget on its location.
This perfectly works if I use it on a real tree. However If I use it on one of my fake trees It kills the (fake)tree as intended and spawns the gadget somewhere NEXT to its position. I just can't figure out why it does not spawn it right on the targets position.PHP Code:<onimpact>
<killtrees />
<kill target="target_entity" source="source_entity" />
<spawnunit name="Gadget_RulerOfNaturetreeheal" count="1" target="target_position"/>
</onimpact>
Fake tree:
I guess I also should mention that the fake trees are spawned with <spawnlinearaffector.... >PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<gadget
name="Gadget_RulerOfNature_Ability1"
icon="icon.tga"
portrait="icon.tga"
model="/world/props/trees/t_1/model.mdf"
skin=""
passiveeffect=""
spawneffect="/shared/effects/respawn.effect"
respawneffect=""
isselectable="true"
iscontrollable="false"
invulnerable="false"
selectsound=""
orderconfirmedsound=""
spawnanim=""
unittype="faketree"
maxhealth="200,400,600,800"
healthregen="1,2,3,4"
maxmana="0"
manaregen="0"
armor="0"
magicarmor="0"
immunity="GadgetImmunity"
preglobalscale="2.205"
modelscale="1.0"
effectscale="0.9"
boundsheight="64"
boundsradius="20"
selectionradius="20"
targetoffset="0 0 0"
deniable="true"
canrotate="false"
ismobile="false"
isflying="false"
clearvision="false"
drawonmap="false"
attacktype="none"
corpsetime="0"
deathtime="0"
corpsefadetime="2500"
corpsefadeeffect="/world/props/trees/t_1/death.effect"
blocking="true"
goldbountymin="10"
goldbountymax="20"
>
<onspawn>
<spawnaffector name="Affector_RulerOfNature_Ability1" proxy="this_entity"/>
</onspawn>
</gadget>
Ability_entity:
PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<ability
name="Ability_RulerOfNature1"
icon="icon.tga"
anim="ability_1"
casttime="0"
castactiontime="0"
maxlevel="4"
requiredlevel="1,3,5,7"
actiontype="target_vector"
targetradius="100"
targetmaterial="/shared/materials/area_cast_indicator.material"
casteffecttype="Magic"
cooldowntime="10"
manacost="50,60,70,80"
range="800"
>
<onimpact>
<spawnlinearaffector name="Affector_RulerOfNature_Ability1_Wall" target="target_position" direction="target_position" firsttarget="" directionvalue="250"
targetvalue="-250" angle="30,90,110,210" targetorigin="delta_position" directionorigin="delta_position" targetmodifier="pointpastline" directionmodifier="pointpastline" />
<spawnlinearaffector name="Affector_RulerOfNature_Ability1_Effect" target="target_position" direction="delta_position" firsttarget="" directionvalue="250"
targetvalue="-250" targetorigin="delta_position" directionorigin="delta_position" targetmodifier="pointpastline" directionmodifier="pointpastline" />
</onimpact>
</ability>
Affector_Wall:
PHP Code:<?xml version="1.0" encoding="UTF-8"?>
<linearaffector
name="Affector_RulerOfNature_Ability1_Wall"
minlength="0"
maxlength="500"
subsegmentoffset="90"
subsegmentlength="84"
>
<onimpact>
<spawnunit name="Gadget_RulerOfNature_Ability1" target="target_position" />
</onimpact>
</linearaffector>
Thanks in advance. <3 you guys![]()
what do I write to make an item that spawns trees but with a "nothing around it" radius that only includes cliffs and other pathblocking entities? please and thank you to anyone who answers.
edit: I also want it to be able to be placed in the floor and spawn a tree and respawn it if destroyed or used and of course to be able to be picked up when the player left clicks it if possible.
Last edited by Dazius; 01-16-2011 at 03:02 PM.
what do I write to make an item that spawns trees but with a "nothing around it" radius that only includes cliffs and other pathblocking entities? please and thank you to anyone who answers.
edit: I also want it to be able to be placed in the floor and spawn a tree and respawn it if destroyed or used and of course to be able to be picked up when the player left clicks it if possible.
So no, you can't spawn trees. But If you browse through the code I posted 2 posts above you'll find out how to create fake trees (basically a gadget with a tree model). You also have to create a new unittype and add it to the base.gamemechanics file targetsheme.
I did it like that.
<targetscheme name="trees" allow="tree,faketree" restrict="corpse"/>
Hope I could help you![]()
So no, you can't spawn trees. But If you browse through the code I posted 2 posts above you'll find out how to create fake trees (basically a gadget with a tree model). You also have to create a new unittype and add it to the base.gamemechanics file targetsheme.
I did it like that.
<targetscheme name="trees" allow="tree,faketree" restrict="corpse"/>
Hope I could help you![]()