Page 3 of 17
Re: How to use pick up items in your title packs
Posted: 23 Apr 2013, 09:19
by alividerci
when i am paste this code
Code: Select all
***PlayLoop***
***
/* ------------------------------------- */
// Spawn players
if (G_PlayerSpawnQueue.count > 0 && LastSpawnTime + (S_SpawnInterval * 1000) < Now) {
UpdateBlockSpawnQueue();
SpawnPlayers();
LastSpawnTime = Now;
UIManager.UIAll.BigMessageSound = CUIConfig::EUISound::StartRound;
UIManager.UIAll.BigMessage = _("Spawning players...");
LastMessageTime = -1;
UIManager.UIAll.CountdownEndTime = LastSpawnTime + (S_SpawnInterval * 1000);
LayerUpdated = Layers::Update("SpawnQueue", UpdateLayerSpawnQueue());
}
// ---------------------------------- //
/** Spawn items
* This function must be called at each frame inside the play loop
*/
Void SpawnItems() {
// Loop on all the items the mapper put on the map
foreach (ItemAnchor in ItemAnchors) {
// Check if an item is already spawn on this anchor
declare ItemSpawned for ItemAnchor = False;
if (ItemSpawned) continue;
// Check if the respawn timer has been reach
declare ItemNextSpawn for ItemAnchor = Now;
if (ItemNextSpawn > Now) continue;
// Create an empty item
declare CSmItem Item;
// Depending on the item anchor tag, assign the right item
switch (ItemAnchor.Tag) {
case "Armor" : Item = CreateItem(ArmorId);
case "Rocket" : Item = CreateItem(RocketId);
case "Laser" : Item = CreateItem(LaserId);
case "Nucleus" : Item = CreateItem(NucleusId);
case "Arrow" : Item = CreateItem(ArrowId);
}
// If the item was correctly created
if (Item != Null) {
// Save from which anchor the item was spawned
declare AnchorId for Item = NullId;
AnchorId = ItemAnchor.Id;
// Save the tag of the anchor in the item
declare Tag for Item = ItemAnchor.Tag;
Tag = ItemAnchor.Tag;
// Spawn the item on the anchor
AttachItemToAnchor(Item, ItemAnchor);
ItemSpawned = True;
}
}
}
// ---------------------------------- //
//second part
/** Pick up item
*
* @param _Player The player who picked up the item
* @param _Item The item picked up by the player
*/
Void PickUpItem(CSmPlayer _Player, CSmItem _Item) {
if (_Player == Null || _Item == Null) return;
// Get the tag and the anchor of the item
declare Tag for _Item = "";
declare AnchorId for _Item = NullId;
// Check that the anchor associated with the item really exists
if (!ItemAnchors.existskey(AnchorId)) return;
declare ItemAnchor <=> ItemAnchors[AnchorId];
// We picked up the item, so it's not spawned on the anchor anymore
declare ItemSpawned for ItemAnchor = False;
ItemSpawned = False;
// Update the time of the next item respawn on this anchor
declare ItemNextSpawn for ItemAnchor = Now;
ItemNextSpawn = Now + 45000; ///< Respawn in 45 seconds
// Check the tag associated to the item and do something accordingly
switch (Tag) {
// If it's an armor, reload one armor point
case "Armor": {
_Player.Armor += 100;
}
// If it's a weapon, then switch to this weapon
case "Rocket": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Rocket, False);
}
case "Laser": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Laser, False);
}
case "Nucleus": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Nucleus, False);
}
case "Arrow": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Arrow, False);
}
}
// Attach the item to the player to display the blue flashing screen feedback
AttachItemToPlayer(_Item, _Player);
// Destroy the item after that
DestroyItem(_Item);
}
i get error if i writing without void function(i have not error and second part code founded in functions)
Code: Select all
//second part
/** Pick up item
*
* @param _Player The player who picked up the item
* @param _Item The item picked up by the player
*/
Void PickUpItem(CSmPlayer _Player, CSmItem _Item) {
if (_Player == Null || _Item == Null) return;
// Get the tag and the anchor of the item
declare Tag for _Item = "";
declare AnchorId for _Item = NullId;
// Check that the anchor associated with the item really exists
if (!ItemAnchors.existskey(AnchorId)) return;
declare ItemAnchor <=> ItemAnchors[AnchorId];
// We picked up the item, so it's not spawned on the anchor anymore
declare ItemSpawned for ItemAnchor = False;
ItemSpawned = False;
// Update the time of the next item respawn on this anchor
declare ItemNextSpawn for ItemAnchor = Now;
ItemNextSpawn = Now + 45000; ///< Respawn in 45 seconds
// Check the tag associated to the item and do something accordingly
switch (Tag) {
// If it's an armor, reload one armor point
case "Armor": {
_Player.Armor += 100;
}
// If it's a weapon, then switch to this weapon
case "Rocket": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Rocket, False);
}
case "Laser": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Laser, False);
}
case "Nucleus": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Nucleus, False);
}
case "Arrow": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Arrow, False);
}
}
// Attach the item to the player to display the blue flashing screen feedback
AttachItemToPlayer(_Item, _Player);
// Destroy the item after that
DestroyItem(_Item);
}
maybe i need to include some files?
Re: How to use pick up items in your title packs
Posted: 23 Apr 2013, 09:39
by Eole
Code: Select all
***PlayLoop***
***
// Function will be called at each frame of the PlayLoop
DoSomething();
***
Void DoSomething() {
// Do something
}
This is how it works. You have to paste the functions at the end of your script, and after you can call them in the rest of your script.
Code: Select all
***StartServer***
***
ItemList_Begin();
declare ArmorId = ItemList_Add("SMCommon\\Pickups\\Armor.Item.gbx");
declare RocketId = ItemList_Add("SMCommon\\Pickups\\Rocket.Item.gbx");
declare LaserId = ItemList_Add("SMCommon\\Pickups\\Laser.Item.gbx");
declare NucleusId = ItemList_Add("SMCommon\\Pickups\\Nucleus.Item.gbx");
declare ArrowId = ItemList_Add("SMCommon\\Pickups\\Arrow.Item.gbx");
ItemList_End();
***
***PlayLoop***
***
foreach (Event in PendingEvents) {
if (Event.Type == CSmModeEvent::EType::OnPlayerTouchesItem) {
PickUpItem(Event.Player, Event.Item);
PassOn(Event);
} else {
PassOn(Event);
}
}
SpawnItems();
***
// ---------------------------------- //
/** Spawn items
* This function must be called at each frame inside the play loop
*/
Void SpawnItems() {
// Loop on all the items the mapper put on the map
foreach (ItemAnchor in ItemAnchors) {
// Check if an item is already spawn on this anchor
declare ItemSpawned for ItemAnchor = False;
if (ItemSpawned) continue;
// Check if the respawn timer has been reach
declare ItemNextSpawn for ItemAnchor = Now;
if (ItemNextSpawn > Now) continue;
// Create an empty item
declare CSmItem Item;
// Depending on the item anchor tag, assign the right item
switch (ItemAnchor.Tag) {
case "Armor" : Item = CreateItem(ArmorId);
case "Rocket" : Item = CreateItem(RocketId);
case "Laser" : Item = CreateItem(LaserId);
case "Nucleus" : Item = CreateItem(NucleusId);
case "Arrow" : Item = CreateItem(ArrowId);
}
// If the item was correctly created
if (Item != Null) {
// Save from which anchor the item was spawned
declare AnchorId for Item = NullId;
AnchorId = ItemAnchor.Id;
// Save the tag of the anchor in the item
declare Tag for Item = ItemAnchor.Tag;
Tag = ItemAnchor.Tag;
// Spawn the item on the anchor
AttachItemToAnchor(Item, ItemAnchor);
ItemSpawned = True;
}
}
}
// ---------------------------------- //
/** Pick up item
*
* @param _Player The player who picked up the item
* @param _Item The item picked up by the player
*/
Void PickUpItem(CSmPlayer _Player, CSmItem _Item) {
if (_Player == Null || _Item == Null) return;
// Get the tag and the anchor of the item
declare Tag for _Item = "";
declare AnchorId for _Item = NullId;
// Check that the anchor associated with the item really exists
if (!ItemAnchors.existskey(AnchorId)) return;
declare ItemAnchor <=> ItemAnchors[AnchorId];
// We picked up the item, so it's not spawned on the anchor anymore
declare ItemSpawned for ItemAnchor = False;
ItemSpawned = False;
// Update the time of the next item respawn on this anchor
declare ItemNextSpawn for ItemAnchor = Now;
ItemNextSpawn = Now + 45000; ///< Respawn in 45 seconds
// Check the tag associated to the item and do something accordingly
switch (Tag) {
// If it's an armor, reload one armor point
case "Armor": {
_Player.Armor += 100;
}
// If it's a weapon, then switch to this weapon
case "Rocket": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Rocket, False);
}
case "Laser": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Laser, False);
}
case "Nucleus": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Nucleus, False);
}
case "Arrow": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Arrow, False);
}
}
// Attach the item to the player to display the blue flashing screen feedback
AttachItemToPlayer(_Item, _Player);
// Destroy the item after that
DestroyItem(_Item);
}
Re: How to use pick up items in your title packs
Posted: 23 Apr 2013, 09:50
by alividerci
Eole wrote:Code: Select all
***PlayLoop***
***
// Function will be called at each frame of the PlayLoop
DoSomething();
***
Void DoSomething() {
// Do something
}
This is how it works. You have to paste the functions at the end of your script, and after you can call them in the rest of your script.
Code: Select all
***StartServer***
***
ItemList_Begin();
declare ArmorId = ItemList_Add("SMCommon\\Pickups\\Armor.Item.gbx");
declare RocketId = ItemList_Add("SMCommon\\Pickups\\Rocket.Item.gbx");
declare LaserId = ItemList_Add("SMCommon\\Pickups\\Laser.Item.gbx");
declare NucleusId = ItemList_Add("SMCommon\\Pickups\\Nucleus.Item.gbx");
declare ArrowId = ItemList_Add("SMCommon\\Pickups\\Arrow.Item.gbx");
ItemList_End();
***
***PlayLoop***
***
foreach (Event in PendingEvents) {
if (Event.Type == CSmModeEvent::EType::OnPlayerTouchesItem) {
PickUpItem(Event.Player, Event.Item);
PassOn(Event);
} else {
PassOn(Event);
}
}
SpawnItems();
***
// ---------------------------------- //
/** Spawn items
* This function must be called at each frame inside the play loop
*/
Void SpawnItems() {
// Loop on all the items the mapper put on the map
foreach (ItemAnchor in ItemAnchors) {
// Check if an item is already spawn on this anchor
declare ItemSpawned for ItemAnchor = False;
if (ItemSpawned) continue;
// Check if the respawn timer has been reach
declare ItemNextSpawn for ItemAnchor = Now;
if (ItemNextSpawn > Now) continue;
// Create an empty item
declare CSmItem Item;
// Depending on the item anchor tag, assign the right item
switch (ItemAnchor.Tag) {
case "Armor" : Item = CreateItem(ArmorId);
case "Rocket" : Item = CreateItem(RocketId);
case "Laser" : Item = CreateItem(LaserId);
case "Nucleus" : Item = CreateItem(NucleusId);
case "Arrow" : Item = CreateItem(ArrowId);
}
// If the item was correctly created
if (Item != Null) {
// Save from which anchor the item was spawned
declare AnchorId for Item = NullId;
AnchorId = ItemAnchor.Id;
// Save the tag of the anchor in the item
declare Tag for Item = ItemAnchor.Tag;
Tag = ItemAnchor.Tag;
// Spawn the item on the anchor
AttachItemToAnchor(Item, ItemAnchor);
ItemSpawned = True;
}
}
}
// ---------------------------------- //
/** Pick up item
*
* @param _Player The player who picked up the item
* @param _Item The item picked up by the player
*/
Void PickUpItem(CSmPlayer _Player, CSmItem _Item) {
if (_Player == Null || _Item == Null) return;
// Get the tag and the anchor of the item
declare Tag for _Item = "";
declare AnchorId for _Item = NullId;
// Check that the anchor associated with the item really exists
if (!ItemAnchors.existskey(AnchorId)) return;
declare ItemAnchor <=> ItemAnchors[AnchorId];
// We picked up the item, so it's not spawned on the anchor anymore
declare ItemSpawned for ItemAnchor = False;
ItemSpawned = False;
// Update the time of the next item respawn on this anchor
declare ItemNextSpawn for ItemAnchor = Now;
ItemNextSpawn = Now + 45000; ///< Respawn in 45 seconds
// Check the tag associated to the item and do something accordingly
switch (Tag) {
// If it's an armor, reload one armor point
case "Armor": {
_Player.Armor += 100;
}
// If it's a weapon, then switch to this weapon
case "Rocket": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Rocket, False);
}
case "Laser": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Laser, False);
}
case "Nucleus": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Nucleus, False);
}
case "Arrow": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Arrow, False);
}
}
// Attach the item to the player to display the blue flashing screen feedback
AttachItemToPlayer(_Item, _Player);
// Destroy the item after that
DestroyItem(_Item);
}
I've tried it before you've written but alas mistake ... hey can I do something with the code
p.s thx for helping
Re: How to use pick up items in your title packs
Posted: 23 Apr 2013, 10:58
by alividerci
Re: How to use pick up items in your title packs
Posted: 23 Apr 2013, 16:03
by Eole
Well, indeed ... A function can only access variables declared inside it or globale variables. So:
Code: Select all
// declare a globale variable
declare Ident[Text] Weapons;
***StartServer***
***
ItemList_Begin();
Weapons.clear();
Weapons["Armor"] = ItemList_Add("SMCommon\\Pickups\\Armor.Item.gbx");
Weapons["Rocket"] = ItemList_Add("SMCommon\\Pickups\\Rocket.Item.gbx");
Weapons["Laser"] = ItemList_Add("SMCommon\\Pickups\\Laser.Item.gbx");
Weapons["Nucleus"] = ItemList_Add("SMCommon\\Pickups\\Nucleus.Item.gbx");
Weapons["Arrow"] = ItemList_Add("SMCommon\\Pickups\\Arrow.Item.gbx");
ItemList_End();
***
***PlayLoop***
***
foreach (Event in PendingEvents) {
if (Event.Type == CSmModeEvent::EType::OnPlayerTouchesItem) {
PickUpItem(Event.Player, Event.Item);
PassOn(Event);
} else {
PassOn(Event);
}
}
SpawnItems();
***
// ---------------------------------- //
/** Spawn items
* This function must be called at each frame inside the play loop
*/
Void SpawnItems() {
// Loop on all the items the mapper put on the map
foreach (ItemAnchor in ItemAnchors) {
// Check if an item is already spawn on this anchor
declare ItemSpawned for ItemAnchor = False;
if (ItemSpawned) continue;
// Check if the respawn timer has been reach
declare ItemNextSpawn for ItemAnchor = Now;
if (ItemNextSpawn > Now) continue;
// Create an empty item
declare CSmItem Item;
// Depending on the item anchor tag, assign the right item
switch (ItemAnchor.Tag) {
case "Armor" : Item = CreateItem(Weapons["Armor"]);
case "Rocket" : Item = CreateItem(Weapons["Rocket"]);
case "Laser" : Item = CreateItem(Weapons["Laser"]);
case "Nucleus" : Item = CreateItem(Weapons["Nucleus"]);
case "Arrow" : Item = CreateItem(Weapons["Arrow"]);
}
// If the item was correctly created
if (Item != Null) {
// Save from which anchor the item was spawned
declare AnchorId for Item = NullId;
AnchorId = ItemAnchor.Id;
// Save the tag of the anchor in the item
declare Tag for Item = ItemAnchor.Tag;
Tag = ItemAnchor.Tag;
// Spawn the item on the anchor
AttachItemToAnchor(Item, ItemAnchor);
ItemSpawned = True;
}
}
}
// ---------------------------------- //
/** Pick up item
*
* @param _Player The player who picked up the item
* @param _Item The item picked up by the player
*/
Void PickUpItem(CSmPlayer _Player, CSmItem _Item) {
if (_Player == Null || _Item == Null) return;
// Get the tag and the anchor of the item
declare Tag for _Item = "";
declare AnchorId for _Item = NullId;
// Check that the anchor associated with the item really exists
if (!ItemAnchors.existskey(AnchorId)) return;
declare ItemAnchor <=> ItemAnchors[AnchorId];
// We picked up the item, so it's not spawned on the anchor anymore
declare ItemSpawned for ItemAnchor = False;
ItemSpawned = False;
// Update the time of the next item respawn on this anchor
declare ItemNextSpawn for ItemAnchor = Now;
ItemNextSpawn = Now + 45000; ///< Respawn in 45 seconds
// Check the tag associated to the item and do something accordingly
switch (Tag) {
// If it's an armor, reload one armor point
case "Armor": {
_Player.Armor += 100;
}
// If it's a weapon, then switch to this weapon
case "Rocket": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Rocket, False);
}
case "Laser": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Laser, False);
}
case "Nucleus": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Nucleus, False);
}
case "Arrow": {
SetPlayerWeapon(_Player, CSmMode::EWeapon::Arrow, False);
}
}
// Attach the item to the player to display the blue flashing screen feedback
AttachItemToPlayer(_Item, _Player);
// Destroy the item after that
DestroyItem(_Item);
}
Re: How to use pick up items in your title packs
Posted: 23 Apr 2013, 16:11
by alividerci
>>>it is working(are you kidding me Eole?)

