Does anyone have aiplayers spawned from script??
by Mike Wigand · in Torque Game Engine · 02/07/2002 (8:12 am) · 38 replies
If so how would I go about scripting aiPlayers to show up when the Player connects to the game?
#22
06/22/2003 (1:34 pm)
Eric: Sure you can zip up your files or the whole project and send it to me (although I should only need ones in your server/scripts directory). Also, any console error messages would be great.
#23
then I have to ask what version is this?
is this AIPlayer a AIConnection ? or Player?
(which class does it derive from in the c++)
if this is head then it should be Player -> AIPlayer
and from Player comes all Shapebase methods
if it is AIConnection
then its GameConnection so you need to $enemy.player.settransform(..)
which means you are working with Old code.
06/22/2003 (1:34 pm)
Well if he had the other ai methods..then I have to ask what version is this?
is this AIPlayer a AIConnection ? or Player?
(which class does it derive from in the c++)
if this is head then it should be Player -> AIPlayer
and from Player comes all Shapebase methods
if it is AIConnection
then its GameConnection so you need to $enemy.player.settransform(..)
which means you are working with Old code.
#24
@Sabrecyd: that code looks similar to what I've been doing, but I think mine is lacking things that yours has (and I like how you put the actual bot creation in aiPlayer.cs where it belongs, I will move my stuff over there and try what you have too, its much cleaner that way and maybe it will fix my problem
@Will: cool, I zipped it up and I'm uploading it to my ftp server (I have about 17 minutes left on the upload) its a 90mb dl... I know thats a bit much but I dont want to bother you with sending a few files (my server scripts kinda depend on my client scripts to set up the player and stuff, which then is dependent on having all my characters, I think it would end up being a big hassle trying to figure out what is and isnt needed (and knowing me and my sleep deprived state I'd probably end up messing it up). If you really dont wnat to dl all that I can just send you my client and server scripts... they might work if you replace all my character datablocks to lightmalehumanarmor... I'm not sure, its been awhile since I messed with that.
@Badguy: dont worry, my code is current, just started over with the engine two or three weeks ago, I have 1.1.2 so I should have the new AI stuff
06/22/2003 (1:49 pm)
Wow! when it rains it pours! thank you everyone for your help@Sabrecyd: that code looks similar to what I've been doing, but I think mine is lacking things that yours has (and I like how you put the actual bot creation in aiPlayer.cs where it belongs, I will move my stuff over there and try what you have too, its much cleaner that way and maybe it will fix my problem
@Will: cool, I zipped it up and I'm uploading it to my ftp server (I have about 17 minutes left on the upload) its a 90mb dl... I know thats a bit much but I dont want to bother you with sending a few files (my server scripts kinda depend on my client scripts to set up the player and stuff, which then is dependent on having all my characters, I think it would end up being a big hassle trying to figure out what is and isnt needed (and knowing me and my sleep deprived state I'd probably end up messing it up). If you really dont wnat to dl all that I can just send you my client and server scripts... they might work if you replace all my character datablocks to lightmalehumanarmor... I'm not sure, its been awhile since I messed with that.
@Badguy: dont worry, my code is current, just started over with the engine two or three weeks ago, I have 1.1.2 so I should have the new AI stuff
#25
Edit: I just realised I havnt slept in 24 hours... must sleeeeep
06/22/2003 (1:55 pm)
Hmmmm, I just tried Sabrecyd's stuff... doesnt look like it wants to let me set the energy level either... I't looks like this thing is doing ok with aiPlayer stuff, but it doesnt seem to be doing Player specific stuff... could aiPlayer not be inheriting Players properties for some reason?Edit: I just realised I havnt slept in 24 hours... must sleeeeep
#26
dont be a wimp man..
walk it off soldier.
:)
no there is no way you have a AIPlayer in your game
that does not derive from Player
Unless..
you dont have him in your game :)
06/22/2003 (2:07 pm)
Eric ..dont be a wimp man..
walk it off soldier.
:)
no there is no way you have a AIPlayer in your game
that does not derive from Player
Unless..
you dont have him in your game :)
#27
brain not feel right :(... I just finished uplaoding the game, would you like to take a look also? I can mail you the adress if you'd like (you can see those cool environment mapped animations you helped me fix!)
06/22/2003 (2:11 pm)
Damnit, you just had to call me a wimp... now I cant go to bed :(brain not feel right :(... I just finished uplaoding the game, would you like to take a look also? I can mail you the adress if you'd like (you can see those cool environment mapped animations you helped me fix!)
#28
06/22/2003 (2:26 pm)
Sure man why not email me at my profile email
#29
06/22/2003 (2:31 pm)
Done and done
#30
06/24/2003 (8:40 am)
Hey badguy, dont mean to be naggy, but did you ever dl the game and look it over?
#31
06/24/2003 (9:04 am)
I did. Its cool. ;)
#32
damn need passive connections to get out my firewall, and I didnt have what it took to break up that link into a login :)
I will tonight when I get home
06/24/2003 (9:47 am)
Naw man ..damn need passive connections to get out my firewall, and I didnt have what it took to break up that link into a login :)
I will tonight when I get home
#33
(remember when accesing an ftp site its fttp://login_name:password@theadress.com)
06/24/2003 (9:54 am)
Oh its cool, just wanted to make sure you didnt forget ;)(remember when accesing an ftp site its fttp://login_name:password@theadress.com)
#34
06/26/2003 (9:47 am)
So uh badguy... yeah
#35
06/27/2003 (5:57 am)
Lol, time for yur daily nagging badguy
#36
Only the first two are required. The last parameter allows you to create a any class that's derived from AIPlayer so if you've got a custom bot class simply pass in the name as the last parameter and you're good to go.
06/27/2003 (12:38 pm)
Just as an FYI, I submitted a resource for an improved AIPlayer spawn function but it's not gotten approved yet. In a nutshell you use it like this:// aiSpawnAIPlayer( datablock, transform, objectName, shapeName, className ); aiSpawnAIPlayer( LightMaleHumanArmor, "1 12 14", "bot000", "Fred", "AIPlayer" );
Only the first two are required. The last parameter allows you to create a any class that's derived from AIPlayer so if you've got a custom bot class simply pass in the name as the last parameter and you're good to go.
#37
and I kept missing my nag too ...
hehe
Email me again today, and ill check it out when I get home.
Promise, I do want to see it.
06/27/2003 (1:26 pm)
I Did forget ..and I kept missing my nag too ...
hehe
Email me again today, and ill check it out when I get home.
Promise, I do want to see it.
#38
hehe, will do badguy, I really appriciate your help
06/27/2003 (1:39 pm)
Looks good J, I'll play with thathehe, will do badguy, I really appriciate your help
Torque Owner Sabrecyd
Here's some example code that I use to spawn bots.
In default.bind.cs:
function addBot5(%val) { if(%val) { AIPlayer::spawnBotAssassin("Reinforcement"); } } moveMap.bind(keyboard, "ctrl 5", addBot5);Remember to add it to the config.cs too if you have one.Then I have this in aiPlayer.cs.
function AIPlayer::spawnBotAssassin(%name) { %player = new AIPlayer("Assassin") { dataBlock = BotArmorAssassin; aiPlayer = true; }; MissionCleanup.add(%player); // Player setup %player.setMoveSpeed(1); %player.setTransform(pickSpawnPoint()); %player.setEnergyLevel(60); %player.setShapeName("Assassin Bot "SPC %name); return %player; }I removed the parts that aren't in a unmodified engine.