r/codespells • u/gl3nnie • Dec 24 '14
onMovement?
I am trying to make a spell which on cast fly's forward and cast orbs out of himself and shoot those orbs downwards so that i can make a bridge with to another island. the only problems is that there is only onCreate and onHit which both doesn't do what i want them to do. anyone have any ideas?
1
u/Umbristopheles Dec 24 '14
Create a separate spell that shoots an orb downwards. Probably have to be done relative to the initial orb, so something like "rotate orb 90 degrees" onCast. I haven't studied the API fully yet.
Then, in your main spell, create a loop in the onCast function that casts the 2nd spell on a timer. Say every half a second or something. That should get you on your way.
1
u/Shadow_Duck Dec 24 '14
OK, I got your bridge to work:
Spell "Sand Bridge"{
On Create orb{
Set orb Speed Medium
Repeat Function "Hello" every 0.2 Seconds
}
* to Hello //This is our function call
Cast orb with Spell "Lift" mana 2}
Then the spell Lift is just:
Set orb speed stopped
Raise sand radius 4Note: I was able to break the physics engine pretty hard with this, as in my wizard stopped being affected by gravity until I restarted, your mileage may vary.
1
u/Umbristopheles Dec 24 '14
I noticed the "flying" bug in a video I saw on YouTube. I was wondering if it was a bug or some kind of spell he cast on himself. No explanation was given.
1
u/Umbristopheles Dec 24 '14
One way to make it "not OP" would be to wrap the repeat function part with a while loop and a counter. Say, when the counter reaches 10, stop doing the repeat function. So it'll only cast 10 total orbs over 2 seconds.
1
u/Shadow_Duck Dec 24 '14
This is true, I had been controlling it by how much mana I gave the spell, but a loop with hard coded variables is probably better practice.
1
u/Shadow_Duck Dec 24 '14
The problem with that Umbristopheles is all code within "onCast" is executed on the first frame of creation. I imagine this is also why there is no "timer" function we can use.
Right now, you can setup/change your orb at only two points: Initial Creation, and if you hit something. There is no way to have the orb run extra code after x seconds or after it has moved x units.
I think we're both a bit stuck gl3nnie, I was hoping to create a sand lift with 4 orbs equal distance from the player (this requires the orbs move a certain distance, then alter their behavior), we can hope they'll add in extra functionality later?