Monsterhunt Extra Live Pickup

Discussions about Coding and Scripting
User avatar
papercoffee
Godlike
Posts: 10453
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: Monsterhunt Extra Live Pickup

Post by papercoffee »

:???: I can't merge your post Crev... wtf?!!
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Monsterhunt Extra Live Pickup

Post by JackGriffin »

Do me a favor paper and remove his attachment so version mismatch doesn't become an issue. My new download is corrected.
So long, and thanks for all the fish
User avatar
papercoffee
Godlike
Posts: 10453
Joined: Wed Jul 15, 2009 11:36 am
Personal rank: coffee addicted !!!
Location: Cologne, the city with the big cathedral.
Contact:

Re: Monsterhunt Extra Live Pickup

Post by papercoffee »

He did it already... ;)
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Monsterhunt Extra Live Pickup

Post by JackGriffin »

OK, quick update and a question for those of you that can really code (as opposed to me, who can't even make a simple pickup).

I tested the ExtraLife and it does not work right. I have this bit of code in it:

Code: Select all

		   log("Player lives is at:"@P.PlayerReplicationInfo.Deaths);
		   log("LivesLimit is at:"@LivesLimit);
			if(P.PlayerReplicationInfo.Deaths < LivesLimit)
         	P.PlayerReplicationInfo.Deaths = (P.PlayerReplicationInfo.Deaths) + ExtraLivesAwarded;
and it logs out like this:
ScriptLog: Player lives is at: 9.000000
ScriptLog: LivesLimit is at: 10
even though I set the LivesLimit in the pickup on the map to 2. Can someone tell me what in the world I'm doing wrong here? It's probably something you've dealt with that I haven't because I just don't make pickups. All my stuff goes into proper mods and this is the first time actually that I've built something to have flexibility when placed in editor.

Anyways the source is in the download above if you get a moment to look. As far as I can see it should work, but it does indeed log out with a return value that isn't desired so something isn't right.
So long, and thanks for all the fish
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Monsterhunt Extra Live Pickup

Post by Higor »

JackGriffin wrote: I tested the ExtraLife and it does not work right. I have this bit of code in it:

Code: Select all

		   log("Player lives is at:"@P.PlayerReplicationInfo.Deaths);
		   log("LivesLimit is at:"@LivesLimit);
			if(P.PlayerReplicationInfo.Deaths < LivesLimit)
         	P.PlayerReplicationInfo.Deaths = (P.PlayerReplicationInfo.Deaths) + ExtraLivesAwarded;
and it logs out like this:
ScriptLog: Player lives is at: 9.000000
ScriptLog: LivesLimit is at: 10
Log ExtraLives awarded as well, is it an INT?.
Log Player Lives after the addition as well.

Faster method, change:

Code: Select all

P.PlayerReplicationInfo.Deaths = (P.PlayerReplicationInfo.Deaths) + ExtraLivesAwarded;
for

Code: Select all

P.PlayerReplicationInfo.Deaths += ExtraLivesAwarded;
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Monsterhunt Extra Live Pickup

Post by JackGriffin »

Logged it out:
ScriptLog: Player lives is at: 2.000000
ScriptLog: LivesLimit is at: 10
ScriptLog: Extra lives awarded: 1
ScriptLog: New player lives is: 3.000000
ScriptLog: Player lives is at: 3.000000
ScriptLog: LivesLimit is at: 10
ScriptLog: Extra lives awarded: 1
ScriptLog: New player lives is: 4.000000
ScriptLog: Player lives is at: 4.000000
ScriptLog: LivesLimit is at: 10
ScriptLog: Extra lives awarded: 1
ScriptLog: New player lives is: 5.000000
ScriptLog: Player lives is at: 5.000000
ScriptLog: LivesLimit is at: 10
ScriptLog: Extra lives awarded: 1
ScriptLog: New player lives is: 6.000000
For some reason the LivesLimit will not alter when changed in the map. It reverts back to the default property no matter what you set it at.

Added: Alucard mentioned trying to admin set an updated variable once the game started. I'll be darned if that didn't work so it can accept something besides the default. I seem to remember something along these same lines in health pickups being unable to alter settings in them too like this so it's not something I've done. I tried a multitude of other ways and tests and I can't break this. You might be stuck with one less variable C.
So long, and thanks for all the fish
Higor
Godlike
Posts: 1866
Joined: Sun Mar 04, 2012 6:47 pm

Re: Monsterhunt Extra Live Pickup

Post by Higor »

See SpawnCopy() in pickup function, you may want to Sub that function.

Don't clearly remember, but SpawnCopy either gives a copy of the item to player (weapon), or gives item to player, and spawns invisible copy waiting to reappear on the designed place.
Either way, doing something like this Child.LivesLimit = LivesLimit in SpawnCopy() will make the newly created copy inherit this property.


EDIT:
Found this, it's the example to follow:
Original function in Inventory:

Code: Select all

function inventory SpawnCopy( pawn Other )
{
	local inventory Copy;
	if( Level.Game.ShouldRespawn(self) )
	{
		Copy = spawn(Class,Other,,,rot(0,0,0));
		Copy.Tag           = Tag;
		Copy.Event         = Event;
		GotoState('Sleeping');
	}
	else
		Copy = self;

	Copy.RespawnTime = 0.0;
	Copy.bHeldItem = true;
	Copy.GiveTo( Other );
	return Copy;
}
Subclass function in Pickup:

Code: Select all

function inventory SpawnCopy( pawn Other )
{
	local inventory Copy;

	Copy = Super.SpawnCopy(Other);
	Copy.Charge = Charge;
	return Copy;
}
That's how pickups manage to keep charge over respawns.
User avatar
Creavion
Godlike
Posts: 4497
Joined: Sun Feb 17, 2008 7:23 pm
Personal rank: About to be non-act.
Location: Germany, Lower Saxony

Re: Monsterhunt Extra Live Pickup

Post by Creavion »

I hope you do not drop the project half finished now. :tongue:
About to be non-active
My very last UT map project: CTF-FacePalm (tropical CTF-Face remake)
Why do I leave? click here
What I want to do next: Joining an UDK team (uncertain however) and improve 3D modelling and texture editing skills
Thanks to those who visibly supported me until/at the end!
My reactivated account on indiedb.com.
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Monsterhunt Extra Live Pickup

Post by JackGriffin »

If you can live with one less setting then it's ready for you. If you must have control of lives separate from the setting in the MH ini then it's going to be half done. I've tried every way I know to force the setting from a map embedded mutator and nothing will work. You are quite welcome to take the source code and contact someone like wormbo and see if it's possible to do another way.
So long, and thanks for all the fish
Letylove49
Adept
Posts: 277
Joined: Tue Feb 28, 2012 7:47 pm
Location: suisse
Contact:

Re: Monsterhunt Extra Live Pickup

Post by Letylove49 »

this mutator will work with MH2 or not ? i can test it if you don't have done yet.
Image



Image
Letylove49 aka Alicia
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Monsterhunt Extra Live Pickup

Post by JackGriffin »

Sure it will. The only thing that doesn't work on it is the limit if it is different than max lives is on the server. I'm not really sure why someone would want that anyway but to each their own.
So long, and thanks for all the fish
User avatar
Dr.Flay
Godlike
Posts: 3348
Joined: Thu Aug 04, 2011 9:26 pm
Personal rank: Chaos Evangelist
Location: Kernow, UK
Contact:

Re: Monsterhunt Extra Live Pickup

Post by Dr.Flay »

Excuse my ignorance, but as someone who is "wired differently", I tend to think in reverse.
Try turning a problem upside-down and follow the new logic chain.

For example, is it possible to start with the max-lives at "0" and add them after (or that sort of thing, if you see what I mean)
JackGriffin
Godlike
Posts: 3774
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: -Retired-

Re: Monsterhunt Extra Live Pickup

Post by JackGriffin »

Honestly I'm not sure. It's going to take server testing to find out. There is something in the native code preventing certain alterations of UT_Invisibility (it's parent class). I chose invis because I wanted the flexibility to use the extralife as a relic and have it spawn across the map. There's nothing stopping you from recoding it from something else like 'trigger' and I'm sure that would work. In fact I'm positive since I use trigger class some in MH-HoldTheLine for some specific effects called by the client that affect other things not in the event chain.

Ok, that sounded geek as hell...Put simply this code could work just fine in a trigger subclassing. Just follow the important parts of what I did and you can do this with a fair amount of ease. Keep the messaging classes because they are pretty handy when people don't understand WTF is going on. I'd be happy to continue on it but right now I'm up to my virtual elbows in another project. If this thing didn't work I'd find time to address it but the fact remains it does work just fine and I don't really have a spare evening for a little while to devote to a reclass. If anyone wants to grab it and go forward, you know I don't have a problem with it.
So long, and thanks for all the fish
Post Reply