Forum

ASSIST, AMERICA'S ARMY COMMUNITY - RELIVE THE GLORY DAYS OF AMERICA'S ARMY 2.5

Author Topic: exec function  (Read 3372 times)

0 Members and 1 Guest are viewing this topic.

Offline LEEFFM

exec function
« on: Wednesday, December 10, 2014, 03:51:47 AM »
I was wondering if anyone knew how i can set up a working exec function i have "exec function jail (int PlayerID) " its supposed to send people to Leavenworth but i type "jail 1" in the console and i get unrecognized command. i can use function jail (int PlayerID) in UltimateMod but id rather make it its own command instead of using mutate.

UPDATE:

ok this is what ive got but it does not work

testmod.uc:
Code: [Select]
class testmod extends HumanController;

exec function Jail(Int PlayerID) {

    if (PlayerReplicationInfo.PlayerID == PlayerID) {

        Level.Game.BroadcastHandler.Broadcast (None,""$PlayerReplicationInfo.PlayerName$" was Court Marshalled by an Admin for Violation(s) of Server Rules!") ;
        ClientTravel ("Leavenworth",TRAVEL_Absolute,false) ;

    }

}

main.uc:
Code: [Select]
class main extends AGP_GameInfo;

defaultproperties
{
    PlayerControllerClassName = "TestMod.testmod"
}

TestMod.int:
Code: [Select]
[Public]
Object=(Name=TestMod.main,Class=Class,MetaClass=AGP.AGP_GameInfo) 

UPDATE:

I have also tried this.

main.uc:
Code: [Select]
class main extends Mutator;

event PreBeginPlay()
{
 
    Super.PreBeginPlay();

    class'AGP_GameInfo'.default.PlayerControllerClassName = "TestMod.testmod";

    Destroy();
}

I have also tried changing "TestMod.testmod" to "testmod"     .

with this I got rid of the int file and used the same tesmod.uc

anyone got any ideas, how did assist add a afc command? anything similar?
« Last Edit: Wednesday, December 10, 2014, 10:19:41 AM by LEEFFM »

Offline LEEFFM

Re: exec function
« Reply #1 on: Wednesday, December 10, 2014, 20:41:16 PM »
so no one can point me in the right direction for getting a working exec function (jail console command) ???

Offline ELiZ

Re: exec function
« Reply #2 on: Thursday, December 11, 2014, 05:35:07 AM »
Might be that you cant have exec function when extending from Mutator
Code: [Select]
Class SplashInteraction extends Interaction;
final exec function afc(string WhichClass)
{
local PlayerReplicationInfo PRI;
if (ViewportOwner!=None)
{
if (myLevel!=None)
{
ForEach myLevel.AllActors(Class'PlayerReplicationInfo',PRI)
{
if (! PRI.bIsSpectator || PRI.bWaitingPlayer)
{
log(ViewportOwner.Actor.ConsoleCommand("ADMIN FORCECLASS" @ PRI.PlayerName @ WhichClass));
}
}
}
}
}
« Last Edit: Thursday, December 11, 2014, 05:36:39 AM by ELiZ »

Offline NoBigDeal

  • Loyal Member
  • ****
  • Posts: 410
  • Banned
    • View Profile
Re: exec function
« Reply #3 on: Thursday, December 11, 2014, 06:13:11 AM »
@LEEFFM: you should do some serious reading about US, cause you are missing even basics of it.

On Topic:
Engine will scan for executable functions only few specific classes - furthermore, only in owned classes these functions will be executed.
What if you could change the world by changing your perspective of it?
Would you?

Offline LEEFFM

Re: exec function
« Reply #4 on: Thursday, December 11, 2014, 09:43:28 AM »
First off thanks for your replies :D , ok so I did look at the unrealscript legay wiki before posting here PlayerController is listed of one of the classes exec functions are valid in the things I listed/tried were my modifications to things that worked for other people with legacy unrealscript. so I was able to create a new interaction here is the code.

main.uc:
Code: [Select]
class main extends Mutator;

var bool bAffectSpectators;
var bool bAffectPlayers;
var bool bHasInteraction;

function PreBeginPlay()
{
Log("Test Mod Started") ;
}

simulated function Tick(float DeltaTime)
{
local PlayerController PC;

if (bHasInteraction)
Return;
PC = Level.GetLocalPlayerController();

if ( PC != None && ((PC.PlayerReplicationInfo.bIsSpectator && bAffectSpectators) || (bAffectPlayers && !PC.PlayerReplicationInfo.bIsSpectator)) )
{
PC.Player.InteractionMaster.AddInteraction("TestMod.testmod", PC.Player);
bHasInteraction = True;
}
}

DefaultProperties
{
     bAffectSpectators=false
     bAffectPlayers=true
     RemoteRole=ROLE_SimulatedProxy
     bAlwaysRelevant=true
}

testmod.uc:
Code: [Select]
class testmod extends Interaction;

