Mysidia Adoptables Support Forum  

Home Community Mys-Script Creative Off-Topic
Go Back   Mysidia Adoptables Support Forum > Mysidia Adoptables > Questions and Supports

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 03-15-2016, 09:38 PM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,370
Abronsyth is on a distinguished road
Default NPC Battles?

OK, so I have this idea for NPC battles that'd actually be fairly simple to pull off, but could be made to look cool, haha.

On my site I am adding stats. For this post I'm going to use "magic" as the default stat for the sake of example.

So all pets on my site have Magic ranging from 1 to 100. Now I want to create a set of NPCs who will be randomly generated (I already can do this so this part isn't important), and they'll have their own stats. So say I am going to battle, and I have a cat who has 50 Magic. The random-NPC, we'll call him Angry Cat, has 55 magic. Because Angry Cat has higher stat(s), he wins the battle if I choose to use Magic. However, let's say my cat has 60 Intelligence, and Angry Cat only has 30 Intelligence. So I choose to have my cat attack using intelligence (don't question it), and may cat wins.

Now here are the issues I'm running into:
A) selecting the cat I want to use to battle
>>>>I'm think that this is where the spotlight pet could come in handy. The pet you select as your spotlight could be the one who does the NPC battling. However, I need then to know how to select the pet the user has selected as their spotlight adoptable, and get that pet's stats.

B) choosing the attack
>>>>However, I think I can use if($mysidia->input->post("submit")) (but change "submit") to select the attack? Say I have each attack as buttons:
[Spell Cast] [Trick] [Tackle]
They push "Spell Cast" which will be known action-wise as "spell". Then we do if($mysidia->input->post("spell")) and then just select the adoptable's magic, and the NPC's magic within that. So this might not actually be a problem.

So it's not the fanciest of systems, but once I get everything figured out I should be able to do a lot more with it. I'd probably be able to incorporate health that decreases with each blow, giving more powerful NPCs the edge by making it so if their stat is in a certain interval then the damage they deal has a chance of hitting harder.

Of course as soon as I get it all set up I'll release it to the community as a mod :)

If anyone has suggestions/advice that'd be super awesome!
-Abron
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #2  
Old 03-19-2016, 11:02 AM
Ittermat's Avatar
Ittermat Ittermat is offline
The awesomesauce
 
Join Date: Feb 2016
Location: in front of my laptop
Posts: 272
Gender: Female
Credits: 33,616
Ittermat is on a distinguished road
Default

I hope you can get this working! this would be awesome to have!
Reply With Quote
  #3  
Old 03-20-2016, 02:40 PM
FounderSim FounderSim is offline
Member
 
Join Date: Sep 2014
Posts: 65
Gender: Male
Credits: 7,581
FounderSim is on a distinguished road
Default

Instead of using this:
if($mysidia->input->post("spell"))

elseif($mysidia->input->post("tackle"))

else if($mysidia->input->post("trick"))


Switch statements may be better. I would also suggest keeping a lot of the "attack logic in separate files". Battle systems are fairly complex to keep organized, debug and expand upon if you have not been coding for awhile or new to coding battle systems.
__________________
Reply With Quote
  #4  
Old 06-28-2016, 07:22 AM
Abronsyth's Avatar
Abronsyth Abronsyth is offline
A Headache Embodied
 
Join Date: Aug 2011
Location: NY
Posts: 1,011
Gender: Male
Credits: 113,370
Abronsyth is on a distinguished road
Default

OK, so I've actually got a loose mock-up code of this done and it's working perfectly, which is great. I've gotten it so that the user must have an adult pet set as their fave pet, and then that is the pet used to battle. The system uses stat averages to battle instead of one single stat, which makes more sense to me, and generates random NPC stats. If the adoptable wins then the user wins a certain amount of cash. I can also make it so that the pet can gain stats by winning, but I chose to use items and training to increase stats instead.

I did go ahead and use switch statements instead, as Sim recommended. Anyways, I'll clean up the code a bit and then go ahead and release it to y'all :)
__________________
My Mods Site (1.3.4, 2020 Mods)
Reply With Quote
  #5  
Old 06-28-2016, 05:01 PM
Ruri Lesavka's Avatar
Ruri Lesavka Ruri Lesavka is offline
Member
 
Join Date: Aug 2010
Posts: 15
Credits: 4,360
Ruri Lesavka
Default

woohoo!
I can't wait to see it! :D
__________________
Reply With Quote
  #6  
Old 06-28-2016, 09:49 PM
NobodysHero's Avatar
NobodysHero NobodysHero is offline
Co-Owner of MystFell
 
Join Date: Nov 2013
Posts: 144
Gender: Female
Credits: 18,716
NobodysHero is on a distinguished road
Default

This is gonna be awesome, I can tell. 8D
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -5. The time now is 04:19 AM.

Currently Active Users: 9775 (0 members and 9775 guests)
Threads: 4,080, Posts: 32,024, Members: 2,016
Welcome to our newest members, jolob.
BETA





What's New?

What's Hot?

What's Popular?


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
vBCommerce I v2.0.0 Gold ©2010, PixelFX Studios
vBCredits I v2.0.0 Gold ©2010, PixelFX Studios
Emoticons by darkmoon3636