Monsterhunt Extra Live Pickup

Discussions about Coding and Scripting

Re: Monsterhunt Extra Live Pickup

Postby papercoffee » Wed Apr 04, 2012 7:50 pm

:???: I can't merge your post Crev... wtf?!!
User avatar
papercoffee
Site Staff
 
Posts: 3471
Joined: Wed Jul 15, 2009 11:36 am
Location: cologne
Personal rank: coffee addicted !!!

Re: Monsterhunt Extra Live Pickup

Postby JackGriffin » Wed Apr 04, 2012 7:53 pm

Do me a favor paper and remove his attachment so version mismatch doesn't become an issue. My new download is corrected.
/away for now.
JackGriffin
Godlike
 
Posts: 1836
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Retired as of Sep-11

Re: Monsterhunt Extra Live Pickup

Postby papercoffee » Wed Apr 04, 2012 8:27 pm

He did it already... ;)
User avatar
papercoffee
Site Staff
 
Posts: 3471
Joined: Wed Jul 15, 2009 11:36 am
Location: cologne
Personal rank: coffee addicted !!!

Re: Monsterhunt Extra Live Pickup

Postby JackGriffin » Thu Apr 05, 2012 3:43 am

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.
/away for now.
JackGriffin
Godlike
 
Posts: 1836
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Retired as of Sep-11

Re: Monsterhunt Extra Live Pickup

Postby Higor » Thu Apr 05, 2012 6:59 am

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;
Higor
Adept
 
Posts: 339
Joined: Sun Mar 04, 2012 6:47 pm

Re: Monsterhunt Extra Live Pickup

Postby JackGriffin » Thu Apr 05, 2012 12:31 pm

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.
/away for now.
JackGriffin
Godlike
 
Posts: 1836
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Retired as of Sep-11

Re: Monsterhunt Extra Live Pickup

Postby Higor » Thu Apr 05, 2012 5:06 pm

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.
Higor
Adept
 
Posts: 339
Joined: Sun Mar 04, 2012 6:47 pm

Re: Monsterhunt Extra Live Pickup

Postby Creavion » Mon Apr 09, 2012 2:05 pm

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.
User avatar
Creavion
Godlike
 
Posts: 4498
Joined: Sun Feb 17, 2008 7:23 pm
Location: Germany, Lower Saxony
Personal rank: About to be non-act.

Re: Monsterhunt Extra Live Pickup

Postby JackGriffin » Mon Apr 09, 2012 2:44 pm

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.
/away for now.
JackGriffin
Godlike
 
Posts: 1836
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Retired as of Sep-11

Re: Monsterhunt Extra Live Pickup

Postby Letylove49 » Mon Apr 09, 2012 5:53 pm

this mutator will work with MH2 or not ? i can test it if you don't have done yet.
<[MHA]>Letylove49 aka Shado170
Letylove49
Novice
 
Posts: 9
Joined: Tue Feb 28, 2012 7:47 pm
Location: Retired
Personal rank: <[MHA] >Admin

Re: Monsterhunt Extra Live Pickup

Postby JackGriffin » Mon Apr 09, 2012 8:01 pm

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.
/away for now.
JackGriffin
Godlike
 
Posts: 1836
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Retired as of Sep-11

Re: Monsterhunt Extra Live Pickup

Postby Dr.Flay » Mon Apr 09, 2012 8:59 pm

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)
User avatar
Dr.Flay
Godlike
 
Posts: 1225
Joined: Thu Aug 04, 2011 9:26 pm
Location: Kernow, UK
Personal rank: C= AMIGA freak

Re: Monsterhunt Extra Live Pickup

Postby JackGriffin » Tue Apr 10, 2012 2:43 am

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.
/away for now.
JackGriffin
Godlike
 
Posts: 1836
Joined: Fri Jan 14, 2011 1:53 pm
Personal rank: Retired as of Sep-11

Previous

Return to Coding, Scripting

Who is online

Users browsing this forum: No registered users and 2 guests