exec function Jail (Int PlayerID) {

    if (ViewportOwner.Actor != None) {

        if (ViewportOwner.Actor.PlayerReplicationInfo.PlayerID == PlayerID) {

            ViewportOwner.Actor.Level.Game.BroadcastHandler.Broadcast (None,""$ViewPortOwner.Actor.PlayerReplicationInfo.PlayerName$" was Court Marshalled by an Admin for Violation(s) of Server Rules!") ;
            ViewportOwner.Actor.ClientTravel ("Leavenworth",TRAVEL_Absolute,false) ;

        }

    }

}

Offline ELiZ

Re: exec function
« Reply #5 on: Thursday, December 11, 2014, 12:32:58 PM »
I think the above function will only allow sending yourself to jail, no one else.

Offline LEEFFM

Re: exec function
« Reply #6 on: Thursday, December 11, 2014, 13:58:20 PM »
Your correct also the command only worked on the client I launched from the same system folder as the lan server, the client I launched on the other computer to test wouldn't kick anybody to Leavenworth im trying to figure something out :P

Offline NoBigDeal

  • Loyal Member
  • ****
  • Posts: 410
  • Banned
    • View Profile
Re: exec function
« Reply #7 on: Friday, December 12, 2014, 13:31:46 PM »
You are still missing the point ... This function is called not because you gave new Interaction to all PC, but because you gave it to yourself.

Tip: Make it ServerSide and use Level.ControllerList iterator ...
... and find a better way than Tick - it's expensive ...
What if you could change the world by changing your perspective of it?
Would you?

Offline LEEFFM

Re: exec function
« Reply #8 on: Sunday, December 14, 2014, 03:51:31 AM »
It never showed me that you replied again so I just saw your reply :P

ok so i got the command to work without extending interaction.

main.uc:
Code: [Select]
class main extends mutator;

event PreBeginPlay () {

Level.Game.BaseMutator.AddMutator(self);
Log("This mod is property of the {=A.A.S.=} America's Army Soldiers Clan !",'LEEFFM');
Log("This mod is made by {=A.A.S.=}LEEFFM",'LEEFFM');
Log("THERE IS NO WARRANTY FOR THIS MOD. We do not take responsibility for any harm done by this MOD",'LEEFFM');
Log("{=A.A.S.=}LEEFFM'S AASEngine Is Loaded",'LEEFFM');


    Level.Game.PlayerControllerClassName="AASEngine.AAS_Controller";

}

AAS_Controller.uc:
Code: [Select]
class AAS_Controller extends HumanController;

replication {

reliable if (Role < 4)
Jail;

}

exec function Jail(int PlayerID) {

local HumanController HC;
local int i;

    for (i = 0; i < Level.Game.GameReplicationInfo.PRIArray.Length; i++) {

        HC = HumanController(Level.Game.GameReplicationInfo.PRIArray[i].GetController());

        if (HC != None) {

            if (HC.PlayerReplicationInfo.PlayerID == PlayerID) {

                Level.Game.BroadcastHandler.Broadcast (None,""$HC.PlayerReplicationInfo.PlayerName$" was Court Marshalled by an Admin for Violation(s) of Server Rules!") ;
                HC.ClientTravel ("Leavenworth",TRAVEL_Absolute,false) ;

            }
        }
    }

}


the only problem is I cant release a mod if I made it like this because you cant add .u files to the assist Client and AASEngine.u has to be added to server packages in the sever ini :P
« Last Edit: Sunday, December 14, 2014, 09:41:08 AM by LEEFFM »

Offline NoBigDeal

  • Loyal Member
  • ****
  • Posts: 410
  • Banned
    • View Profile
Re: exec function
« Reply #9 on: Sunday, December 14, 2014, 12:52:10 PM »
...
the only problem is I cant release a mod if I made it like this because you cant add .u files to the assist Client ...
Unless you modify some of the original native classes, there is no other way ... what did you expect ..?
Anyway, why it must be PC class? Because to make this work, server side execution is enough.
... and above all: what is the true purpose of all of this ..?

BTW: How old you are?
« Last Edit: Sunday, December 14, 2014, 13:00:24 PM by NoBigDeal »
What if you could change the world by changing your perspective of it?
Would you?

Offline LEEFFM

Re: exec function
« Reply #10 on: Monday, December 15, 2014, 07:31:19 AM »
my age is irrelevant and the purpose of me making the commands this way is because the having to use "mutate" before every command is annoying and it would be just nicer to not have to use mutate.
it doesn't have to be in the PlayerController Class it doesn't make a difference to me what class I put it in but it was easier for me to set it up extending the Humancontroller I don't know how to do the commands the way you have said so I did what I could do and the not being able  to release as a mod isn't a big deal ill just keep using mutators but I would have liked to release mods with commands not using mutate because its easier for the person playing the game and using the mod to use normal commands instead of the extra mutate crap but if I cant release it mods that way atleast I found out how to do something that I wanted done even if I cant use it the way I want.

 

Download Assist

×

Download Game Client

Important: Battletracker no longer exists. However, old Battletracker accounts may still work. You can create a new 25Assist account here

Download Server Manager