Page 1 of 1

Whats the mistake?

PostPosted: Sun Feb 26, 12 11:18 pm
by atrey65789
Here, I have a little somethin-somethin goin on. I'm creating a vest you can where that will put you in God mode for a little bit of time then turns off. I can't compile for some reason.


[spoiler]
//
// Invincibility Shield
// A65
//



class Invincibility extends ChargedPickup;




// ----------------------------------------------------------------------
// Turns God Mode on...
// ----------------------------------------------------------------------

function GodMode(DeusExPlayer Player)

{

PlayerPawn.ConsoleCommand( string God );


Super.GodMode(Player);

}

// ----------------------------------------------------------------------
// Turns God Mode off... frown face :(
// ----------------------------------------------------------------------

function GodModeEnd(DeusExPlayer Player)

{

PlayerPawn.ConsoleCommand( string God );


Super.GodModeEnd(Player);

}
[/spoiler]

PostPosted: Sun Feb 26, 12 11:48 pm
by ~DJ~
Here, try this..

[spoiler]
//
// Invincibility Shield
// A65
//

class Invincibility extends ChargedPickup;

// ----------------------------------------------------------------------
// Turns God Mode on...
// ----------------------------------------------------------------------

function GodMode(DeusExPlayer Player)
{
//PlayerPawn.ConsoleCommand(string God);
//first off, there was no string specified called 'God'
//rather you can do it like this:
//PlayerPawn.ConsoleCommand("God");
//but the problem here is that the God command requires one to be an admin..
//so looking at how we 'God', on class PlayerPawn.. we get this:

PlayerPawn.ReducedDamageType = 'All';
PlayerPawn.ClientMessage("God-mode enabled"); //just to insure if it's working..

//Super.GodMode(Player);
//this command and syntax you have stated here is correct, but in this case this won't work..
//there is no function called 'GodMode()' in the parent class 'ChargedPickup'
//'Super' is called for calling previous function of the parent class, so that if you may not want to override the previous code.
//in short you don't need to call super here.

}

// ----------------------------------------------------------------------
// Turns God Mode off... frown face Sad
// ----------------------------------------------------------------------

function GodModeEnd(DeusExPlayer Player)
{
//PlayerPawn.ConsoleCommand( string God );
//Same stuff here, just getting the part of ungodding and we get this:

PlayerPawn.ReducedDamageType = 'None';
PlayerPawn.ClientMessage("God-mode disabled"); //again for insuring purposes..

//Super.GodModeEnd(Player);
//same thing here, there is no function GodModeEnd() on parent class 'ChargedPickup', this won't work.
}
[/spoiler]

Right I've fixed the code.. but still this just won't magically work... I've included in some comments so you should read those, and compare the codes..

These two functions you have stated are not being called anywhere by the way.. so.. well I'll leave you to this. Study the parent class 'ChargedPickup', and you should try calling these two functions on active and deactive states, and try doing it yourself so you learn UScript.. however if you can't seem to, just post back again and I'll try hinting something, or someone else might help you. :oops:

Good luck. :D

PostPosted: Sun Feb 26, 12 11:56 pm
by atrey65789
Wow... you just schooled me.... Thanks man lol I started Coding today so Yeah I got a quite amount of codes to study lol

PostPosted: Mon Feb 27, 12 5:49 am
by Kalman11
Oh, DJ, some years and u'll became Nobody :D

PostPosted: Mon Feb 27, 12 2:36 pm
by atrey65789
I've been studying the class all throughout last night, and It still can't compile because it says Player Pawn is not a command or expression, I've been trying to think what could of caused this but I can't seem to figure it out lol maybe ONE MORE hint ... lol

PostPosted: Mon Feb 27, 12 2:55 pm
by ~DJ~
Paste your current code here please. :D
also if you can, it would be very kind of you to put it on a spoiler-box. :oops:

PostPosted: Mon Feb 27, 12 2:59 pm
by Alex
You can give this a shot:
[spoiler]//=============================================================================
// Invincibility.
//=============================================================================
class Invincibility extends ChargedPickup;

// ----------------------------------------------------------------------
// Turns God Mode on...
// ----------------------------------------------------------------------
function ChargedPickupBegin(DeusExPlayer Player)
{
Player.ReducedDamageType = 'All';
Player.ClientMessage("God-mode enabled"); // just to insure if it's working..

Super.ChargedPickupBegin(Player);
}

// ----------------------------------------------------------------------
// Turns God Mode off... frown face Sad
// ----------------------------------------------------------------------
function ChargedPickupEnd(DeusExPlayer Player)
{
Player.ReducedDamageType = 'None';
Player.ClientMessage("God-mode disabled"); // again for insuring purposes..

Super.ChargedPickupEnd(Player);
}
[/spoiler]

PostPosted: Mon Feb 27, 12 3:08 pm
by atrey65789
Yep that works.. Thanks!! And I will study the codes!

PostPosted: Mon Feb 27, 12 3:32 pm
by Kalman11
atrey65789 wrote:I've been studying the class all throughout last night, and It still can't compile because it says Player Pawn is not a command or expression, I've been trying to think what could of caused this but I can't seem to figure it out lol maybe ONE MORE hint ... lol

I think the problem is u used PlayerPawn instead Player (in ur function, it's Player)

PostPosted: Mon Feb 27, 12 4:07 pm
by ~DJ~
Oh yeah, I dint notice that, sorry haha :oops:

PostPosted: Tue Feb 28, 12 12:57 am
by atrey65789
Lol its okay. Now I know! lol