Jump to content


Photo

Theme: Power


  • Please log in to reply
31 replies to this topic

#21 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 24 April 2008 - 12:19 PM

"s" is missing ==> uncodex

yes, Damage method has to be changed, by something like:
if (UTPawn(instigatedBy.Pawn)) != none)
	{
	   Damage = OriginalDamage * (1 + UTPawn(instigatedBy.Pawn).ShieldBeltArmor / 100);
	}

Edited by xiongmao, 24 April 2008 - 12:19 PM.


#22 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 24 April 2008 - 12:32 PM

The only way to learn is to challenge yourself :)

a) The member is unrecognised because there is no such variable called 'allPawn' in the WorldInfo. Xiongmao's code isn't an exact represenation that you can copy and paste - you need to write your code based upon what you can find that is useful in the WorldInfo.

b) 'Instigator' isn't useful in the damage function. Read the function definition, it already has both the pawn that is being damaged (injured), and the controller of the pawn that dealt the damage (instigatedby). There is no 'Instigator' in the function. Instead, use what you have been given - the injured pawn.

Edit: Xiongmao beat me to it.

Edited by ambershee, 24 April 2008 - 12:33 PM.


#23 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 24 April 2008 - 12:39 PM

ahah
He will understand better by your explanation than by the code I pasted :)

#24 jaguar

jaguar
  • Members
  • 19 posts

Posted 24 April 2008 - 12:45 PM

How do you translate this:

native final iterator function AllPawns ( class<Pawn> BaseClass, out Pawn P, optional vector TestLocation, optional float TestRadius )

returns all Pawns in the PawnList that are of the specified class or a subclass
@note: useful on both client and server; pawns are added/removed from pawnlist in PostBeginPlay (on clients, only relevant pawns will be available)
@param BaseClass the base class of Pawn to return
@param (out) P the returned Pawn for each iteration
@param (optional) TestLocation is the world location used if TestRadius > 0
@param (optional) TestRadius is the radius checked against using TestLocation, skipping any pawns not within that value


into meaningful code

Tried a lot of different variations of:
foreach WorldInfo.AllPawns(class'UTPawn', out Pawn P)


#25 ambershee

ambershee

    Nimbusfish Rawks

  • Hosted
  • 3,114 posts
  • Location:Derby, UK
  • Projects:Mutator Week & Unreal 3 Projects
  •  Mad Mod Boffin

Posted 24 April 2008 - 12:51 PM

foreach WorldInfo.AllPawns(class'UTPawn', out Pawn P)
{
	if (P = PawnIWant)
	{
		DoSomethingTo(P);
	}
}

Where PawnIWant is some sort of check, such as checking it's a UTPawn and not None, and DoSomethingTo is a function to affect the pawn.

#26 jaguar

jaguar
  • Members
  • 19 posts

Posted 24 April 2008 - 12:55 PM

function Tick(float Delta)
{
	foreach WorldInfo.AllPawns(class'UTPawn',out Pawn P)
	{
		if (P != none)
		{
			RegenCount += Delta;
			LastHealth = UTPawn(P).Health;
			LastShield = UTPawn(P).ShieldBeltArmor;
			if (RegenCount > 3)
			{
				Regenerate(P);
			}
		}
	}
}

Error, Bad or missing expression for: out, in Call to 'AllPawns' parameter 2

Edited by jaguar, 24 April 2008 - 01:00 PM.


#27 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 24 April 2008 - 01:25 PM

jaguar take a look at Mutator Week light.
You will see how an iterator works:
basically, you need to declare a local field that will become your iterator. This field will have the reference on each instance of the class you mentionned in the first parameter at each loop.
here is your code modified

function Tick(float Delta)
{
	Local UTPawn P;
	 foreach WorldInfo.AllPawns(class'UTPawn', P)
	{
		if (P != none)
		{
			RegenCount += Delta;
			LastHealth = UTPawn(P).Health;
			LastShield = UTPawn(P).ShieldBeltArmor;
			if (RegenCount > 3)
			{
				Regenerate(P);
			}
		}
	}
}

Do you really need tick method? as it is called every 0.05s

#28 jaguar

jaguar
  • Members
  • 19 posts

Posted 24 April 2008 - 01:36 PM

UTPawn(P) is unnecessary but otherwise works, thanks
Now looking at getting event takedamage to work

#29 jaguar

jaguar
  • Members
  • 19 posts

Posted 24 April 2008 - 09:16 PM

Uploaded to the SVN, anybody want to play it, feel free.
There is one known problem, I couldn't get an array to accept engine.gameinfo.maxplayers as its length, so limited to 24 until i can fix it.

Edited by jaguar, 24 April 2008 - 09:36 PM.


#30 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 25 April 2008 - 06:52 AM

worldInfo.GRI.PRIArray.length ??

#31 jaguar

jaguar
  • Members
  • 19 posts

Posted 25 April 2008 - 12:57 PM

Well, my mutator works :p
From here i could publish, add a keybind to change armour mode (crysis style) or just reverse the damage function so the less armour you had the more damage you'd do. Can't decide which to try.

worldInfo.GRI.PRIArray.length doesn't compile, my guess is it doesn't exist when the mutator is called. Anybody know how to fix that?

Edited by jaguar, 25 April 2008 - 01:43 PM.


#32 xiongmao

xiongmao
  • Members
  • 175 posts
  • Location:Paris

Posted 26 April 2008 - 09:44 PM

Hi all, got my mutator uploaded on SVN.
It's called UnrealHeroes, it's based on the known serie. At Each kill, a power is given to each player which is kept to death.
Available powers:
- fast (increase velocity by 5)
- damage (increase damageScaling by 2)
- fly (player is flying)

This is a first step, I'd like to implement the following power if I have time
- regenerate
- steal other power
- change weapon

This time, I make a better usage of interface (for luke :))




1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users