PrisonLove
Hard Realist
- Reaction score
- 78
Hey guys I just started taking a computer programming course and decided that I would try to make a little snippet that might make life easier for map makers.
I created a JASS snippet that will create a dummy unit so that you don't have to keep writing out all the lines of code that are required to make dummies in all your spells.
Well, here it is:
I realize it takes a lot of parameters, but what it does is create a unit for a player at a location with a timed life and adds an ability to the created unit, as well as setting a level to that ability.
So it would be used like this:
This call creates a Shaman for Player 1 (Red) at the center of the map that lasts for 60 seconds and has the firebolt ability.
I don't know if you guys would find this useful, but hopefully it could eliminate some redundancy in your codes. Just add this snippet to the map header and you're good to go.
The best part about this in my opinion is that there are no leaks to remove, as coordinate don't leak and the unit is killed after the designated time. Also, it can be used for summoning units as well, since it isn't limited to only creating a dummy.
If this is in the wrong section would someone please be kind enough to move it?
I created a JASS snippet that will create a dummy unit so that you don't have to keep writing out all the lines of code that are required to make dummies in all your spells.
Well, here it is:
JASS:
function CreateDummy takes player owner, integer unitCode, real x, real y, real facing, real time, integer abilityCode, integer abilityLevel returns unit
set bj_lastCreatedUnit = CreateUnit( owner, unitCode, x, y, facing )
call UnitAddAbility( bj_lastCreatedUnit, abilityCode )
call SetUnitAbilityLevel( bj_lastCreatedUnit, abilityCode, abilityLevel )
call UnitApplyTimedLife( bj_lastCreatedUnit, 039;BTLF039;, time )
return bj_lastCreatedUnit
endfunction
I realize it takes a lot of parameters, but what it does is create a unit for a player at a location with a timed life and adds an ability to the created unit, as well as setting a level to that ability.
So it would be used like this:
This call creates a Shaman for Player 1 (Red) at the center of the map that lasts for 60 seconds and has the firebolt ability.
I don't know if you guys would find this useful, but hopefully it could eliminate some redundancy in your codes. Just add this snippet to the map header and you're good to go.
The best part about this in my opinion is that there are no leaks to remove, as coordinate don't leak and the unit is killed after the designated time. Also, it can be used for summoning units as well, since it isn't limited to only creating a dummy.
If this is in the wrong section would someone please be kind enough to move it?