Your browser does not seem to support JavaScript. As a result, your viewing experience will be diminished, and you have been placed in read-only mode.
Please download a browser that supports JavaScript, or enable it if it's disabled (i.e. NoScript).
I had an idea to make my game turn-based battle and I think I have an idea how I can do that. I just don't know how I can make it so the computer enemy randomly picks to do something. How would I be able to do this?
------------------
Quote
Originally posted by ZeldaMaster: I had an idea to make my game turn-based battle and I think I have an idea how I can do that. I just don't know how I can make it so the computer enemy randomly picks to do something. How would I be able to do this?
In the events, there is a object called Random.... You might be able to use that function.
------------------ -Albadar- - - - - - - - - - - Just trying...
I think Ell has a guide on how to do this on his site (url="http://"http://www.ellrx.com")www.ellrx.com(/url)
------------------ Pilky (url="http://"http://www.mcubedsw.com")M cubed homepage(/url) (url="http://"http://www.coldstonerc.cjb.net")Coldstone Resource Centre(/url) Cheesiest film line of all time "Flash I love you but we only have 14 hours to save the earth" from Flash Gorden
Here's another thing to consider, if you want more definite control over what the npc does ( making it do completely random attacks qualifies )
my turnbased method works on the basis of spells/ranged weapons, aside from this all items are set so that you can only use them when a conditional is satisfied, let's say you had an npc that can choose between 6 weapons.
you create a global, call it gb_choice. and for each of teh six weapons they can only use them when gb_choice equals; 6 for the 6th weapon..3 for the 3rd weapon..etc
create an event that changes the value of the global of a random value between 0-5 ( i believe it rolls from 0 to the number, if not then use 1-6 )
Here's the flexible part, where you choose to execute this event is up to you.
Also:
Let's say you wanted the npc to react a certain way when the player does certain things, ( yeah we're actually going to extend the AI ) then when the player takes said actions/uses items or does things that would warrant a change in behavior for the NPC, change the value of the global gb_choice to a correct value that would allow the npc to use an item to counteract on the next turn.
It is not necessary to give all the items available for the NPC throughout the game individual numbers, instead give the items classifications,
ie you poison the NPC, and the poison class( gb_choice = 2 ) of items are now made available to the npc, there are 3 levels of cure, 1 mildly combats the poison and cancels it out of over a period of 4 turns. The other nullifies the poison, the third level of cure removes the poison and raises your immunity.
alternately you could open up several classifications to the npc when poisoned, one mmight make them desperate and use more powerful weapons that use up a lot of mp, because they "feel that their best chance is to finish the battle now or die of poison." etc. etc.
Oh to be very specific you want to get to the (url="http://"http://www.ellrx.com/articles/vault/index.html")CGE Vault(/url) on my site.
(url="http://"http://showcase.ellrx.com")CGE Showcase. 6 entrants and thriving(/url)
(url="http://"http://www.ellrx.com/index.html")eLL' Rx...Last Updated 09.02.03(/url)
(url="http://"http://www.ellrx.com/articles/vault/index.html")CGE Vault(/url)
... ** Big O..ACTION!**
{ edit : CGE Vault link added }
(This message has been edited by ellrx (edited 12-28-2003).)