PDA

View Full Version : [Support] Need help



air_bag
01-18-2011, 12:21 PM
Hello, I need some help here. I recently started remaking the spells of Warlock from wc3, (don't really have any intention of making the whole map, I'm just doing it to learn) and I'm having some problems.

I suppose there's some problems with my coding, since the spells doesn't work. Instead of using the changed skills the default skills are being used by the hero. I don't have any experience with XML either, so most I've done is guesswork/copying.
If anyone could tell me what is wrong, I'd appreciate it.

Fireball Ability:

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

icon="icon.tga"

anim="ability_1"
casttime="400"
castactiontime="400"

maxlevel="1"

actiontype="target_position"
casteffecttype="Magic"
targetscheme="enemy_units_and_projectiles"

manacost="0"
cooldowntime="10000"

range="600"
forcerange="600"
allowoutofboundscast="true"
>
<onimpact>
<spawnprojectile name="Projectile_Fireball" source="source_entity" target="target_position" owner="source_entity" />
</onimpact>
</ability>
Fireball Projectile

<?xml version="1.0" encoding="UTF-8"?>
<projectile
name="Projectile_Fireball"

speed="560"
gravity="0"

modelscale="2"
model="..heroes/pyromancer/projectile/model.mdf"
traileffect=""
canturn="0"
flying="true"
flyheight="20"
deatheffect="effects/death.effect"

touchradius="100"
touchradiusdiradjust="true"
maxtouches="1"
touchtargetscheme="enemy_units_and_projectiles"
toucheffecttype="Magic"
>

<ontouch>
<playeffect effect="..heroes/pyromancer/projectile/impact.effect" target="target_entity" source="target_entity" />
<condition test="target eq projectile" />
<cantarget effecttype="Magic">
<spawnaffector name="Fireball_explosion" target="touch_position" />
<delete target="this_entity" />
<delete target="target_entity" />
</cantarget>
</condition>

<combatevent effecttype="AbilityBasedProjectile">
<onimpact>
<spawnaffector name="Fireball_explosion" target="touch_position" />
</onimpact>
</combatevent>
<delete target="this_entity" />
</ontouch>
</projectile>Fireball Affector

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

radius="200"
targetselection="all"
targetscheme="enemy_heroes"
effecttype="Magic"
destroytrees="true"
impactdelay="0"
effectscale="1.3"

>
<onimpact>
<cantarget targetscheme="enemy_units">
<distance target="target_entity" source="this_entity" />
<setvar0 a="result" b="100" op="div" />
<setvar3 a="5" b="var0" op="sub" />
<damage effecttype="Magic" amount="var3" />
<givemana amount="5" />
<setvar1 a="16" b="target_mana" op="mult"/>
<setvar0 a="50" b="var0" op="sub" />
<setvar2 a="var0" b="var1" op="mult" />
<push force="var2" duration="1200" target="target_entity" source="this_entity" />
<push force="var2" duration="1000" target="target_entity" source="this_entity" />
<push force="var2" duration="800" target="target_entity" source="this_entity" />
<push force="var2" duration="600" target="target_entity" source="this_entity" />
<push force="var2" duration="400" target="target_entity" source="this_entity" />
<push force="var2" duration="200" target="target_entity" source="this_entity" />
</cantarget>
</onimpact>
</affector>


Homing ability

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

icon="icon.tga"

anim="ability_1"
casttime="400"
castactiontime="400"

maxlevel="1"

actiontype="target_position"
casteffecttype="Magic"
targetscheme="enemy_units_and_projectiles"

manacost="0"
cooldowntime="15000"

range="1000"
forcerange="1000"
allowoutofboundscast="true"
>
<onimpact>
<spawnprojectile name="Projectile_Homing" source="source_entity" target="target_position" owner="source_entity" />
</onimpact>
</ability>Homing projectile

<?xml version="1.0" encoding="UTF-8"?>
<projectile
name="Projectile_Homing"

speed="0"
gravity="0"

modelscale="1"
model="../vindicator/projectile/effects/projectile_glave.mdf"
traileffect="../vindicator/projectile/effects/trail.effect"
canturn="0"
flying="true"
flyheight="40"
deatheffect="effects/death.effect"

touchradius="80"
touchradiusdiradjust="true"
maxtouches="1"
touchtargetscheme="enemy_units_and_projectiles"
toucheffecttype="Magic"
>

