• Please make sure you are familiar with the forum rules. You can find them here: https://forums.tripwireinteractive.com/index.php?threads/forum-rules.2334636/

Code Accessing the Pawn that belongs to a Controller?

Woden

Member
May 23, 2009
8
0
I'm trying to use Pawn's GiveWeapon method, but I'm starting with a PlayerController. Surely there's some way to make Controller tell me what Pawn it's controlling? Nonfunctional code snippet follows:

Code:
local Controller C;
    
    for ( C = Level.ControllerList; C!=None; C=C.nextController)
    {
        if(C.IsA('KFPlayerController'))
        {
            for(Inv=C.Inventory;Inv!=none;Inv=Inv.Inventory)
            {
                if(Inv.IsA('Deagle') && !Inv.IsA('DSDeagle'))
                {
                    C.GiveWeapon("DualieSwitch.DSDeagle");
                    Inv.Destroy();
                }
 
Woden, I really suggest you search for and install the editor named Wotgreal.

You then would have seen that you have to do C.Pawn to get its pawn (Wotgreal supports 'intellisense')

Also I suggest you join us on irc @ irc.gamesurge.net on the channel #kfmods

Me and a couple of other enthusiasts who sit there will be glad to help.

If you do not get a reply right away, idle in the channel (aka wait!) - means I'm sleepingz or just AFK :)
 
Upvote 0
At a -minimum- I recommend setting up and getting the UnCodeX docs for Killing Floor

UnCodeX is a little program written by Michiel "Elmuerte" Hendriks that takes UScript source and puts it into JavaDoc-like format.. This improves readability and makes it pretty easy to find things.. I find it invaluable since I don't use an IDE for UScript.

http://sourceforge.net/projects/uncodex
 
Upvote 0
Sinner, I actually installed, and instantly uninstalled, WOTgreal a couple of days ago. An interface that is complex to the point of uselessness is not what I want out of software. I reinstalled it after you mentioned it, in order to check out the Intellisense, and all I saw was the same thing I saw in VC++: Everything you type spawns an intrusive little pop-up menu with what appears to be a complete list of classes, variables, and functions available in the language. Which might be useful if it wasn't, you know, A COMPLETE LIST.

Drax, I had not found UnCodeX when I was searching the other day, and thanks for the tip. It is pretty spiffy. :D
 
Upvote 0
IF you would have typed C.Pa (from pawn) you would see its in the list :)

It shows all the functions/vars AVAILABLE in that class :p

Also, you can ctrl+click a 'class' (for example PlayerController) and it would open the file where it is located. Also handy :)

My new mutator is almost finished and will be released tomorrow / 2 days on kfmods.com => !rtd :)
 
Last edited:
Upvote 0