How to use pick up items in your title packs

Discuss everything related to custom data creation.

Moderator: NADEO

Post Reply
ScavangeR
Posts: 70
Joined: 09 Nov 2010, 03:29

Re: How to use pick up items in your title packs

Post by ScavangeR »

Hi all,

A friend of mine and I are actually trying some things with maniascript, and we're actually trying to deal with pickup objects.

We're actually facing a problem, we would like the object to drop at player position when the player carrying the item is killed.

We tried to use DetachItem but the item just desapear. Still it's well detached cause we managed to create a timer on DetachItem to do it respawn at the initial anchor after a while.
We have no idea whats we're doing wrong here... Can you please help us ?

Here some parts of our MS:


***StartMap***

Code: Select all

declare Integer Intel1StartDate = 0;
declare Integer IntelDrop = 0;

/* Create Pickables Items*/

ItemList_Begin();
declare ArmorId = ItemList_Add("SMCommon\\Pickups\\Armor.Item.gbx");
ItemList_End();
declare ItemArmor = CreateItem(ArmorId);

log("Debut Ancre");
foreach (ItemAnchor in ItemAnchors) 
{
	log(ItemAnchor.ItemName);
   switch (ItemAnchor.ItemName) 
	{
      case "SMCommon\\Pickups\\Armor.Item.gbx": 
		{
		log("attach");
         AttachItemToAnchor(ItemArmor, ItemAnchor);
      }
   }
}
***PlayLoop***

Code: Select all

if (ItemArmor.IsDetached)
{
	if ( (Now - IntelDrop) >= 16000)
	{
		IntelDrop = Now;
		foreach (ItemAnchor in ItemAnchors) 
		{
		   switch (ItemAnchor.ItemName) 
			{
		      case "SMCommon\\Pickups\\Armor.Item.gbx": 
				{
					log("attach");
		        	AttachItemToAnchor(ItemArmor, ItemAnchor);
		      	}
		   }
		}
	}
}
/* Manage what happen when picked object */	
	if (Event.Type == CSmModeEvent::EType::OnPlayerTouchesItem) 
	{
      	if (Event.Player != Null && Event.Player.SpawnStatus == CSmPlayer::ESpawnStatus::Spawned)
 		{
         AttachItemToPlayer(Event.Item, Event.Player);
			
			Intel1StartDate = Now;
			log("at : "^Intel1StartDate);
			
         	Event.Player.ForceColor = SpyColor;
			Event.Player.AmmoGain = 4.0;
			Event.Player.ArmorMax = 400;
			Event.Player.Armor = 400;
			SetPlayerWeapon(Event.Player, CSmMode::EWeapon::Nucleus, False);
			SetPlayerAmmoMax(Event.Player, CSmMode::EWeapon::Nucleus, 2);
			Event.Player.StaminaGain = 1.0;
			Score::AddPoints(Event.Player, 20);

         PassOn(Event);
      }
   }
	// On armor empty
	if (Event.Type == CSmModeEvent::EType::OnArmorEmpty) 
	{
		IntelDrop = DetachIntel(ItemArmor, Event.Victim);
		
		if (Event.Shooter == Event.Victim || Event.Shooter == Null) 
		{
			Score::RemovePoints(Event.Victim, 1);
		}
		XmlRpc::OnArmorEmpty(Event);
		PassOn(Event);
	} 

Code: Select all

Integer DetachIntel (CSmItem Intel, CSmPlayer Player)
{
	if (Player.ForceColor  == SpyColor)
	{
	
		log("------------");
		log("Item position before detaching it: "^Intel.Position);
		log("Player position before detaching item: "^Player.Position);
		log("------------");
	  	DetachItem(Intel);
      	log("Item position after detaching it: "^Intel.Position);
		log("Player position after detaching item: "^Player.Position);
		log("------------");
		
		return Now;
	}
	return 0;
}
User avatar
Eole
Nadeo
Nadeo
Posts: 1265
Joined: 26 Apr 2011, 21:08

Re: How to use pick up items in your title packs

Post by Eole »

Hello,

You can try to do this, just after creating the item:

Code: Select all

declare MyItem = CreateItem(MyItemId);
MyItem.StayInArena = True;
With StayInArena set to true on the item, it should be automatically spawned in the map when the item is detached.

Instead of a simple DetachItem() you could also try a DetachItemAndSetPosition() in your DetachIntel() function:

Code: Select all

DetachItemAndSetPosition(Intel, Player.Position);
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
ScavangeR
Posts: 70
Joined: 09 Nov 2010, 03:29