<onspawn>
<setproxy entity="stack_entity" target="closest_enemy_hero" command="Follow" />
</onspawn>

<onframe>
<push force="-500" b="frametime" op="mult" duration="300" source="source_entity" target="this_entity" />
</onframe>

<ontouch>
<playeffect effect="../vindicator/projectile/effects/impact.effect" target="target_entity" source="target_entity" />
<condition test="target eq projectile" />
<delete target="this_entity" />
<delete target="target_entity" />
<delete target="stack_entity" />
<spawnaffector name="Homing_explosion" />
</condition>

<combatevent effecttype="AbilityBasedProjectile">
<onimpact>
<cantarget effecttype="Magic">
<spawnaffector name="Homing_explosion" />
</cantarget>
</onimpact>
</combatevent>
<delete target="this_entity" />
<delete target="stack_entity" />
</ontouch>
</projectile>Homing affector

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

radius="250"
targetselection="all"
targetscheme="enemy_heroes"
effecttype="Magic"
destroytrees="true"
impactdelay="0"
effectscale="1.4"
impacteffect="effects/ability_04_impact.effect"

>
<onimpact>
<cantarget targetscheme="enemy_units">
<distance target="target_entity" source="this_entity" />
<setvar0 a="result" b="100" op="div" />
<setvar3 a="5" b="var0" op="sub" />
<damage effecttype="Magic" amount="var3" />
<givemana amount="5" />
<setvar1 a="20" b="target_mana" op="mult"/>
<setvar0 a="50" b="var0" op="sub" />
<setvar2 a="var0" b="var1" op="mult" />
<push force="var2" duration="1200" target="target_entity" source="this_entity" />
<push force="var2" duration="1000" target="target_entity" source="this_entity" />
<push force="var2" duration="800" target="target_entity" source="this_entity" />
<push force="var2" duration="600" target="target_entity" source="this_entity" />
<push force="var2" duration="400" target="target_entity" source="this_entity" />
<push force="var2" duration="200" target="target_entity" source="this_entity" />
</cantarget>
</onimpact>
</affector>

Scourge ability

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

icon="icon.tga"

anim="ability_2"
casttime="1000"
castactiontime="1000"

maxlevel="1"

effect="../javaras/ability_04/impact.effect"
actiontype="target_self"
casteffecttype="Magic"
targetscheme="enemy_units"

healthcost="10"
cooldowntime="15000"
>
<onimpact>
<spawnaffector name="Affector_Scourge" position="self_position" />
</onimpact>
</ability>Scourge affector

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

radius="250"
targetselection="all"
targetscheme="enemy_heroes"
effecttype="Magic"
impactdelay="0"

>
<onimpact>
<cantarget targetscheme="enemy_units">
<damage effecttype="Magic" amount="10" />
<givemana amount="7" />
<setvar1 a="16" b="target_mana" op="mult"/>
<setvar2 a="5" b="var1" op="mult" />
<push force="var2" duration="1200" target="target_entity" source="this_entity" />
<push force="var2" duration="1000" target="target_entity" source="this_entity" />
<push force="var2" duration="800" target="target_entity" source="this_entity" />
<push force="var2" duration="600" target="target_entity" source="this_entity" />
<push force="var2" duration="400" target="target_entity" source="this_entity" />
<push force="var2" duration="200" target="target_entity" source="this_entity" />
</cantarget>
</onimpact>
</affector>

Luke_Allstar
01-18-2011, 01:16 PM
if you want to use those custom spells, you have to either edit the hero.entity files
you need to change this lines:



inventory0="Ability_Test1"
inventory1="Ability_Test2"
inventory2="Ability_Test3"
inventory3="Ability_Test4"to whatever skills you use, for example:

inventory0="Ability_Fireball"

or if you just overriting existing abilitys of an hero, you have to keep the hero skills
so if you use hellbringer for example your code should look like this:

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

.....
>
<onimpact>
<spawnprojectile name="Projectile_Fireball" source="source_entity" target="target_position" owner="source_entity" />
</onimpact>
</ability>

However the names of the projectiles can stay the same i think

Oloko
01-18-2011, 05:05 PM
If you haven't done what Luke_Allstar said, you should. Also, you should always start your map twice before testing. I know it's a pain to do, but if you don't, you have a lot of chances to have errors.

I'm also sorry to say this, but you have a huge amount of scripting errors. You should always try to code only a few thing and test very often. Especially when you are new to scripting.