
Announcement
Collapse
No announcement yet.
Randomly toggle Boolean?
Collapse
X
-
Muskie repliedWorked perfectly, thankyou!
Though, since I'm a stickler for best practices..
Code:simulated function RandomPerk() { local Controller C; local int perknum; C = Controller; perknum = rand(3); if (perknum == 0) { bPerk0 = True; `log("Bot" @ C @ "Has Selected Perk 0"); } if (perknum == 1) { bPerk1 = True; `log("Bot" @ C @ "Has Selected Perk 1"); } if (perknum == 2) { bPerk2 = True; `log("Bot" @ C @ "Has Selected Perk 2"); } if (perknum == 3) { bPerk3 = True; `log("Bot" @ C @ "Has Selected Perk 3"); } }
Leave a comment:
-
gaz661 repliedsorry,i cant edit my posts.it should be
Code:whichbool = rand(4)+1;
Leave a comment:
-
gaz661 repliedCode:simulated function randombool() { local int whichbool; whichbool = rand(4); if (whichbool == 1) { } if (whichbool == 2 ) { } if (whichbool == 3 ) { } if (whichbool == 4 ) { } }
Leave a comment:
-
Randomly toggle Boolean?
I've got Four Booleans:
Code:bPerkAmmo; bPerkRegen; bPerkVelocity; bPerkBounce;
Currently, I have the AI bot, on Possession of the Pawn, Rattling off a function (in this case, a function that teleports the pawn to a PathNode).
Code:function PossessedBy(Controller C, bool bVehicleTransition) { Super.PossessedBy(C, bVehicleTransition); //Check Wether the Pawn is controlled by an AI if (C !=None) { `log ("Controller is A" @ C); if (C.IsA('UTBot') ) { // Toggle a random perk boolean Teleport(Self); } } else `log("No Controller?"); }
Tags: None
Leave a comment: