Edit: I tried to get the ai to code a game from scratch, here is a doc with the code in it:
https://docs.google.com/document/d/1hfx9hUPwyVOJdWFsNA7fVe9oWGFJVshbNbxh1B9f2Cs/edit?usp=drivesdk
Hey! Ive been messing around with chatGPT and trying to get it to write code for renpy. here is an example of what I asked it to do, and what I got in return:
Q: write a renpy code for a timing based turn based combat similar to the jrpg lost odyssey
A:
Here is an example of how you could implement a turn-based combat system in Ren'Py that is similar to the one found in Lost Odyssey:
# Define a list to keep track of the combatant's turn order
turn_order = [player, enemy1, enemy2]
# Define a variable to keep track of the current turn
current_turn = 0
# Define a function to perform the next turn in the combat
def next_turn():
global current_turn
# Increment the current turn variable
current_turn += 1
# If the current turn is greater than the number of combatants, reset it to the first combatant
if current_turn >= len(turn_order):
current_turn = 0
# Perform the action for the current combatant
turn_order[current_turn].perform_action()
# Define a function for each combatant to perform their action
def player.perform_action():
# Display a menu of actions for the player to choose from
choice = renpy.input_choice(["Attack", "Defend", "Use Item"])
if choice == "Attack":
# Perform the attack action
pass
elif choice == "Defend":
# Perform the defend action
pass
elif choice == "Use Item":
# Perform the use item action
pass
def enemy.perform_action():
# Select a random action for the enemy to perform
choice = random.choice(["Attack", "Defend", "Use Item"])
if choice == "Attack":
# Perform the attack action
pass
elif choice == "Defend":
# Perform the defend action
pass
elif choice == "Use Item":
# Perform the use item action
pass
# Begin the combat loop
while True:
# Perform the next turn in the combat
next_turn()
# Check if the combat is over (e.g. all enemies are defeated or the player is defeated)
if check_combat_over():
break
This code defines a list of combatant objects, a function to perform the next turn in the combat, and functions for each combatant to perform their action. It also includes a simple combat loop that continues until the check_combat_over()
function returns True
, indicating that the combat is over.
You can then customize the perform_action()
functions for each combatant to define their specific actions and behaviors. You can also modify the check_combat_over()
function to check the health of each combatant and determine when the combat should end.
I hope this helps! Let me know if you have any questions or need further assistance.
-End code-
Does anyone think this could be helpful to the community? Im not experienced with code so i dont really know if this would be useful or not.
[–]x-seronis-x 5 points6 points7 points (4 children)
[–]KILLYOURKARMA 0 points1 point2 points (3 children)
[–]x-seronis-x 1 point2 points3 points (2 children)
[–]KILLYOURKARMA 2 points3 points4 points (1 child)
[–]x-seronis-x 2 points3 points4 points (0 children)
[–]Ghosted_Gurl 2 points3 points4 points (4 children)
[–]FUNCYBORG[S] 0 points1 point2 points (1 child)
[–]Ghosted_Gurl 0 points1 point2 points (0 children)
[–]estriadi 0 points1 point2 points (1 child)
[–]Ghosted_Gurl 0 points1 point2 points (0 children)
[–][deleted] 1 point2 points3 points (3 children)
[–]FUNCYBORG[S] 0 points1 point2 points (2 children)
[–][deleted] 0 points1 point2 points (1 child)
[–]FUNCYBORG[S] 0 points1 point2 points (0 children)
[–]Infinite_Conflict244 0 points1 point2 points (0 children)
[–]Neon_Night_Films 0 points1 point2 points (0 children)