Re: How to use pick up items in your title packs
Posted: 23 Apr 2013, 17:36
by alividerci
bit offtop: today i am going play in combo i pickup boxes but they dont change(why? in setting set 1,2,3,4)
how to get mini icons from combo(is it images or not?)
Re: How to use pick up items in your title packs
Posted: 23 Apr 2013, 17:42
by Eole
alividerci wrote:>>>it is working(are you kidding me Eole?)

My bad, doing too many things at the same time is not a good idea. You're right Ident[Text] is much better.
alividerci wrote:bit offtop: today i am going play in combo i pickup boxes but they dont change(why? in setting set 1,2,3,4)
how to get mini icons from combo(is it images or not?)
The Combo script is now available to every one
here.
You can check
this topic for more details.
Re: How to use pick up items in your title packs
Posted: 23 Apr 2013, 17:48
by alividerci
Eole wrote:alividerci wrote:>>>it is working(are you kidding me Eole?)

My bad, doing too many things at the same time is not a good idea. You're right Ident[Text] is much better.
alividerci wrote:bit offtop: today i am going play in combo i pickup boxes but they dont change(why? in setting set 1,2,3,4)
how to get mini icons from combo(is it images or not?)
The Combo script is now available to every one
here.
You can check
this topic for more details.
agree when a lot of you do, you might miss a small thing
thx,for big help...for combo script thx

