To separate technical discussion (updates, bugs, etc.) from spell creation discussion, I tought that keeping the scripting framework in one place and post new spells separately might be a good idea.
I've just updated EXSP to v1.3.2 (see here: viewtopic.php?f=14&t=4459) and here's two new spells to show off new capabilities.
Reach
This is just a simple spell that triggers buttons or levers from a distance. It's similar in function to pferguso's flying blade, but there's no projectile involved. This showcases how the onHit hook in 1.3.2 detects entities based on class.
VIDEO: http://www.youtube.com/watch?v=EITsiQxMlsU
SpoilerShow
The main functionality code is simply:
Code: Select all
onHit = function(sId, level, x, y, hitType, subType, entity)
if subType == "Button" then
entity:push()
end
if subType == "Lever" then
entity:toggle()
end
endThis one is more fun. This spell is intended to be used by spawners as a "trap". It creates balls of lightning which will slowly "wander" around in the dungeon, avoid walls and obstacles (they will only hit the party or a monster).
The Wandering Lights will fly straight and turn around corners if in a narrow corridor. If they have an opening either left or right,
they have a 20% chance each of turning in that direction. So in an open space, they have 20% left, 20% right, 60% ahead. If they arrive in front of a wall, they have a 50% chance of turning left or right, if the way is clear of course. If they arrive in a dead end, they'll turn back.
To intelligently spawn these, use the provided function:
exsp_wandering_lights.spawnLight(spawner, room, maxLights, [power])
spawner: the id of the spawner object from which to launch
room: a string identifying a unique space for a set of lights (ex: "treasure_room_1" or "mazeOfShadows"...)
maxLights: the maximum number of wandering lights to spawn in that "room". The spells will remember in which "room" they were spawned,
and when they explode, they will free their spot for another light. So, whether from a pressure plate, timer, or something else, the
call to spawnLight won't degenerate into endless spells.
power: an optional argument if you wish to override the default power of the lights (40).
Notice that Wandering Lights also deflect from blocker objects like monsters, so you can use these also to restrict them to a section of your dungeon.
They are fun in an open room, and very fun in mazes too.
Showcases onPass, onHit, new 1.3.2 getCollisionAhead function, usage of spell extended properties to store variables and spellChangeDirection utility function to spin spells on the fly.
VIDEO: http://youtu.be/HFFEfWZ-rjc
Enjoy!
Sources are available here: https://docs.google.com/folder/d/0B-rVm ... dtNVE/edit
