View previous topic :: View next topic |
Author |
Message |
deadmccoy I'm not supposed to drink...but I do.

Joined: 05 May 2009 Posts: 13 Location: Point Pleasant, WV
|
Posted: Tue May 05, 2009 1:20 pm Post subject: Spells that require items to be equipped |
|
|
I searched for an existing topic on this subject, but found none, so I apologize if I indeed missed one.
I've been trying to figure out a way to have spells that are only usable when you have a particular item equipped.
For example, you have a shotgun that requires ammunition to attack. The basic attack just requires that you have the standard ammunition in your inventory. Now, what I'm trying to figure out is this: I want to have 'special' ammos with different effects that are equippable, and when equipped give you access to these special attacks in battle, via a spell menu. That way you can use your standard attack OR choose to use whatever special ammo you may have equipped.
Also, if this is possible, would also be possible to have the special ammo's attack use the weapon animation?
I have a feeling I made that sound a lot more complicated than need be.
Again, sorry if I already missed this somewhere. |
|
Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Tue May 05, 2009 1:41 pm Post subject: |
|
|
For what you're asking, you could have a script that checks for the equipment before every battle doing:
Code: | if(
check equipment (hero,slot) == item:ammo
)
then(
teach spell (hero,attack)
)
else(
forget spell (hero,attack)
) |
You would have to use similar checks for every type of special ammo you wish to add.
I would also have the spell list that uses these special attacks to be set to 'Random Effects', as it seems like you would only have one spell in it at a time.
Unfortunately, the weapon-animation only shows up on the weapon's attack :( |
|
Back to top |
|
 |
deadmccoy I'm not supposed to drink...but I do.

Joined: 05 May 2009 Posts: 13 Location: Point Pleasant, WV
|
Posted: Tue May 05, 2009 1:52 pm Post subject: |
|
|
Thanks! I'm not sure what you mean about the random effects, though. I don't think I even know what that means. Also, how exactly do I make it so the script is ran before each battle? |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Tue May 05, 2009 1:57 pm Post subject: |
|
|
Having this functionality as a built-in feature is definitely highly desirable. This will be in a future release eventually.
See 'Plan for improved spell learning' |
|
Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Tue May 05, 2009 2:04 pm Post subject: |
|
|
deadmccoy wrote: | Thanks! I'm not sure what you mean about the random effects, though. I don't think I even know what that means. Also, how exactly do I make it so the script is ran before each battle? |
Random Effects:
*If you go to the Hero Editor, select 'Edit Spell Lists...'
*For whichever list contains those of the special bullets, Press [right] or [left] on it until you get 'Random Effects'
With this, the special attack will be chosen automatically, without the need to find it in the sub-menu.
Scripts before Battle:
You would have to make use of the 'Instead of Battle Script' map property:
This script triggers whenever you activate a random encounter on the map.
If you don't have any formations set up in the script, you won't fight anything.
The script would go something like:
Code: |
Plotscript, Random-Encounters, begin
#################################
# Equipment Checker here:
#################################
if(check equipment (hero,slot) == item:ammo)
then(teach spell (hero,attack))
else(forget spell (hero,attack))
#################################
# Random Battles for Map 1 Here:
#################################
if(current map == 1)
then(fight(random(1,5)))
end |
In this example, stepping on a tile that had a random encounter would trigger this script.
It would check to see if your hero had the ammo equipped and then you would fight a random formation between 1 and 5.
If you have boss battles, you'll want to call the equipment-checker before the fight starts.
Please ask for emphasis if you need it ;D |
|
Back to top |
|
 |
deadmccoy I'm not supposed to drink...but I do.

Joined: 05 May 2009 Posts: 13 Location: Point Pleasant, WV
|
Posted: Tue May 05, 2009 2:44 pm Post subject: |
|
|
At the risk of being beaten I have one more question.
What would you use to make sure that 2 items were equipped before being able to use the spell? This way you couldn't use the special shotgun ammo without the shotgun also being equipped. |
|
Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Tue May 05, 2009 2:50 pm Post subject: |
|
|
deadmccoy wrote: | At the risk of being beaten I have one more question.
What would you use to make sure that 2 items were equipped before being able to use the spell? This way you couldn't use the special shotgun ammo without the shotgun also being equipped. |
Nobody's armed in the castle.
Quote: | if(check equipment (hero,slot) == item:ammo && check equipment (hero, slot) == item:shotgun)
then(teach spell (hero,attack))
else(forget spell (hero,attack)) |
This 'And' condition essentially looks like:
Quote: | if(Case 1 && Case 2)
then(Stuff)
Else(Other Stuff) |
It can also be written as:
Quote: |
if( Case1, and, Case2)
then(Stuff)
else(Other Stuff) |
|
|
Back to top |
|
 |
deadmccoy I'm not supposed to drink...but I do.

Joined: 05 May 2009 Posts: 13 Location: Point Pleasant, WV
|
Posted: Tue May 05, 2009 2:53 pm Post subject: |
|
|
Dude, if there was a contest for being helpful you would go home a champion. |
|
Back to top |
|
 |
Bob the Hamster OHRRPGCE Developer

Joined: 22 Feb 2003 Posts: 2526 Location: Hamster Republic (Southern California Enclave)
|
Posted: Tue May 05, 2009 3:53 pm Post subject: |
|
|
The command for fighting a battle is actually "fight formation" not "fight"
A script used as an Instead-of-battle script automatically gets one argument, which is the formation number of the battle you would have fought. Here is how to use it:
Code: |
Plotscript, Random-Encounters, formation number, begin
#################################
# Equipment Checker here:
#################################
if(check equipment (hero,slot) == item:ammo)
then(teach spell (hero,attack))
else(forget spell (hero,attack))
#################################
# Random Battles for Map 1 Here:
#################################
if(current map == 1)
then(fight formation(formation number))
end
|
This avoids the "random(1,5)" thing, which would be a pain since you would have to write a separate version of the script for every map. |
|
Back to top |
|
 |
TwinHamster ♫ Furious souls, burn eternally! ♫

Joined: 07 Mar 2004 Posts: 1352
|
Posted: Tue May 05, 2009 4:14 pm Post subject: |
|
|
James Paige wrote: | The command for fighting a battle is actually "fight formation" not "fight" |
I usually make a script function called 'fight' so that I save myself form typing a few characters. Whoops
Also, the 'formation number' is pretty nifty, thanks!
Learn something every day. |
|
Back to top |
|
 |
|