Re: How to use pick up items in your title packs
Posted: 24 Apr 2013, 09:16
by alividerci
everything works except for this bug
http://img515.imageshack.us/img515/5555/53107805.png
and i wrote this line
Code: Select all
/* -------------------------------------- */
// Server start
/* -------------------------------------- */
// Init UI
declare LayerAttached = False;
declare LayerDetached = False;
declare LayerUpdated = False;
declare LayerSpawnQueueId = Layers::Create("SpawnQueue");
declare LayerScoresTableId = Layers::Create("ScoresTable");
declare LayerInfoId = Layers::Create("Info");
declare LayerTopsId = Layers::Create("Tops");
declare LayerScoresInSpawnId = Layers::Create("ScoresInSpawn");
declare Default_Weapons = [CSmMode::EWeapon::Rocket];
/* -------------------------------------- */
// Round start
/* -------------------------------------- */
/* -------------------------------------- */
// Round init
/* -------------------------------------- */
/* -------------------------------------- */
// Round start
/* -------------------------------------- */
foreach (Player in Players) {
declare NextArmorReduction for Player = -1;
NextArmorReduction = -1;
declare Weapons for Player = CSmMode::EWeapon[];
declare AmmoMax for Player = C_AmmoMax;
AmmoMax = C_AmmoMax;
declare UI <=> UIManager.GetUI(Player);
if (UI != Null) {
declare netwrite Text Net_Combo_Weapon for UI;
Net_Combo_Weapon = "Rocket";
}
Weapons = Default_Weapons;
Player.ArmorMax = C_Default_ArmorMax;
Player.AmmoGain = C_AmmoGain["Rocket"];
SetPlayerWeapon(Player, CSmMode::EWeapon::Rocket, False);
SetPlayerAmmoMax(Player, CSmMode::EWeapon::Rocket, AmmoMax["Rocket"]);
SetPlayerAmmoMax(Player, CSmMode::EWeapon::Laser, AmmoMax["Laser"]);
SetPlayerAmmoMax(Player, CSmMode::EWeapon::Nucleus, AmmoMax["Nucleus"]);
SetPlayerAmmoMax(Player, CSmMode::EWeapon::Arrow, AmmoMax["Arrow"]);
SetPlayerReloadAllWeapons(Player, True);
declare Integer RoundHits for Player;
RoundHits = 0;
if (Player.Score != Null) Player.Score.RoundPoints = 1;
}
UpdateLayerInfo();
// ---------------------------------- //
// Initialize items
DestroyAllItems();
foreach (ItemAnchor in ItemAnchors) {
declare ItemSpawned for ItemAnchor = False;
declare ItemNextSpawn for ItemAnchor = Now;
ItemSpawned = False;
ItemNextSpawn = Now + C_Item_Delay;
}
// Attach layers
LayerDetached = Layers::DetachAll(NullId);
LayerAttached = Layers::Attach("SpawnQueue", NullId);
LayerAttached = Layers::Attach("ScoresTable", NullId);
LayerAttached = Layers::Attach("ScoresInSpawn", NullId);
LayerUpdated = Layers::Update("ScoresInSpawn", UpdateLayerScoresInSpawn());
Rules::Attach();
LayerAttached = Layers::Attach("Info", NullId);
LayerUpdated = Layers::Update("Info", UpdateLayerInfo());
LayerUpdated = Layers::Update("ScoresTable", UpdateLayerScoresTable());
/* -------------------------------------- */
// Play loop
/* -------------------------------------- */
// UI
if (LastUIUpdateTime + C_UITickPeriod < Now) {
LastUIUpdateTime = Now;
LayerUpdated = Layers::Update("Info", UpdateLayerInfo());
/* ------------------------------------- */
// Round End
/* ------------------------------------- */
/* ------------------------------------- */
// Map End
/* ------------------------------------- */
***EndMap***
***
LayerDetached = Layers::DetachAll(NullId);
LayerDetached = Layers::Detach("Info", NullId); // just tried
/* ------------------------------------- */
// Server End
/* ------------------------------------- */
/* ------------------------------------- */
// Functions
/* ------------------------------------- */
// ---------------------------------- //
/** Spawn items
* This function must be called at each frame inside the play loop
*/
/* ------------------------------------- */
// ---------------------------------- //
// ---------------------------------- //
// ---------------------------------- //
// ---------------------------------- //
/** Generate the info manialink
*
* @return The manialink Text
*/
Text UpdateLayerInfo() {
return """
<frame posn="-68 -76" id="Frame_WeaponInfo">
<quad posn="0 0" sizen="6 6" halign="right" valign="center" image="{{{C_ImgBaseDir}}}Laser.dds" id="Quad_IconLaser" />
<quad posn="12 0" sizen="6 6" halign="right" valign="center" image="{{{C_ImgBaseDir}}}Nucleus.dds" id="Quad_IconNucleus" />
<quad posn="24 0" sizen="6 6" halign="right" valign="center" image="{{{C_ImgBaseDir}}}Arrow.dds" id="Quad_IconArrow" />
<quad posn="36 0" sizen="6 6" halign="right" valign="center" image="{{{C_ImgBaseDir}}}Rocket.dds" id="Quad_IconRocket" />
<frame posn="0 0.3">
<label posn="0 0" sizen="6 6" halign="left" valign="center" textemboss="1" text="0" id="Label_AmmoLaser" />
<label posn="12 0" sizen="6 6" halign="left" valign="center" textemboss="1" text="0" id="Label_AmmoNucleus" />
<label posn="24 0" sizen="6 6" halign="left" valign="center" textemboss="1" text="0" id="Label_AmmoArrow" />
<label posn="36 0" sizen="6 6" halign="left" valign="center" textemboss="1" text="0" id="Label_AmmoRocket" />
</frame>
</frame>
<script><!--
#Include "TextLib" as TL
main() {
declare Frame_WeaponInfo <=> (Page.GetFirstChild("Frame_WeaponInfo") as CMlFrame);
declare Label_AmmoLaser <=> (Page.GetFirstChild("Label_AmmoLaser") as CMlLabel);
declare Label_AmmoNucleus <=> (Page.GetFirstChild("Label_AmmoNucleus") as CMlLabel);
declare Label_AmmoArrow <=> (Page.GetFirstChild("Label_AmmoArrow") as CMlLabel);
declare Label_AmmoRocket <=> (Page.GetFirstChild("Label_AmmoRocket") as CMlLabel);
declare Quad_IconLaser <=> (Page.GetFirstChild("Quad_IconLaser") as CMlQuad);
declare Quad_IconNucleus <=> (Page.GetFirstChild("Quad_IconNucleus") as CMlQuad);
declare Quad_IconArrow <=> (Page.GetFirstChild("Quad_IconArrow") as CMlQuad);
declare Quad_IconRocket <=> (Page.GetFirstChild("Quad_IconRocket") as CMlQuad);
declare netread Integer Net_Combo_AmmoUpdate for UI;
declare netread Integer[Text] Net_Combo_AmmoMax for UI;
declare netread Text Net_Combo_Weapon for UI;
declare PrevIsSpectatorMode = False;
declare PrevAmmoUpdate = 0;
declare PrevWeapon = "";
while (True) {
sleep(100);
if (!PageIsVisible) continue;
if (InputPlayer == Null) continue;
if (PrevIsSpectatorMode != IsSpectatorMode) {
PrevIsSpectatorMode = IsSpectatorMode;
if (IsSpectatorMode) Frame_WeaponInfo.Hide();
else Frame_WeaponInfo.Show();
}
if (PrevAmmoUpdate != Net_Combo_AmmoUpdate) {
PrevAmmoUpdate = Net_Combo_AmmoUpdate;
foreach (Weapon => AmmoMax in Net_Combo_AmmoMax) {
declare WeaponText = "$aaa"^AmmoMax;
declare WeaponIcon = "{{{C_ImgBaseDir}}}"^Weapon^".dds";
if (AmmoMax > 0) {
WeaponText = "$fff"^AmmoMax;
WeaponIcon = "{{{C_ImgBaseDir}}}"^Weapon^"White.dds";
}
switch (Weapon) {
case "Laser" : {
Label_AmmoLaser.SetText(WeaponText);
if (Http.IsValidUrl(WeaponIcon)) Quad_IconLaser.ChangeImageUrl(WeaponIcon);
}
case "Nucleus" : {
Label_AmmoNucleus.SetText(WeaponText);
if (Http.IsValidUrl(WeaponIcon)) Quad_IconNucleus.ChangeImageUrl(WeaponIcon);
}
case "Arrow" : {
Label_AmmoArrow.SetText(WeaponText);
if (Http.IsValidUrl(WeaponIcon)) Quad_IconArrow.ChangeImageUrl(WeaponIcon);
}
case "Rocket" : {
Label_AmmoRocket.SetText(WeaponText);
if (Http.IsValidUrl(WeaponIcon)) Quad_IconRocket.ChangeImageUrl(WeaponIcon);
}
}
}
}
if (PrevWeapon != Net_Combo_Weapon) {
switch (PrevWeapon) {
case "Laser" : Quad_IconLaser.Scale = 1.;
case "Nucleus" : Quad_IconNucleus.Scale = 1.;
case "Arrow" : Quad_IconArrow.Scale = 1.;
case "Rocket" : Quad_IconRocket.Scale = 1.;
}
switch (Net_Combo_Weapon) {
case "Laser" : Quad_IconLaser.Scale = 1.3;
case "Nucleus" : Quad_IconNucleus.Scale = 1.3;
case "Arrow" : Quad_IconArrow.Scale = 1.3;
case "Rocket" : Quad_IconRocket.Scale = 1.3;
}
PrevWeapon = Net_Combo_Weapon;
}
}
}
--></script>""";
}
}
tell me where is my fault that I did or did not write!
Thank you for your support