Creating Easy Spells

Learn more on how to use Sandbox, or submit your own tutorials or resources.
arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Creating Easy Spells

Postby arcones » April 30th, 2010, 2:29 pm

NOTE: This tutorial was created for Platinum Arts Sandbox 2.5. To retrieve your spells in PAS 2.6, place them under data>rpg>game.

I've seen several spells come my way while on the forums, and they're all pretty cool! But I myself didn't know how to create spells with different effects until just recently. So I decided to create a Tut for easy to create and use spells! I'll have some of my own, one of Venima's (with full credit given to him), and components for new spells!

The first spell is a simple light that comes from your right hand (Yes, I know there are already two of these type of spells, however, this spell is specifically like a flashlight :) ):

Code: Select all

spawn_flashlight = [
   r_type $ENT_ITEM
   r_icon flashlight
   r_description "A flashlight for searching with."
   r_item_slots $SLOT_RHAND

   r_addowneffect $STATUS_LIGHT 35 1000000000

   r_interact [
   r_select $rpginteract
   r_pickup $rpgself
   ]
]


I'll break each component down, and explain what each does.

Code: Select all

spawn_flashlight = [
The "spawn_yournamehere" encompasses all the remaining components. Without this, there is no spell. The bracket is very, very important!!!

Code: Select all

r_type $ENT_ITEM
This shows what r_type of "ENT" or "Entitiy" the "spawn" is. In this case, it is an item.

Code: Select all

r_icon flashlight
"r_icon" will show the "icon" of the item, when you pull up the inventory. In this case, a flashlight. (This doesn't work because RPG mode doesn't have an "icon" for it)

Code: Select all

r_description "A flashlight for searching with."
This gives the description. Make it a one sentence to work best!

Code: Select all

r_item_slots $SLOT_RHAND
The "r_item_slots" is for assigning the item to a certain spot on your character's body. $SLOT_RHAND is easily understood. Right hand. :P

Code: Select all

r_addowneffect $STATUS_LIGHT 35 1000000000
The addowneffect allows the user to put a certain limitation on the $STATUS. In this case, the $STATUS is LIGHT. There is a circle of light that surrounds the RC and will last for...... well let's just say it'll take a while to disappear! :D

Code: Select all

 r_interact [
   r_select $rpginteract
   r_pickup $rpgself
   ]
]
This little bit of code round's out the spell, showing the game engine what the spell is interacting with. Namely, yourself!

One last bit of info. Every time you add a new item/spell, make sure you add:

Code: Select all

r_additem yourspellnamehere
To this:

Code: Select all

