Post new topic    
King Slime
Send private message
Script Help Needed! 
 PostWed Jan 04, 2012 10:57 pm
Send private message Reply with quote
Sorry, I usually have a witty title with my problems, but not this time.

I'm making a unique battle system. I would like to know how I could use various things. Heres what I want to know...

* How could I use my heroes name in a string that shall be displayed on screen?
* What could I use to display my heroes Health and Mana in the top right corner? The same goes for enemies, except they're in the top left. I would like it so that when the selection of an enemy/hero changes, so does the stats displayed at the top of the screen.
* How would I be able to save Health/Mana change inside and outside of battle?
* How would I increase maximum health/mana?
* How would I be able to increment other stats into battle? I have an idea, like, say...every point of Strength/Magic Power being added onto a base damage for Melee and Magic attacks. Remedied.

To give you some pre-existing information, here is what I currently have done with my script...

Code:
include, plotscr.hsd
include, Uniquebattle.hsi

#If you can clean this mess up, please do so.
#If you manage to clean it up, also inform me.

#Some hero battle variables.
global variable(1,black mage health)
global variable(2,black mage mana)
global variable(3,black mage current health)
global variable(4,black mage current mana)
global variable(5, enemy one health)
global variable(6, enemy one mana)
global variable(7, enemy two health)
global variable(8, enemy two mana)
global variable(9, enemy three health)
global variable(10, enemy three mana)
global variable(11, enemy four health)
global variable(12, enemy four mana)
global variable(13, enemy one current health)
global variable(14, enemy one current mana)

#Now for some battle commands.
global variable(15, hit or miss)
global variable(16, damage)
global variable(17, gold earned)
global variable(18, exp earned)

# Here come the stats......
global variable(19, strength)
global variable(20, magic)
global variable(21, accuracy)
global variable(22, defense)
global variable(23, agility)
global variable(24, luck)
global variable(25, will power)
# Now for enemy stats.
# Enemy One
global variable(26, EOne strength)
global variable(27, EOne magic)
global variable(28, EOne accuracy)
global variable(29, EOne defense)
global variable(30, EOne agility)
global variable(31, EOne luck)
global variable(32, EOne will power)

#Feel free to add more Enemy variables to your liking.
#I'm too lazy to add them all.

#Now, the constants! Woohoo.
define constant(1,action)

plotscript, grass brawl, begin
   plant battle
   #Feel free to add any more battles here. If you want, you
   #could add a random variable which picks between a battle
   #for the player to face.
   end

plotscript, plant battle, begin
   suspend player
   suspend box advance
   show text box(1)
   wait(55)
   advance text box
   resume box advance
   fade screen out
   teleport to map(1,12,4)
   prepare hero
   prepare plant enemy one
   do battle stats
   fade screen in
   heroes turn
   end
   
script, heroes turn, begin
   open menu(1)
   end
   
script, prepare hero, begin
   set hero picture(0,2,outside battle)
   set hero direction(0,left)
   #If you add any more heroes, you can
   #prepare their pictures in this script.
   end
   
script, prepare plant enemy one, begin
        alter NPC(1,NPCstat:picture,3)
        alter NPC(1,NPCStat:
   set NPC direction(1,right)
   
   #Plant stats, do do dee do!
   EOne strength := 5
        EOne magic := 1
        EOne accuracy := 10
        EOne agility := 2
        EOne luck := 1
        EOne will power := 1
       
        #Now, for the Health/Mana stats.
        enemy one health := 45
        enemy one mana := 1
        enemy one current health := 45
        enemy one current mana := 1
   
   end

plotscript, do battle stats, begin
   #Here is where the heroes battle stats are prepared.
   #If you add any more heroes, use this place to prepare
   #their stats.
   
   #Velus' Stats
   #------------
   
   #First, the battle stats.
   strength := get hero stat(find hero(hero:Velus),Strength,maximum stat)
        magic := get hero stat(find hero(hero:Velus),Magic,maximum stat)
        accuracy := get hero stat(find hero(hero:Velus),Accuracy,maximum stat)
        agility := get hero stat(find hero(hero:Velus),Agility,maximum stat)
        luck := get hero stat(find hero(hero:Velus),Luck,maximum stat)
        will power := get hero stat(find hero(hero:Velus),Will Power,maximum stat)
       
        #Now, for the Health/Mana stats.
        black mage health := get hero stat(find hero(hero:Velus),0,maximum stat)
        black mage mana := get hero stat(find hero(hero:Velus),1,maximum stat)
        black mage current health := get hero stat(find hero(hero:Velus),0,current stat)
        black mage current mana := get hero stat(find hero(hero:Velus),1,current stat)
       
        end
   
plotscript, hero strike animation, begin
   $action = "Velus used Strike!"
   update action
   walk hero(me,left,8)
   wait for hero(me)
   set hero picture(me,6,outside battle)
   set hero direction(me,down)
   set hero picture(me,2,outside battle)
   hero strike
   walk hero(me,right,8)
   wait for hero(me)
   set hero direction(me,left)
   end
   
plotscript, hero strike, begin
   variable(strike base)
   variable(chance)
   strike base := 2
   chance := random(1,10)
   
   increment (strike base,strength)
   decrement (strike base, EOne defense)
   
   hit or miss := random(1,3)
   
   increment(hit or miss,accuracy)
   decrement(hit or miss,EOne agility)
   
   if (chance << 10) then (increment(hit or miss,luck))
   if (hit or miss << 3), then (attack miss)
        else
   decrement(enemy one current health,strike base)
   $action = "The strike hit!"
   update action
   $action = "The strike did"
   wait(5)
   update action
   end
   
script, attack miss, begin
   #derp.
   end
   
script, update action, begin
  variable(i)
  for(i, 3, 0, -1) do(
    copy string(action+i+1, action+i)
  )
  for(i, 0, 3) do(
    show string at(action+1+i, 0, 190 -- i * 10)
    string color(action+1+i, 174 -- i * 5)
  )
end


Thank you for bearing through this too long to read wall of text. If you spot any errors/things I need to add, please point out/do so.
Display posts from previous: