Staredit Network > Forums > Modding Discussion > Topic: How do you make a new spell?
How do you make a new spell?
Dec 28 2012, 9:18 pm
By: Raygoza  

Dec 28 2012, 9:18 pm Raygoza Post #1



I didn't have enough space in the Title nor in teh description to be clear enough, Iäm sorry for that.

The problem isn't creating a spell but it is creating a new spell which makes a new effect but without cannibalizing any older effects.
As modders should know effects such as Dark Swarm, psi storm and such are in SC actually neutral units which aren't owned by anyone but everyone's unit would be affected by these.
The problem lies in how to create a new spell of this kind, (yes knowing that what would have to be made is creaing a new unit that would be used for this purpose) But still how would yo umake a spell conjure this "unit" and most liely this Spell effect would have to belong the neutral unit as well.

Any ideas?



None.

Jan 3 2013, 3:48 am Sand Wraith Post #2

she/her

The closest I have is salvaging a button and order.

For example, take a spell that requires a point target (say, some random terrain location): you set up the spell's order.dat so that it calls a specific iscript animation. In the corresponding iscript, specify a sigorder of your choosing (I recommend also using nobrkcode sections to prevent bugs). The sigorder signals the beginning of the spell.

Using a plugin, in the unit loop, search for units who are using the order of the spell and also have the sigorder flag set on them. Upon finding such a unit, you can save the location of the spell target point to a persistent variable which you can use for subsequent nextFrame() loops.




Jan 5 2013, 4:09 pm Raygoza Post #3



The problem is not creating an effect but creating a unit. That technique wont work to make things like forcefields for something like a Sentry without replacing a spell "unit" like the disruptor web so far.
Also everything you said is true and thanks for the reply.



None.

Feb 2 2013, 4:24 am Sand Wraith Post #4

she/her

You can try using a point target spell like EMP or Psi Storm. Capture the casting unit's order target X and Y locations, save those, and then apply effects based on the X,Y.

Using such a method, it is trivial to do something like forcing all units near the target point to freeze. Doing something like preventing them from moving into the actual area is more tricky - it would require some sort of algorithm to order the unit away from the X,Y.




Feb 3 2013, 4:00 am Biophysicist Post #5



If you just want units to not be able to enter an area, you can force them to move out of it by telling them to move to a point a few pixels away from them in the opposite of their current direction. Of course, that has the disadvantage of clearing orders, so it might be a useless suggestion.



None.

Feb 3 2013, 9:02 pm Sand Wraith Post #6

she/her

Quote from Biophysicist
If you just want units to not be able to enter an area, you can force them to move out of it by telling them to move to a point a few pixels away from them in the opposite of their current direction. Of course, that has the disadvantage of clearing orders, so it might be a useless suggestion.

On top of this, I recommend instantiating an object for each such area-blocking spell's coordinates and keeping a record of the objects. I faintly recall trying to do something similar to this in the past, but failed.




Feb 4 2013, 6:13 am Raygoza Post #7



Thanks SandWraith but I was referring to how to make new spell graphical effects usable in game and not reusing the existing ones for a new spell as that I know is possible.

When adding this new spell graphical effect it shouldn't replace any existing ones which is here I got the problem.



None.

Feb 4 2013, 5:17 pm Biophysicist Post #8



There's a rather complex workaround. You'll need to effectively make one spell (the "base spell") do two different things, depending on the caster. In orders.dat, find the order for the spell you want to use. Change that spell to used the Unused2 animation. In the iscript for both units that can use the base spell, define an Unused2 animation. For the one where the spell works as normal, re-use the existing CastSpell animation. For the other one, copy-paste the CastSpell animation, but change the castspell opcode to useweapon and make it fire some unused weapon. Lastly, set up said unused weapon to do whatever you intended, using plugins if needed.

EDIT: The base spell will need to be one with a weapon associated; those without an associated weapon, such as Matrix and Hallucination, don't even use the standard animations, to my knowledge. (Matrix does its animation with a hardcoded overlay.)