Re: How to use pick up items in your title packs

Post by ScavangeR »

Eole wrote:

Code: Select all

MyItem.StayInArena = True;
That was that simple ... Shame on us ^^'
TYVM :3
Ex-Alice007
Posts: 88
Joined: 15 Mar 2013, 13:47
Location: -= Terre =-

Re: How to use pick up items in your title packs

Post by Ex-Alice007 »

Bonjour,

après quelques recherches me voila à poster. Je cherches comment passer une map Download sur un serveur combos peux être édité en DM (Melee).

En faite, si quelqu'un sait me dire où mettre "SMPickupItems" [DL du 1er post] quand j'essaye de l'editer, mess d'erreur, l’éditeur ne trouve pas les fichiers...

Merci
User avatar
phil13hebert
Posts: 564
Joined: 29 Oct 2011, 14:11
Location: Québec

Re: How to use pick up items in your title packs

Post by phil13hebert »

Ex-Alice007 wrote:Bonjour,

après quelques recherches me voila à poster. Je cherches comment passer une map Download sur un serveur combos peux être édité en DM (Melee).

Merci

Code: Select all

#Const	CompatibleMapTypes	"MeleeArena"
OS: Windows 7 64 bit
CPU: Intel Core i7 3770 @ 3.40Ghz
RAM: 8GB DDR3 798MHz
GPU: Nvidia GeForce GTX 660 1536MB
Motherboard: Intel 0KM92T
Sound: 7.1
Peripherals: Logitech G510, SteelSeries sensei raw, Corsair vengeance 1500
Ex-Alice007
Posts: 88
Joined: 15 Mar 2013, 13:47
Location: -= Terre =-

Re: How to use pick up items in your title packs

Post by Ex-Alice007 »

Image


C'est plus parlant en image :)



/Enjoy
User avatar
steeffeen
Translator
Translator
Posts: 2472
Joined: 14 Oct 2012, 16:22
Location: Germany

Re: How to use pick up items in your title packs

Post by steeffeen »

phil13hebert wrote:

Code: Select all

#Const	CompatibleMapTypes	"MeleeArena"
that doesn't really help..

the problem about Combo maps is that they are edited in the combo title pack so you will have to edit them inside it again, i think it should be possible to remove all the pickup items and assign the proper map type (MeleeArena) inside the pack making it possible to open the map inside SMStorm in the next step or using it on a normal (DM) server
    Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

    ManiaControl, FancyManiaLinks
    User avatar
    steeffeen
    Translator
    Translator
    Posts: 2472
    Joined: 14 Oct 2012, 16:22
    Location: Germany

    Re: How to use pick up items in your title packs

    Post by steeffeen »

    Ex-Alice007 wrote:C'est plus parlant en image :)
    /Enjoy
    i guess you will have to open the map inside the according title pack ("MeleeUltimate")
      Game Mode and Title Pack Creator, Developer, ShootMania-Player & more

      ManiaControl, FancyManiaLinks
      User avatar
      phil13hebert
      Posts: 564
      Joined: 29 Oct 2011, 14:11
      Location: Québec

      Re: How to use pick up items in your title packs

      Post by phil13hebert »

      Désolé :?
      J'avais mal compris ta question ;)
      OS: Windows 7 64 bit
      CPU: Intel Core i7 3770 @ 3.40Ghz
      RAM: 8GB DDR3 798MHz
      GPU: Nvidia GeForce GTX 660 1536MB
      Motherboard: Intel 0KM92T
      Sound: 7.1
      Peripherals: Logitech G510, SteelSeries sensei raw, Corsair vengeance 1500
      Ex-Alice007
      Posts: 88
      Joined: 15 Mar 2013, 13:47
      Location: -= Terre =-

      Re: How to use pick up items in your title packs

      Post by Ex-Alice007 »

      steeffeen wrote:
      Ex-Alice007 wrote:C'est plus parlant en image :)
      /Enjoy
      i guess you will have to open the map inside the according title pack ("MeleeUltimate")
      actually, thank you for your help Steef.
      I opened the editor ShootMania Storm.
      Sometimes you'll get away if things ready for us.

      phil13hebert wrote:Désolé :?
      J'avais mal compris ta question ;)
      Aucun soucie, merci ;)

      Edit : Viens voir par la toi :gotcha:

      /Enjoy
      Post Reply

      Return to “Title Pack & Custom Data Creation”

      Who is online

      Users browsing this forum: No registered users and 1 guest