Page 11 of 17

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

Posted: 20 May 2013, 22:18
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)

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

Posted: 21 May 2013, 09:09
by Eole
Yes, you replace the PassOn(Event) by a Discard(Event).

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

Posted: 21 May 2013, 13:47
by alividerci
and with new update we have in combo mode mousewheel!
how it do for himself modes?

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

Posted: 21 May 2013, 18:13
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.

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

Posted: 21 May 2013, 18:48
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

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

Posted: 22 May 2013, 18:25
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

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

Posted: 23 May 2013, 14:10
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);
}

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

Posted: 23 May 2013, 15:01
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

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

Posted: 23 May 2013, 16:21
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]);
}

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

Posted: 23 May 2013, 16:55
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: