take the method .. Player.AddCommand(new PlayerCommand(CommandType, TargetbjectID, delayTime))
say i want to input just commandtype and the delay time, how would i skip the TargetObjectID?
This forum is locked and will eventually go offline. If you have feedback to share you can find us in our Discord channel "MythoLogic Interactive" https://discord.gg/nECKnbT7gk
Forum rules
Forum rules
A way to skip parameters in method
Forum rules
By using the forum you agree to the following rules.
By using the forum you agree to the following rules.
-
jamisco
- Superfighter

- Posts: 67
- Joined: Sun Nov 06, 2016 11:34 pm
- Title: Da God
- SFD Account: Jamisco
- SFD Alias: Jamisco
- Started SFD: either late 2015 or early 2016
- Location: Somewhere in the east of the United states
- Gender:
- Age: 105
A way to skip parameters in method
0 x
Is it better to be feared or respected... please, is it too much to ask for both?
- JakSparro98
- Superfighter

- Posts: 530
- Joined: Fri Jul 15, 2016 7:56 pm
- Started SFD: PreAlpha 1.0.5
- Location: Rome, Italy
- Gender:
- Age: 27
Player Command has many constructors, their parameters cannot be bypassed but you can fill some with useless data, if for instance i use the one with PlayerCommand (PlayerCommandType action, Vector2 worldPosition, Int delayTime = 0) I will fill like that:
player.AddCommand(new PlayerCommand(PlayerCommandType.WaitLand,Vector2.Zero,20000));
Normally WaitLand doesn't use Vector2 type, so I guess this parameter will be ignored.
1 x
-
jamisco
- Superfighter

- Posts: 67
- Joined: Sun Nov 06, 2016 11:34 pm
- Title: Da God
- SFD Account: Jamisco
- SFD Alias: Jamisco
- Started SFD: either late 2015 or early 2016
- Location: Somewhere in the east of the United states
- Gender:
- Age: 105
i see, so how would you by pass target object id
0 x
Is it better to be feared or respected... please, is it too much to ask for both?
If the TargetObjectID command does not affect the result of execution, then write any (better than 0) or use null
1 x
- Gurt
- Lead Programmer

- Posts: 1887
- Joined: Sun Feb 28, 2016 3:22 pm
- Title: Lead programmer
- Started SFD: Made it!
- Location: Sweden
- Gender:
- Age: 36
The PlayerCommand has several constructor overloads. Use the most appropriate one. Sending in the wrong parameters won't do anything if it can't be applicable.
Code: Select all
/*
// Example use:
IPlayer player = Game.CreatePlayer(Vector2.Zero);
player.AddCommand(new PlayerCommand(PlayerCommandType.StartMoveToPosition, new Vector2(100f, 0f))); // player will start to move to world position X = 100
player.AddCommand(new PlayerCommand(PlayerCommandType.Walk)); // player will walk instead of run
player.AddCommand(new PlayerCommand(PlayerCommandType.WaitDestinationReached)); // wait for destination reached
player.AddCommand(new PlayerCommand(PlayerCommandType.Jump, PlayerCommandFaceDirection.Left)); // jump after destination reached and face left
player.AddCommand(new PlayerCommand(PlayerCommandType.WaitLand)); // wait to land after jump
player.AddCommand(new PlayerCommand(PlayerCommandType.Dive, PlayerCommandFaceDirection.Left)); // dive to the left
// other actions
player.AddCommand(new PlayerCommand(PlayerCommandType.StartTakeCover, Game.GetSingleObjectByCustomID("BarrelWithCustomID").UniqueID)); // take cover behind object with custom ID "BarrelWithCustomID" (this also makes the player move to the cover if the player is too far away).
player.AddCommand(new PlayerCommand(PlayerCommandType.DrawHandgun)); // draws the handgun slot if the player has a handgun
player.AddCommand(new PlayerCommand(PlayerCommandType.StartCrouch)); // makes the player start crouching (until PlayerCommandType.StopCrouch is called)
*/
2 x
Gurt
