Handing your character over to AI

Post » Sat May 28, 2011 4:02 pm

Is it possible to make your character be controlled by AI, while you watch from third person camera?

For example, I want to create a spell that is a type of berserk. You gain a bonus to various stats, but for the duration of the spell you can't control your character (can't use potions, move freely, etc) and you attack both friend and foe. Is this possible?
User avatar
sara OMAR
 
Posts: 3451
Joined: Wed Jul 05, 2006 11:18 pm

Post » Sat May 28, 2011 12:41 pm

Is it possible to make your character be controlled by AI, while you watch from third person camera?

For example, I want to create a spell that is a type of berserk. You gain a bonus to various stats, but for the duration of the spell you can't control your character (can't use potions, move freely, etc) and you attack both friend and foe. Is this possible?


Probably not, and getting control over your character once again would be very, very problematic.

Might I suggest setting the player alpha to 0 (invisible) and creating an actor copy of the player to do the "berserking?"
User avatar
CYCO JO-NATE
 
Posts: 3431
Joined: Fri Sep 21, 2007 12:41 pm

Post » Sat May 28, 2011 10:37 am

Creating a copy of the player using CreateFullActorCopy also creates a LOT of savegame bloat. I'm not sure about CloneForm though. It is possible to set the camera to thirdperson and following the player, which can then be set to the rampaging creature's position using SetPos.
User avatar
Killer McCracken
 
Posts: 3456
Joined: Wed Feb 14, 2007 9:57 pm

Post » Sat May 28, 2011 5:08 am

Yes, I was thinking in this direction as well. The problem is that even these methods are buggy (if used in interiors, for example, it would be hard to detect where to position the player). CreateFullActoryCopy creates savegame bloat, regardless of any steps taken before executing the function, right? And CloneForm is OBSE, right? How come it is better?
User avatar
Tamara Primo
 
Posts: 3483
Joined: Fri Jul 28, 2006 7:15 am

Post » Sat May 28, 2011 4:32 pm

You could use CreateFullActorCopy just once after the player exits the starter dungeon to get his appearance, and move this clone to an unused cell like the TestingHall. Then when you need it, move it to the player's location. With some scripting skills, you can make a loop that walks through the player's inventory and pushes any equipped items into an array, then copy those items to the clone and make him equip them, or you can just pretend the berserker state makes you rip all your clothes off and send the clone in naked :D Make sure to include a check not to copy equipped quest items, as this will bloat the savegame and may cause bugs. Copy the stats and skills by using GetAv and SetAv.

The tricky part is getting the player to move without user input. If you get the clone right, you could walk through the references in the current cell, see if the player clone can detect them, give them a ref if this is true and use something like
"playerClone.startcombat NPCref" to make the clone attack that NPC, then using Setpos and Getpos to continuously move the player to the clone's location so the camera follows. If I recall it correctly, using player.moveto will black out the screen, you might want to avoid that.
User avatar
Honey Suckle
 
Posts: 3425
Joined: Wed Sep 27, 2006 4:22 pm

Post » Sat May 28, 2011 6:49 am

You could use CreateFullActorCopy just once after the player exits the starter dungeon to get his appearance, and move this clone to an unused cell like the TestingHall. Then when you need it, move it to the player's location. With some scripting skills, you can make a loop that walks through the player's inventory and pushes any equipped items into an array, then copy those items to the clone and make him equip them, or you can just pretend the berserker state makes you rip all your clothes off and send the clone in naked :D Make sure to include a check not to copy equipped quest items, as this will bloat the savegame and may cause bugs. Copy the stats and skills by using GetAv and SetAv.

The tricky part is getting the player to move without user input. If you get the clone right, you could walk through the references in the current cell, see if the player clone can detect them, give them a ref if this is true and use something like
"playerClone.startcombat NPCref" to make the clone attack that NPC, then using Setpos and Getpos to continuously move the player to the clone's location so the camera follows. If I recall it correctly, using player.moveto will black out the screen, you might want to avoid that.

Screen black out would make sense if it was temporary though. You character blacks out, and when you can see the screen again you are surrounded by dead NPCs and monsters.
User avatar
Daramis McGee
 
Posts: 3378
Joined: Mon Sep 03, 2007 10:47 am


Return to IV - Oblivion