Page 1 of 2

WeaponSelection.Script.txt

Posted: 14 Apr 2013, 05:58
by alividerci
how to use WeaponSelection.Script.txt?

Re: WeaponSelection.Script.txt

Posted: 14 Apr 2013, 12:03
by steeffeen
just look at the script file itself, it's not that complicated
i didn't use it yet but i see these main functions here:

Code: Select all

Void Load();
Void Unload();

Code: Select all

Void StartAll();
Void StopAll();
(you can start the selection for specific players, too)

Code: Select all

CSmMode::EWeapon GetWeapon(CSmPlayer _Player);
but don't mix this script up with the weapon changing in combo, i'm pretty sure they used an CUILayer ManialinkPage to listen for KeyPressed events
the WeaponSelection script is probably used in elite with the corresponding script setting enabled

Re: WeaponSelection.Script.txt

Posted: 15 Apr 2013, 04:42
by alividerci
i dont know how it use

Re: WeaponSelection.Script.txt

Posted: 15 Apr 2013, 14:28
by Eole
Steeffeen asked the right question, what are you trying to do?

If you want to display a weapon selection screen as in Siege before the players are spawn, then this library is the right one. If you want to use weapon switching as in Combo, then you'll have to proceed differently. What's your goal?
steeffeen wrote:but don't mix this script up with the weapon changing in combo, i'm pretty sure they used an CUILayer ManialinkPage to listen for KeyPressed events
Nice try, but that's not it. ^^
We use a new feature based on the Action system to avoid lag caused by a netread/netwrite in UI.

Code: Select all

foreach (Event in PendingEvents) {
  if (Event.Type == CSmModeEvent::EType::OnActionEvent) {
    switch (Event.ActionSlot) {
      case CSmModeEvent::EActionSlots::Weapon: DoSomething();   ///< Default: left mouse click
      case CSmModeEvent::EActionSlots::Movement: DoSomething(); ///< Default: right mouse click
      case CSmModeEvent::EActionSlots::Activable1: DoSomething(); ///< Default: 1
      case CSmModeEvent::EActionSlots::Activable2: DoSomething(); ///< Default: 2
      case CSmModeEvent::EActionSlots::Activable3: DoSomething(); ///< Default: 3
      case CSmModeEvent::EActionSlots::Activable4: DoSomething(); ///< Default: 4
    }
  }		
}

Re: WeaponSelection.Script.txt

Posted: 15 Apr 2013, 14:32
by steeffeen
Image

:lol:

is it possible to discard these events preventing that a shot is being fired or a jump is being performed? ^.^

Re: WeaponSelection.Script.txt

Posted: 15 Apr 2013, 14:35
by Eole
Once the Action system will be complete and released, yes.

Re: WeaponSelection.Script.txt

Posted: 15 Apr 2013, 14:36
by steeffeen
Eole wrote:Once the Action system will be complete and released, yes.
sweet :yes:

Re: WeaponSelection.Script.txt

Posted: 16 Apr 2013, 04:01
by alividerci
Eole wrote:Steeffeen asked the right question, what are you trying to do?

If you want to display a weapon selection screen as in Siege before the players are spawn, then this library is the right one. If you want to use weapon switching as in Combo, then you'll have to proceed differently. What's your goal?
steeffeen wrote:but don't mix this script up with the weapon changing in combo, i'm pretty sure they used an CUILayer ManialinkPage to listen for KeyPressed events
Nice try, but that's not it. ^^
We use a new feature based on the Action system to avoid lag caused by a netread/netwrite in UI.

Code: Select all

foreach (Event in PendingEvents) {
  if (Event.Type == CSmModeEvent::EType::OnActionEvent) {
    switch (Event.ActionSlot) {
      case CSmModeEvent::EActionSlots::Weapon: DoSomething();   ///< Default: left mouse click
      case CSmModeEvent::EActionSlots::Movement: DoSomething(); ///< Default: right mouse click
      case CSmModeEvent::EActionSlots::Activable1: DoSomething(); ///< Default: 1
      case CSmModeEvent::EActionSlots::Activable2: DoSomething(); ///< Default: 2
      case CSmModeEvent::EActionSlots::Activable3: DoSomething(); ///< Default: 3
      case CSmModeEvent::EActionSlots::Activable4: DoSomething(); ///< Default: 4
    }
  }		
}
i think my goal second!(such as in a combo mode) I want to switch weapon when i running and shooting(and why in pack server we havent royal script)besides i want to use UI in game mode.... where tutorial? thx
p.s tutorial by gugli i have seen

Re: WeaponSelection.Script.txt

Posted: 16 Apr 2013, 09:26
by Eole
For a combo style weapon switching your mode will have to be in a TitlePack. Once it's done it's easy to do what you want.

Code: Select all

foreach (Event in PendingEvents) {
	if (Event.Type == CSmModeEvent::EType::OnActionEvent) {
		switch (Event.ActionSlot) {
			case CSmModeEvent::EActionSlots::Activable1: {
				SetPlayerWeapon(Player, CSmMode::EWeapon::Laser, False);
			}
			case CSmModeEvent::EActionSlots::Activable2: {
				SetPlayerWeapon(Player, CSmMode::EWeapon::Nucleus, False);
			}
			case CSmModeEvent::EActionSlots::Activable3: {
				SetPlayerWeapon(Player, CSmMode::EWeapon::Arrow, False);
			}
			case CSmModeEvent::EActionSlots::Activable4: {
				SetPlayerWeapon(Player, CSmMode::EWeapon::Rocket, False);
			}
		}
	}
}
With this you 'll be able to switch weapons while playing. The SetPlayerWeapon uses three parameters:
- The player who want to change of weapon
- The new weapon to use
- Enable/Disable the automatic weapon switch when a player go underground or on a laser pad

Re: WeaponSelection.Script.txt

Posted: 16 Apr 2013, 15:11
by alividerci
hmm, I have always plagued this questions! How for example can not change weapons underground or on the laser platform (optional)
And is it possible to change the rate of recharge for each weapon separately .... speed of regeneration health on a platforms? thx and pls give me answer for my before post question(where royal script in server pack?)