None.

Feb 8 2013, 11:34 am pastelmind Post #9



Let's be frank. You want to find a way to replicate the SC2 Forcefield without scavenging any of the existing SC1 spells, right?

I tried to replicate forcefield once by scavenging Dark Swarm. Instead of conjuring a cloud of insects, it would create a solid block that ground units could not pass. When I found out that workers could glide smoothly across the block by clicking a mineral field far away, I gave the building flag to the block unit. Imagine my surprise when force fields were suddenly insta-killing tanks in siege mode!

Another dilemma with the DSwarm -> FF change arose from the nature of SCBW. Instead of pushing away units smoothly, the force fields caused the units stuck under it to struggle out of the way. Fast units like speedzeals were okay about it, but Dragoons took forever to squeeze out of FFs.

Order the units to move out of FFs? Manually change their sprite positions? There may be several approaches to it, but I doubt anything would be close to the SC2 forcefields.

TLDR: BIG PITA, go buy sc2.



None.

Feb 8 2013, 4:35 pm Biophysicist Post #10



Oh, do you want Force Field? Because that's actually fairly easy. :O

Quote
For example, take a spell that requires a point target (say, some random terrain location): you set up the spell's order.dat so that it calls a specific iscript animation. In the corresponding iscript, specify a sigorder of your choosing (I recommend also using nobrkcode sections to prevent bugs). The sigorder signals the beginning of the spell. Using a plugin, in the unit loop, search for units who are using the order of the spell and also have the sigorder flag set on them. Upon finding such a unit, you can save the location of the spell target point to a persistent variable which you can use for subsequent nextFrame() loops.

Quote
There's a rather complex workaround. You'll need to effectively make one spell (the "base spell") do two different things, depending on the caster. In orders.dat, find the order for the spell you want to use. Change that spell to used the Unused2 animation. In the iscript for both units that can use the base spell, define an Unused2 animation. For the one where the spell works as normal, re-use the existing CastSpell animation. For the other one, copy-paste the CastSpell animation, but change the castspell opcode to useweapon and make it fire some unused weapon. Lastly, set up said unused weapon to do whatever you intended, using plugins if needed.

First, do both of these. Now, you'll need an array or linked list or something of points; whenever the Force Field caster casts it, save the target point in this array/list/whatever. Inside your unit loop, loop through the array. If a unit is too close to any of these points, compute a point a short distance in the opposite direction, and order that unit to that point.



None.

Feb 8 2013, 7:46 pm Sand Wraith Post #11

she/her

You should save the target point as part of an object, and within that object also include a duration timer to more accurately represent the force field. If you then store these objects in an array, it would be much easier to manage your force fields.

Actually, I would also recommend using a C++ vector data structure instead of an array and initialize the vector to be prepared to handle about 200 at once. It is unlikely that there will be 200 force fields at the same time, but even if there are that many and you need more room, you can let the vector can manage its own size.

Biophys' suggestion for using the Unused2 animation and rerouting the spell's iscript at the unit level is about as close as I can think of to making an "entirely new" spell. On top of that, you could use sigorder (see my previous posts for details) and perhaps nobrkcode to more accurately/reliably capture the casting of the spell through a plugin. More explicitly put: adding new entries for orders.dat, units.dat, anything.dat and allowing StarCraft to use these entries requires an extreme level of reverse engineering knowledge that, AFAIK, only Heinermann, DoA, and perhaps some of the BWAPI crew possess. You should try contacting these people (also through broodwarai.com )

If you decide to use sigorder, please contact me. I already have experience working with them with regards to manipulating them for the purpose of spells and effects and such.




Mar 1 2013, 7:50 am Raygoza Post #12



Thanks a lot.
Im not sure that the solution of making the unit to move outside the affecteed area will work. What will happen with burrowed units or sieged tanks? they cant move?
Or units effected by lockdown/maelstrom/stasis.



