ok, first of all... im somewhat new to unreal coding, but i also am starting to get the overall framework of it. im doing a simple weapon project of my own, mostly to learn how to code a little and also potentially for a mod down the road...
here's my situation: i want to check to see if the player is crouching, in determining the weapon spread.
yes, i know that code doesnt workCode:event ModeDoFire() { local PlayerController PC; PC = PlayerController(Instigator.Controller); // 1. CHECK if GUN IS "COOL" if ( Level.TimeSeconds - LastFireTime > 0.5 ) Spread = Default.Spread; // 2. CHECK if PLAYER IS CROUCHED else if ( PC.bIsCrouched == True ) { Log("checking crouch: PC"); } // 3. ELSE, WIDEn SPREAD A LOT else { Spread = FMin(Spread+0.02,0.12); } LastFireTime = Level.TimeSeconds; Super.ModeDoFire(); }![]()
i was trying to tap into the variable/state by checking the bIsCrouched, but it yells at me ("error, Cast from Pawn to PlayerCOntroller will always fail" is the wotgreal/ucc message).
how do i do this?
any/all tips would be greatly appreciated. normally, id look to the base code for a working example of the kind of thing i want, but i just dont see one.



Reply With Quote



Bookmarks