my writer keeps kicking me errors

  • Two Factor Authentication is now available on BeyondUnreal Forums. To configure it, visit your Profile and look for the "Two Step Verification" option on the left side. We can send codes via email (may be slower) or you can set up any TOTP Authenticator app on your phone (Authy, Google Authenticator, etc) to deliver codes. It is highly recommended that you configure this to keep your account safe.

The_Grimmace

New Member
Mar 10, 2005
2
0
0
I'm fairly new to the whole coding thing. My code that I have written is based on one that I found somewhere, allowing players to cast spells in UT. However, my writer keeps kicking me errors. Mayhap one of you fine people can help me. Here is a copy of my codes:

Code:
//==================================================================================================
// Spell  -- Version 1.0
//==================================================================================================

class Spell expands Actor;


var()	Float		DurationSeconds;
var()	class	CastingEffect;
var()	Sound		CastingSound;
var			Int			DurationCounter;


function Spawned()			
{
	if (CastingEffect != None)
	Spawn(CastingEffect, PlayerPawn(Owner),,PlayerPawn(Owner).Location, PlayerPawn(Owner).Rotation);



	if (CastingSound != None)
		PlaySound(CastingSound);


	StartSpell();

	if (DurationSeconds > 0.0) SetTimer(1.0, True);
	else Destroy();
}


function Timer()
{	
	DurationCounter++;
	if (DurationCounter >= DurationSeconds) Destroy(); 
}


function Destroyed()
{
	EndSpell();
	if (DurationSeconds != 0.0) PlaySound(Sound'Teleport2'); 
}



function StartSpell()
{


}

function EndSpell()
{


}


defaultproperties
{
     CastingEffect=Class'UnrealShare.ParticleBurst'
     CastingSound=Sound'UnrealShare.Nali.pray1n'
     bHidden=True
     DrawType=DT_None
}

//=============================================================================================
Code:
//=============================================================================================
// Bound. This spell allows the player to jump very high for 20 seconds.
//=============================================================================================

class Bound expands Spell;


function StartSpell()
{
	PlayerPawn(Owner).JumpZ = Pawn(Owner).Default.JumpZ * 3;
}

function EndSpell()
{
	PlayerPawn(Owner).JumpZ = Pawn(Owner).Default.JumpZ * Level.Game.PlayerJumpZScaling();
}


defaultproperties
{
     DurationSeconds=20.000000
     CastingSound=Sound'UnrealShare.Nali.fear1n'
}

//============================================================================================

Is there anything I am doing wrong? Please let me know. Thanx.
 
Last edited by a moderator:

Bonehed316

New Member
Oct 15, 2001
208
0
0
41
Florida
Visit site
Spawned()

If I were you, I would use the DurationSeconds as the first timer arguement. If you need it to change every second, you should probably override that in a subclass. Less work = gooder.

Also, you dont have to cast Owner to PlayerPawn since all actors have location and rotation, and Owner is an actor.

Otherwise, what is the problem? PlayerPawn doesnt exist in UT2004, so hopefully you're writing this for UT99.
 
Last edited:

Mychaeel

New Member
[SAS]Solid Snake said:
What *is* your exact problem? Also use the code indentations.
I've added those
Code:
 tags, and, even though it's admittedly not much of an improvement, replaced the subject by something less generic.  The_Grimmace, please:[list][*]Use [code] tags for posting code samples.  That's asked for in a sticky thread at the top of the Coding forum's thread list.  You should have seen it before you created your posting.
[*]We know you're looking for "help"; virtually anybody is.  When we see a new thread, we want to know at once [i]what[/i] its poster is looking for help with.  We want to make an [i]informed[/i] decision whether to open a thread or not.[/list]

Well, back on topic.

I [i]guess[/i] this is what's supposed to happen:[list][*]Player enters "summon Bound" at the console.
[*]Spell becomes effective for a while, then ends.[/list]It's an elegant concept, but it has two flaws:[list=1][*]It won't work online since "summon" is disabled online (since it allows cheating).
[*]It hinges on the assumption that actors spawned via "summon" are owned by the player who summoned them.  As far as I know, that's not the case.[/list]