None.

Mar 3 2013, 12:05 am Sand Wraith Post #13

she/her

I don't think it will cause any significantly unacceptable effects. They will probably reject the order given to them and stay frozen (in the case of spells). However, for Siege Tanks and Burrowed units, I suspect that there may be a chance that they will Unsiege/Unburrow and move, the behaviour that, IIRC, is exhibited when orders are issued via triggers in a map on such units.




Mar 3 2013, 12:43 am Lanthanide Post #14



Quote from Sand Wraith
However, for Siege Tanks and Burrowed units, I suspect that there may be a chance that they will Unsiege/Unburrow and move, the behaviour that, IIRC, is exhibited when orders are issued via triggers in a map on such units.
If the unit is owned by a CPU player, then ordering a burrowed unit to move will make it move. Ordering a sieged tank to move or patrol doesn't always work. The units are owned by a human player then nothing happens.



None.

Mar 4 2013, 11:21 am pastelmind Post #15



This is why making a Force Field sucks. Order a unit to move away? You can't just make it like SC2 does -- for example, what happens if you cast one FF in the middle of a huge Protoss army? Any units stuck under it will overlap each other and clumsily attempt to crawl away, which they can't because other units are blocking their path. So all you get is a big mess of struggling units. No unit pushing, no army separation, nothing. What about lockdowned/stasised units? They won't move no matter how many force fields you stack on them.

Then there is the problem of overlapping Force Fields: What happens when a unit is stuck between two FFs? The second FF is going to override the move-away command issued by the first FF, and the unit will walk into the first one, bounce back to the second, and then to the first one...until either of the FFs die or someone kills the unit.



None.

Mar 4 2013, 3:25 pm Pr0nogo Post #16



Cannibalise Dark Swarm or Disruption Web and give it collision.




Mar 18 2013, 2:51 pm Sand Wraith Post #17

she/her

Quote from Pr0nogo
Cannibalise Dark Swarm or Disruption Web and give it collision.

That does not work IIRC. Other people had problems with doing this. It was probably hardcoded not to have collision. In any case, the behaviour exhibited was not really acceptable, although you could try it anyway.




Mar 18 2013, 3:47 pm Biophysicist Post #18



You can use an EXE edit to make it collide. And it occurs to me that, to deal with units having trouble moving out of the Swarm/Web, you could use a plugin to make them Place COP out.



None.

Mar 18 2013, 6:53 pm Sand Wraith Post #19

she/her

How does Place COP work?




Jun 19 2013, 2:43 pm JimRaynor187 Post #20



This is very easy :crazy: use Firegraft, in exeedit enable collision for Disruption Web, done ^^



None.

Options
  Back to forum
Please log in to reply to this topic or to report it.
Members in this topic: None.
[02:41 pm]
razorback9423 -- NudeRaider
NudeRaider shouted: MTiger156 power over:wob:ing?
No, POWER UNDER :wob: ing!
[12:53 pm]
NudeRaider -- MTiger156
MTiger156 shouted: Power over:wob:ing
power over:wob:ing?
[12:27 pm]
MTiger156 -- crap...
[12:27 pm]
MTiger156 -- Power over:wob:ing
[11:50 am]
UEDCommander -- WARNING: Unit Unplaceable! (u) (69, 69)
[09:26 am]
lil-Inferno -- :wob:
[08:25 am]
Black_Overseer -- razorback9423
razorback9423 shouted: WARNING: Unit Unplaceable! (Aldaris) (1656,2996)
You have no power here, Gandalf the Grey.
[05:43 am]
razorback9423 -- WARNING: Unit Unplaceable! (Aldaris) (1656,2996)
[05:27 am]
razorback9423 -- stop
[05:27 am]
NudeRaider -- :wob: you can't :wob: us
Please log in to shout.


Members Online: Roy, ewqe, Moose