How to use pick up items in your title packs

Discuss everything related to custom data creation.

Moderator: NADEO

User avatar
alividerci
Posts: 363
Joined: 11 Feb 2012, 07:03

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

Post by alividerci »

Eole wrote:You can remove the item pick up bluescreen/sound by discarding the OnPlayerTouchesObject event. But you can't remove the bluescreen/sound of ammo reload.
hmm... so it look that

Code: Select all

// On player touches Object
	else if (Event.Type == CSmModeEvent::EType::OnPlayerTouchesObject) {
		if (Event.Player == Null) {
			Discard(Event);
		} else if (Event.Player != Null && Event.Player.SpawnStatus != CSmPlayer::ESpawnStatus::Spawned) {
			Discard(Event);
		} else {
		PickUpObject(Event.Player, Event.Object);
		//its right???
      //PassOn(Event);
		}
	}
simple i delete PassOn(Event)
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 »

Yes, you replace the PassOn(Event) by a Discard(Event).
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
User avatar
alividerci
Posts: 363
Joined: 11 Feb 2012, 07:03

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

Post by alividerci »

and with new update we have in combo mode mousewheel!
how it do for himself modes?
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 »

Use the OnPlayerRequestActionChange event. Inside it you can access the Event.ActionChange variable. It can be a positive or negative value depending on which direction the player scrolled. Check the Combo script to learn more about it.
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
User avatar
alividerci
Posts: 363
Joined: 11 Feb 2012, 07:03

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

Post by alividerci »

Eole wrote:Use the OnPlayerRequestActionChange event. Inside it you can access the Event.ActionChange variable. It can be a positive or negative value depending on which direction the player scrolled. Check the Combo script to learn more about it.
thx
User avatar
alividerci
Posts: 363
Joined: 11 Feb 2012, 07:03

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

Post by alividerci »

hi, me very interesting how to ObjectDestroy(Object);
when we started to play after the spawn (20 seconds to destroy such an item, but that they worked before to destroy)

Or the simplest will be as follows: how to destroy the object if it has not been picked up?(destroying a particular time)
i am trying do this

Code: Select all

declare DestroyTime = -1;
DestroyTime = Now + C_TimerDestroyBoxBonus;
ObjectDestroy(Object);
i am need in condition for destroy object
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 »

When you create your item you can declare a variable for it:

Code: Select all

// Create the item
declare DestroyTime for Item = 0;
DestroyTime = Now + C_ItemLifetime;
And then in you play loop you can do:

Code: Select all

foreach (Item in Objects) {
	declare DestroyTime for Item = 0;
	if (Now >= DestroyTime) ObjectDestroy(Item);
}
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
User avatar
alividerci
Posts: 363
Joined: 11 Feb 2012, 07:03

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

Post by alividerci »

Eole wrote:When you create your item you can declare a variable for it:

Code: Select all

// Create the item
declare DestroyTime for Item = 0;
DestroyTime = Now + C_ItemLifetime;
And then in you play loop you can do:

Code: Select all

foreach (Item in Objects) {
	declare DestroyTime for Item = 0;
	if (Now >= DestroyTime) ObjectDestroy(Item);
}
:?
http://img689.imageshack.us/img689/6348/81449007.png
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 »

Indeed, you can't modify an array during a foreach loop inside it.

Code: Select all

declare ToRemove = Ident[];
foreach (Item in Objects) {
   declare DestroyTime for Item = 0;
   if (Now >= DestroyTime) ToRemove.add(Item.Id);
}
foreach (ItemId in ToRemove) {
  ObjectDestroy(Objects[ItemId]);
}
Contribute to the ManiaPlanet documentation on GitHub
A question about ManiaScript? Ask it here!
User avatar
alividerci
Posts: 363
Joined: 11 Feb 2012, 07:03

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

Post by alividerci »

Eole wrote:Indeed, you can't modify an array during a foreach loop inside it.

Code: Select all

declare ToRemove = Ident[];
foreach (Item in Objects) {
   declare DestroyTime for Item = 0;
   if (Now >= DestroyTime) ToRemove.add(Item.Id);
}
foreach (ItemId in ToRemove) {
  ObjectDestroy(Objects[ItemId]);
}
thx, and i again get new expirience of ManiaScript from you :thumbsup:
Post Reply

Return to “Title Pack & Custom Data Creation”

Who is online

Users browsing this forum: No registered users and 1 guest