spawn_player = [
   r_additem item
   r_additem item2
   r_additem spell
   r_additem spell2
   r_additem frost
   r_additem magicarrow
   r_additem light
   r_additem eth_vis1
   r_additem minehelm


In the flashlight's case it would look like this:

Code: Select all

spawn_player = [
   r_additem item
   r_additem item2
   r_additem spell
   r_additem spell2
   r_additem frost
   r_additem magicarrow
   r_additem light
   r_additem eth_vis1
   r_additem minehelm
   r_additem flashlight
"Why the r_additem flashlight?" you might ask. The reason is this. Do you remember what we were spawning at the beginning? Yes! A flashlight!

Code: Select all

spawn_flashlight = [
It will show the game engine which spell you would like to spawn!

Now, for a spell! :D


Those are some main components for an $ENT_ITEM. Now, for a spell!
This is Venima's so all the right's go to him!

Code: Select all

spawn_dust = [
   r_type $ENT_SPELL
   r_icon losehealth
   r_description "sprays flames"
   r_name "Flame Spray"
   r_spell_type $STYPE_CONE
   r_spell_gravity 60
   r_spell_cost 5
   r_spell_range 8
   r_spell_effect 5
   r_addeffect $STATUS_HEALTH -10 1

   r_interact [
      r_select $rpginteract
      r_pickup $rpgself
   ]
]


You know what "spawn_dust = [" is, so I don't need to dissemble. Look at the "r_type"

Code: Select all

r_type $ENT_SPELL
This r_type, is a spell, as indicated by $ENT_SPELL.

The icon, is:

Code: Select all

r_icon losehealth
You all know what this means, however, this icon will show up.

Code: Select all

r_description "sprays flames"
   r_name "Flame Spray"
You all know what the description does, and the name will appear when you open up the spell's tab.

The next part is important, so I'll explain as best as possible:

Code: Select all

r_spell_type $STYPE_CONE
   r_spell_gravity 60
   r_spell_cost 5
   r_spell_range 8
   r_spell_effect 5
   r_addeffect $STATUS_HEALTH -10 1

The r_spell_type will represent what form the spell will take. There are three forms: Target, Cone, and Self. Alternatively, instead of r_spell_type $STYPE_CONE you may place a 1 next to the r_spell_type.

The r_spell_gravity is easily explained. This will be how much gravity will affect the attack.
The r_spell_cost is 5. 5 mana. Mana is regenerated so don't worry about running out!
The next part is important: the r_spell_range. You can have a long range, or a short range. It's up to you. However, the range is also affected by the gravity, so make sure these work together. The r_spell_effect I have yet to understand but as far as I know it is alright to leave out. Check out the fireball spell under data/game_rpg.cfg to learn more.

The addeffect:

Code: Select all

r_addeffect $STATUS_HEALTH -10 1
Shows what will happen when the spell reaches it's intended target. It will affect the health status of the target, reducing it by -10. The 1 next to it signifies that this spell with take health out once. This is not a continually draining spell.

And just like with the flashlight, you must place the r_additem at the end of your "spawn_player":

Code: Select all

spawn_player = [
   r_additem item
   r_additem item2
   r_additem spell
   r_additem spell2
   r_additem frost
   r_additem magicarrow
   r_additem light
   r_additem eth_vis1
   r_additem minehelm
   r_additem flashlight
   r_additem dust


I hope that you all get some help from this, and will be able to create easy spells! I will go into more in-depth spells later, but this took awhile so just hold your horses. Don't hesitate to ask questions!
Arc :geek:
Last edited by arcones on January 1st, 2011, 11:32 am, edited 4 times in total.
Image
Want a user bar like this one? PM Leo!

User avatar
GR1M
Support Team
Support Team
Posts: 1305
Joined: August 22nd, 2009, 4:35 pm
Name: Luke
IRC Username: Gr1m
Location: Texas
Contact:

Re: Creating Easy Spells

Postby GR1M » April 30th, 2010, 3:53 pm

Nice guide but you might want to add solutions to some of the problems people might come across like when you make a spell and its random every time and how to fix that.
Image
Want a user bar like this one? PM Leo

arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Creating Easy Spells

Postby arcones » April 30th, 2010, 6:36 pm

As said in several other places... I'm working on your spells GR1m! ;)
Image
Want a user bar like this one? PM Leo!

Hirato
Developer
Developer
Posts: 689
Joined: May 30th, 2009, 1:23 pm
IRC Username: hirato

Re: Creating Easy Spells

Postby Hirato » April 30th, 2010, 10:48 pm

don't use 2 in place of $ENT_SPELL, bad practice, the reason for all those constants is due to their susceptibility for change.
if you use $ENT_SPELL you're secure if I change its value in the future, otherwise you're screwed

EDIT
btw: I think a duration of -1 is infinite; I forgot
This is not a url, clicking it is pointless

arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Creating Easy Spells

Postby arcones » May 1st, 2010, 9:14 am

Okay, I changed those!
Image
Want a user bar like this one? PM Leo!

User avatar
GR1M
Support Team
Support Team
Posts: 1305
Joined: August 22nd, 2009, 4:35 pm
Name: Luke
IRC Username: Gr1m
Location: Texas
Contact:

Re: Creating Easy Spells

Postby GR1M » May 1st, 2010, 11:21 am

"/dumpprojeffect myeffects.cfg" there we go! the cure.
Image
Want a user bar like this one? PM Leo

arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Creating Easy Spells

Postby arcones » May 2nd, 2010, 5:17 pm

Yep! Time for dinner!
:D
Image
Want a user bar like this one? PM Leo!

User avatar
Leo_V117
Support Team
Support Team
Posts: 1640
Joined: February 16th, 2010, 8:00 pm
Name: Leo
IRC Username: Leo_V117
Location: That one place...
Contact:

Re: Creating Easy Spells

Postby Leo_V117 » May 5th, 2010, 11:03 am

Whats for lunch? :lol: Heres one for you Arc.

Like a smoke Grenade.
A spell that will launch a projectile anywhere you aim. When it hits the ground. A cloud of fog appears for around 10 seconds.

arcones
Support Team
Support Team
Posts: 2734
Joined: January 13th, 2010, 12:42 pm
Name: Timothy
IRC Username: I use Steam
Location: Looking over your shoulder...
Contact:

Re: Creating Easy Spells

Postby arcones » May 5th, 2010, 6:12 pm

Gotcha!

Will do :)
Image
Want a user bar like this one? PM Leo!

chocolatepie33
Support Team
Support Team
Posts: 2458
Joined: April 27th, 2010, 5:31 pm
IRC Username: CP

Re: Creating Easy Spells

Postby chocolatepie33 » May 5th, 2010, 8:18 pm

Well, should Arc succeed (which, of course, he will, considering he's filled to the brim with uber awesomeness :D ), we can use the crosshair Grenada that Leo found ;) . Now, if we had a grenade mapmodel, we could make a spell effect similar to Hirato's arrow spell...
Julius wrote:Contribute to http://www.opengameart.org NOW!

Save the wiki!


Return to “Tutorials and Resources”

Who is online

Users browsing this forum: No registered users and 1 guest