j0g32 Posted April 10, 2017 Share Posted April 10, 2017 (edited) How can you spawn Bots of a certain class (via Kismet) ? In Black Dawn, your squad (Gunner, Hotwire, McFarland etc.) are spawned at "notes"/pathnodes via Kismet, and their health and ammo is set to "godmode". But I couldnt yet figure out where the character type is set, such that HUD (and possibly stats) would be updated. There is only one Rx Pawn class available, so I tried switching the skeletal mesh but that doesn't work. Or perhaps is there some other function that can be called on the bots/pawns via execute command, e.g. similar to when you buy a new class at the PT? Thanks! Edited May 8, 2017 by j0g32 solved with Kismet Sequence Node Quote Link to comment Share on other sites More sharing options...
j0g32 Posted April 19, 2017 Author Share Posted April 19, 2017 WIP update: (Rx) Pawns have the attribute/variable/property sth like "CurrCharacterClassInfo", whose type is a RenX class of FamilyInfo. This seems to define/control everything character class related. I managed to output this information from the Bot/Pawn via "GetProperty" node in Kismet (see kenz's videos): "EVA: Class'Rx_Game.Rx_FamilyInfo_GDI_Soldier' " Modifying this property in the same way, did seem to change the output/log, but has no effect on the bot's character... I guess this is because I cannot plugin a reference to the FamilyInfo class directly, but only a String. However, if I changed the modify property value to sth. different from the above structure, e.g. only "Rx_FamilyInfo_GDI_Officer", the output returned None... Or perhaps because it does not automatically update all the other properties such as skeletal meshes and HUD Info, after manually changing the FamilyInfo Property... ? But I don't know how to call (simulated) functions via kismet, such as SetCharClassFromInfo ( Info ), which would presumably do all the updates for me... My next idea was to create new Pawns (extending from Rx_Pawn) and spawn this Pawn directly. My subclass should call the super.SetCharClassFromInfo () directly. But when compiling scripts, I got an error like unexpected "super." or "SetCharClassFromInfo"... I did put mt folder Rx_Singleplayer AFTER Rx_Game in the DefaultEngine.ini though... I am mostly unexperienced with unreal scripts, but I thought that it couldn't be that difficult to change character Class ingame... Perhaps someone has another idea how to change the character of a Player/Bot (=Pawn) via Command/Kismet, or knows an easier approach to this? Many thanks in advance! Quote Link to comment Share on other sites More sharing options...
j0g32 Posted April 21, 2017 Author Share Posted April 21, 2017 update: modifying the property "CurrCharClassInfo" via Kismet Nodes does not change the character directly, but when you open the minimap (M) it updates the correct number of Soldiers and Officers, so some part of the game Logic knows that this Bot should be an officer. And when I select "AIController" instead of "Rx_Bot" or "None" as Controller in the ActorFactory, the HUD (Target Box Info) also updates, though the bot is team neutral... I had a look into the Character pickup crate, which basically makes the PlayerReplicationInfo call the function SetChar(<CharacterFamilyInfo> , <Pawn> ). Theoretically, it might be possible to re-engineer this function SetChar in Kismet, by obtaining all the properties/subclasses, and eventually modifying all the individual bits (HUD, SkeletalMesh etc.) - but obviously this would be too tedious and impractical. Instead, I have tried using a custom Pawn: class Rx_Pawn_SP_GDI_Officer_New extends Rx_Pawn; defaultproperties { Rx_PRI(PlayerReplicationInfo).AddCredits(5000); // Rx_PRI(PlayerReplicationInfo).SetChar(class'Rx_FamilyInfo_GDI_Officer', self); Rx_PRI(PlayerReplicationInfo).SetChar(class'Rx_PurchaseSystem'.default.GDIInfantryClasses[5], self); } However, it seems that the default properties have no effect for this Pawn... I inserted the Add Credits line, since this is easy to check in-game with Kismet, but the new bot only has 150 Credits when he spawns... Another I tried was to follow the tutorial here: https://docs.unrealengine.com/udk/Three/CharactersTechnicalGuide.html And when I placed the new simple Pawn in the editor the Skeletal mesh it looked fine, but as soon as I played in editor, a Nod Soldier mesh appeared, without animations and skin (black) and was floating and shooting around... My feeling is that this is all due to the full-conversion modification of gameplay mechanics for RenX, that a simple Character Change is anything but straightforward... ^^ Probably it is just 1 line of code (correctly written) down that could do the job^^ Quote Link to comment Share on other sites More sharing options...
j0g32 Posted May 4, 2017 Author Share Posted May 4, 2017 Apparently, the Default Properties section cannot call functions, but only set (default) values for properties / variables; that's probably why the AddCredits() did not work for my bot so far. https://docs.unrealengine.com/udk/Three/UnrealScriptDefaultProperties.html I would like to use the SetChar() function, as this should set all the other network and class info (HUD and stats) properly (instead of only changing the skeletal mesh.) Another idea could be to try and modify a function call for my custom pawn, which is called upon spawning the pawn. (perhaps with PostBeginPlay?) /** * RxGame * * */ class Rx_Pawn_SP_GDI_Officer extends Rx_Pawn; event PostBeginPlay() { Super.PostBeginPlay(); Rx_PRI(PlayerReplicationInfo).SetChar(class'Rx_PurchaseSystem'.default.GDIInfantryClasses[5], self); } But I just tried it like that, and it did seem not work yet either... Any ideas would be highly appreciated Cheers Quote Link to comment Share on other sites More sharing options...
j0g32 Posted May 6, 2017 Author Share Posted May 6, 2017 I have no idea where I am getting my stuff wrong... As described above, when I tried set a SkeletalMesh directly for my new Pawn (in default properties, begin object etc.) and I run the game, all I see is the standard GDI soldier, but in black and without any animations. Also, when I set the Pawn to be placeable, you can see the correct mesh in the editor. So, my first conclusion is that, generally, my Pawn script is loaded properly. However, when I use the (simulated) event PostBeginPlay (like everyone else seems to use for additional changes that cannot go in Default Properties - such as calling functions) in combination with a log: à la: 'Log("my Pawn alive"); I don't see any log. For that reason it is not surprising that the execution of "Rx_PRI(PlayerReplicationInfo).AddCredits(5000);" has no effect either. Hence, it seems that the event "PostBeginPlay" of my custom class is not called ?! Does anybody know, if I would have to override the "simulated function PostBeginPlay()", the "simulated event PostBeginPlay()" or both in my child class of Rx_Pawn? For further test purposes, I have also tried to set up an "exec function AddMyCredits (int credits)" which should be called in Kismet via Console Command, but any controller of the pawn (AIController, Rx_Bot, UTBot, None) is unable to "handle" the ConsoleCommand sequence action - most likely because they are bots and not humans who could access the console... All tutorials I could find so far only deal with "changing character" or similar modifications of the box standard UDK/UT, and hence extend from UTPawn, however this does not seem to work, within the Renegade X framework... If there is anyone still around, who developed the Kismet sequences in Black Dawn, would it be possible for you to please give me a heads up, how you spawned the GDI squad (Gunner, Hotwire etc.) ? Many thanks in advance! Quote Link to comment Share on other sites More sharing options...
Agent Posted May 6, 2017 Share Posted May 6, 2017 I haven't really read the majority of this thread, but bots are assigned their character in 'Rx_Game.SetPlayerDefaults' in this segment: if(PurchaseSystem.AirStrip != None) { Rx_Pri(PlayerPawn.PlayerReplicationInfo).CharClassInfo = Rx_Bot(PlayerPawn.Controller).BotBuy(Rx_Bot(PlayerPawn.Controller), true); } else if(PlayerPawn.PlayerReplicationInfo.GetTeamNum() == TEAM_GDI) { Rx_Pri(PlayerPawn.PlayerReplicationInfo).CharClassInfo = PurchaseSystem.GDIInfantryClasses[Rand(15)]; `LogRxPub("GAME" `s "Spawn;" `s "player" `s `PlayerLog(PlayerPawn.PlayerReplicationInfo) `s "character" `s UTPlayerReplicationInfo(PlayerPawn.PlayerReplicationInfo).CharClassInfo); } else if(PlayerPawn.PlayerReplicationInfo.GetTeamNum() == TEAM_NOD) { Rx_Pri(PlayerPawn.PlayerReplicationInfo).CharClassInfo = PurchaseSystem.NodInfantryClasses[Rand(15)]; `LogRxPub("GAME" `s "Spawn;" `s "player" `s `PlayerLog(PlayerPawn.PlayerReplicationInfo) `s "character" `s UTPlayerReplicationInfo(PlayerPawn.PlayerReplicationInfo).CharClassInfo); } Quote Link to comment Share on other sites More sharing options...
j0g32 Posted May 7, 2017 Author Share Posted May 7, 2017 Thanks, @Agent. All I wanted to do is to control (set or change) a bot's (or basically, any Pawn's) infantry class directly in Kismet, since I am spawning all the characters in Kismet as well. I found a solution: a custom Kismet Sequence Node (based on the Toggle advanced Defences Node) class Rx_SeqAct_SetClass extends SequenceAction; var() class<Rx_FamilyInfo> NewClass; var() Rx_Pawn TargetPawn; event Activated() { local SeqVar_Object ObjVar; // for all connected objects at "ModifiedActor" foreach LinkedVariables(class'SeqVar_Object', ObjVar, "ModifiedActor") { // Set reference to linked Target Objects (=Pawns?) TargetPawn = Rx_Pawn(ObjVar.GetObjectValue()); // get the PlayerReplicationInfo of the Target Pawn, and set new Class Rx_PRI(TargetPawn.PlayerReplicationInfo).SetChar(NewClass, TargetPawn); } } defaultproperties { ObjName="Set Infantry Class" ObjCategory="Ren X" Variablelinks(0)=(ExpectedType=class'SeqVar_String', LinkDesc="NewClass", PropertyName=NewClass) Variablelinks(1)=(ExpectedType=class'SeqVar_Object', LinkDesc="ModifiedActor", PropertyName=ModifiedActor) bCallHandler=false } Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.