Page 13 of 17

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

Posted: 28 May 2013, 04:58
by alividerci
Eole wrote:@Alividerci:
If you're standing on an object and don't do a SetAnchor()/SetPlayer()/SetPosition()/Destroy the object/something else. Then yes, the object will keep triggering the OnPlayerTouchesItem event.
it is part of my code, i think trouble is here

Code: Select all

switch (Tag) {
		case C_Object["Armor"]: {
		if(_Player.ArmorMax < 500){
		  if(_Player.ArmorMax == _Player.Armor)
		  {
		  _Player.ArmorMax += C_Object_ArmorMaxValue;
		  _Player.Armor += C_Object_ArmorValue;
		  }

			_Player.Armor += C_Object_ArmorValue;
			//ObjectNextSpawn = Now + C_Timers["Armor"];
			if (_Player.Armor > C_ArmorReductionStart) {
				declare NextArmorReduction for _Player = -1;
				NextArmorReduction = Now + C_ArmorReductionPeriod;
			}
			_Object.SetPlayer(_Player);
			ObjectDestroy(_Object);
		  }
		  else
		  {
		  if(_Player.Armor == 400){_Player.Armor += 100; _Object.SetPlayer(_Player); ObjectDestroy(_Object);}
		  if(_Player.Armor == 300){_Player.Armor += 200; _Object.SetPlayer(_Player); ObjectDestroy(_Object);}
		  if(_Player.Armor == 200){_Player.Armor += 300; _Object.SetPlayer(_Player); ObjectDestroy(_Object);}
		  if(_Player.Armor == 100){_Player.Armor += 400; _Object.SetPlayer(_Player); ObjectDestroy(_Object);}
		  }
		}
		case C_Object["Rocket"]: {
		declare netwrite Net_Combo_AmmoMax for _Player = C_AmmoMax;
		declare CSmMode::EWeapon Weapon;	
        Weapon = CSmMode::EWeapon::Rocket;
		if(Net_Combo_AmmoMax["Rocket"] < 10){
		PickUpWeapon(_Player, Tag);
		_Object.SetPlayer(_Player);
		ObjectDestroy(_Object);
		}
		else{
		//AddPlayerAmmo(_Player, Weapon, 10.);
		//ObjectDestroy(_Object);
		}
		}
		case C_Object["Laser"]: {
		declare netwrite Net_Combo_AmmoMax for _Player = C_AmmoMax;
		declare CSmMode::EWeapon Weapon;	
        Weapon = CSmMode::EWeapon::Laser;
		if(Net_Combo_AmmoMax["Laser"] < 3){
		PickUpWeapon(_Player, Tag);
		_Object.SetPlayer(_Player);
		ObjectDestroy(_Object);
	    }
		else{
		//AddPlayerAmmo(_Player, Weapon, 3.);
		//ObjectDestroy(_Object);
		}
		}
		case C_Object["Nucleus"]: {
		declare netwrite Net_Combo_AmmoMax for _Player = C_AmmoMax;
		declare CSmMode::EWeapon Weapon;	
        Weapon = CSmMode::EWeapon::Nucleus;
		if(Net_Combo_AmmoMax["Nucleus"] < 5){
		PickUpWeapon(_Player, Tag);
		_Object.SetPlayer(_Player);
		ObjectDestroy(_Object);
		}
		else{
		//AddPlayerAmmo(_Player, Weapon, 5.);
		//ObjectDestroy(_Object);
		}
		}
		case C_Object["Arrow"]: {
		declare netwrite Net_Combo_AmmoMax for _Player = C_AmmoMax;
		declare CSmMode::EWeapon Weapon;	
        Weapon = CSmMode::EWeapon::Arrow;
		if(Net_Combo_AmmoMax["Arrow"] < 7){
		PickUpWeapon(_Player, Tag);
		_Object.SetPlayer(_Player);
		ObjectDestroy(_Object);
        }
		else{
		//AddPlayerAmmo(_Player, Weapon, 7.);
		//ObjectDestroy(_Object);
				}
			}
		}
If you have in the maximum number of shoots for any weapon, then you can no longer lift (the object is not destroyed, it is important) but if you ran over an object that can no longer pick up, in the case of self-destruction (etc) if you go over to a subject which you could not pick up you get +2 (or more)

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

Posted: 28 May 2013, 17:02
by Eole
Your code seems correct, but it's hard to say if this part can be the source of the error.
Maybe the function that spawn your objects spawns two items at the same location and time?

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

Posted: 29 May 2013, 10:01
by alividerci
Eole wrote:Your code seems correct, but it's hard to say if this part can be the source of the error.
Maybe the function that spawn your objects spawns two items at the same location and time?
I do not think so

Code: Select all

***PlayLoop***
***
// ---------------------------------- //
// Spawn items
Combo_SpawnObjects();
.....................
// 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 {
		log("PickUpObject: "^Event.Object^" has: "^G_BonusBox.existskey(Event.Object.Id));
		PickUpObject(Event.Player, Event.Object);
		Discard(Event);
		}
	}
more?

function Combo_SpawnObjects(); in a script i called one moment

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

Posted: 29 May 2013, 17:53
by Eole
When the problem happens you see the log you added in the OnPlayerTouchesObject event two times with the same object id?
If you're respawning the object after some times when someone take it (like in Combo), maybe there's a problem with this function. By example the respawn timer of your object is not initialized properly. You walk on an object and take it. But the respawn function respawns it just after. So you're still on the object and take it again, but this time the respawn timer was initialized and the object doesn't respawn immediately. Or something like that ...

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

Posted: 30 May 2013, 03:48
by alividerci
Eole wrote:When the problem happens you see the log you added in the OnPlayerTouchesObject event two times with the same object id?
If you're respawning the object after some times when someone take it (like in Combo), maybe there's a problem with this function. By example the respawn timer of your object is not initialized properly. You walk on an object and take it. But the respawn function respawns it just after. So you're still on the object and take it again, but this time the respawn timer was initialized and the object doesn't respawn immediately. Or something like that ...
yes function running, but i solved this problem....simple destroy when you have max limit of shoots

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

Posted: 30 May 2013, 06:34
by faserg1
I think I know what's up. Maybe when player toches object the varible Spawned changeing on False without condition of MaxAmmo or Max Armor?

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

Posted: 27 Jun 2013, 14:53
by faserg1
Wow, I found (lol!) video, where in old SM was items.
There is:
http://youtu.be/fLLBUAGX-iU?t=1m4s

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

Posted: 03 Aug 2013, 18:10
by steeffeen
does anyone else experience that as well?

when i build a map in storm with some items and want to create a multiplayer game with the map it says that the items i've just placed are missing.. why isn't the game correctly looking for these items? i HAVE to include them in a title pack even though i just want to test something..

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

Posted: 12 Aug 2013, 17:06
by xbx
steeffeen wrote:does anyone else experience that as well?

when i build a map in storm with some items and want to create a multiplayer game with the map it says that the items i've just placed are missing.. why isn't the game correctly looking for these items? i HAVE to include them in a title pack even though i just want to test something..
Yes I'm afraid that at this point, there's no other way. Items not in title packs only appear in the editor IIRC.

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

Posted: 12 Aug 2013, 17:27
by steeffeen
xbx wrote:Yes I'm afraid that at this point, there's no other way. Items not in title packs only appear in the editor IIRC.
okay thanks for the info :thumbsup: