/me trying to code some crap...

  • 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.

tdw-socke

Member
Nov 21, 2003
994
0
16
ok, i managed the mines, i use the standard mines for the projectle, they work very good. they only attack enemies as long as i'm alive. after respawning, they attack me too, but a few seconds after i died, all mines explode. I can't use the standard mines with the warhead, as they woud explode, as soon as they touch the ground, so i extended it and removed a single circumstance for exploding, now it works very well, only probleme is, they attack everyone, which is ok, but they don't die with me, they stay until someone gets a victom, which could be ok too, but it wasn't my idea to do so ;)

i printed some words on the HUD, and there i have a question:
i thought it would be possible to extend the original hud-function, put the word-drawing in it and add a Super.DrawHUD(Canvas Canvas); to it, but that didn't work, so i had to copy the whole function... couldn't that be easier?

last thing i want to do with this first-work thing is, giving it an own ini to define the number of mines it should spawn...

i have no idea, if this thing will work online, i hope you'll help me with that point ;)
 

tdw-socke

Member
Nov 21, 2003
994
0
16
hmmm, regarding the ini-file, i'm stuck...

i tried config, globalconfig, config with no name. All in the classes where the variables are needed, and also in the main and the mutator-class...

how on earth does this work with more than one class?
 

ProAsm

Active Member
Mar 20, 2002
2,108
0
36
www.proasm.com
Ini Files:

The name of the ini file will be whatever your Foldername is which the original is AltRedeemer2 - change that to what you like but you must rename ALL the AltRedeemer2 words in ALL classes.

Now in the class you want to add variables - for instance MyRedeemerClass:

MyRedeemerClass extends AltRDWarhead config(AltRedeemer2);

var config bool bUseMyMod;
var config int Whatever;

In the ini AltRedeemer2.ini file you will now see the heading:

[AltRedeemer2.MyRedeemerClass]
bUseMyMod=False
Whatever=0

If you wanted your class to save its variables in the UT2004.ini file:

MyRedeemerClass extends AltRDWarhead config(System);

If its a Clientclass like your HUD:

MyRedeemerHUD extends HUDBase config(User);

That will save your variables in the players User.ini file
 

tdw-socke

Member
Nov 21, 2003
994
0
16
Yes, that's what i read from the wiki too, but my probleme is, i have two classes, needing config variables. i thought, i had to make 2 parts in the config file... It looks like this:

Code:
class SpideemerProjectile extends RedeemerProjectile config(Primary);

var config int MinesPrimary;

and

Code:
class SpideemerWarhead extends RedeemerWarhead config(Secondary);

var config int MinesSecondary1;
var config int MinesSecondary2;

and the fie Spideemer1.ini looks like this:

Code:
[Spideemer1.Primary]
MinesPrimary=5

[Spideemer1.Secondary]
MinesSecondary1=20
MinesSecondary2=100

but no way :(

i tried several other things, but all with no effect.

the other thing is the writing on the hud, is there no way to super the original hud-function and add the writing?

I attached the code, it's crappy, but maybe, you find a way through it ;)
 

Attachments

  • Spideemer1.zip
    6.4 KB · Views: 2

ProAsm

Active Member
Mar 20, 2002
2,108
0
36
www.proasm.com
Regarding the ini file, the name of your Folder will always be the first part and the Classname the second part.
[Spideemer1.ClassName]

So if you want the second part to be Primary then you must change your Classname:
class Primary extends RedeemerProjectile config(Spideemer1);
and
class Secondary extends RedeemerWarhead config(Spideemer1);

The config(Whatever) can only be 3 things:
1. Spideemer1 which is your mod name or the name of your Folder that holds all the classes.
2. System which is the UT2004.ini file
3. User which is the clients User.ini file or if its serverside the servers User.ini

Anything else is just garbage.

Regarding writing to the Hud.
This is not possible from a Mutator and only from a Game.
There are ways to hack it from a Mutator and thats what I do in UT2Vote for the logo and logon info.

What you can try is the following which might work:
Create yourself a SpideemerHud class which extends HudBDeathMatch and do what you want in there, normally in the DrawHudPassA.

Then in the Mutator class:

function PreBeginPlay()
{
DeathMatch(Level.Game).HUDType="Spideemer1.SpideemerHud";
}

A note on DeathMatch.

Becoming a coder you need to know how the Unreal Engine functions and there are a few basics you need to learn.

The DeathMatch Game Class.

DeathMatch is the PRIMARY Game, there is no other game in the Unreal Engine, everything hinges around a DeathMatch Game.
CTF, ONS, everything is in the end a DeathMatchGame.
CTF is 2 DeathMatch games and so on.
If you trace the Parent classes of any game (Whatever extends) it will always end up with DeathMatch.

It is for this reason, regardless what game the players play, if you want the same change to happen in all Games, you go directly to DeathMatch(Level.Game) or if you only want it to happen in the current game, then you would use just Level.Game
 

tdw-socke

Member
Nov 21, 2003
994
0
16
ProAsm said:
The config(Whatever) can only be 3 things:
1. Spideemer1 which is your mod name or the name of your Folder that holds all the classes.
2. System which is the UT2004.ini file
3. User which is the clients User.ini file or if its serverside the servers User.ini

Anything else is just garbage.
That was exactly the hint i needed, thanks a lot :)

regarding the hud, the redeemer-hud extends the deathmatch-hud, and the spideemer hud extends the redeemer-hud. That works at least offline.
My "probleme" is, the spideemer-hud is nuthig else than the redeemer-hud plus the writing of one scentense. I thoght, extending the redeemer-hud, ten Super.RedeemerHUD and after that putting the writing would work, but it doesn't... I only wanted to save some space ;)

now the last thing i'm not satisfied with is the behaviour of the mines, if they get spawned by the warhead. I guess, it's because they see the warhead as the player shooting them, not the player, who shot the redeemer. And so everyone is a target for them, and they explode a few seconds after the redeemer explodes. It's not a big probleme, that the mines attack everyone, although it could be boring, but they live forever (until they attack) and that's not good.
Do you have an idea how to tell the mines, that not the redeemer but the player who shot the redeemer is their master? And if that's not possible, it should at least be possible to code a timer, which kills the mines after 3 minutes...

Thanks again for your great help :)
 

ProAsm

Active Member
Mar 20, 2002
2,108
0
36
www.proasm.com
Ok regarding Timers and destruction.

Firstly where ever you spawned your Mines you need correct the way you done it.
This is what it should look like:
Code:
var ONSMineProjectileSPI NewShell[30]; // although you declared a NewShell, you dont use it ?

	     for (i=0; i<MinesSecondary; i++)
	     {
                     rot = Rotation;
		     rot.yaw += FRand()*512000;
		     rot.pitch += FRand()*512000;
		     rot.roll += FRand()*512000;
		     NewShell[i] = Spawn( class 'ONSMineProjectileSPI',, '', HitLocation - Rand(100) * Normal(Velocity), rot*-1);
		     //log ("mine1 spawned");

	     }
Now when you come to destroy the mines that were spawned.
All classes are allowed one Timer event.
Find a place to set the Timer, possible after the top routine.

SetTimer(5, False);

Code:
event Timer()
{   
    local int i;
    
    Super.Timer(); // always call the superclass first in a timer

    for (i=0; i<30; i++)
        {
        if (NewShell[i] != None)
           {
           NewShell[i].Destroy();
           NewShell[i] = None;
           } 
        }
}
Setting Timers.

Timers can be set to any value from 0.1 to whatever.
When setting a Timer, False means once off and True means continious:
SetTimer(10, False);
That means the Timer will 'tick' in 10 seconds time and will only 'tick' once until another Timer is set.
SetTimer(0.5, True);
That means this Timer will 'tick' every half second for the duration of the game.
It now becomes obvious you cannot use True and False at the same time.
Remember to always call Super.Timer() as if you dont ytou could crash your server as all Timers are 'chained' together regardless of the class as ALL classes eventually end up at 'Actor' and if that Timer is blocked.... crash! :)

Regarding the RedeemerHUD and writing a sentence, have a look at my AltRDWarhead and see how I did the "simulated function DrawHUD(Canvas Canvas)"

Remember the Warhead class runs both Serverside and Clientside and the HUD is ONLY clientside hence it needs a 'simulated' function.
 
Last edited:

tdw-socke

Member
Nov 21, 2003
994
0
16
Very nice, thanks again :)
As you point on the newshell, i knew, i was missing something, but i didn't see the need for it. But now with the timer, ther is of course a need for it :)

One last question, to get it clear: There is no way to tell the mines, that not the redeemer but the player who shot the redeemer (warhead) is their master?
 

ProAsm

Active Member
Mar 20, 2002
2,108
0
36
www.proasm.com
To tell the mines where they were Spawned from you need to add it in the Spawn:
Code:
    NewShell[i] = Spawn( class 'ONSMineProjectileSPI',Instigator, '', HitLocation - Rand(100) * Normal(Velocity), rot*-1);
The first variable in any Spawn is the Actor which can be:
1. Self - (default if left blank) which in this case the Class Warhead.
2. Instigator - which would be the Weapon or the Player.
3. InstigatedBy - which would be the Player or the Enemy.
In your case you would need to experiment.
;)
 
Last edited:

tdw-socke

Member
Nov 21, 2003
994
0
16
hmm, how must InstigatedBy be used? Instigator doesn't work :(

regarding the timer, the mines-class already has a timer, and if i put it in the projectile or warhead, it has no effect :(

not my day ;)
 
Last edited:

tdw-socke

Member
Nov 21, 2003
994
0
16
well, if i make it

NewShell = Spawn( class 'ONSMineProjectileSPI',InstigatedBy, '', HitLocation - Rand(100) * Normal(Velocity), rot*-1);

i get a compilation-error.

the timer has no effect if i place it in the projectile- or warhead-class, but chances are, that i did it wrong :)
 

tdw-socke

Member
Nov 21, 2003
994
0
16
hmm, replacing InstigatedBy with OldPawn could work? I see the org. Warhead uses a lot of it...

to use an additional timer in the mines-class, which already has a timer, i found something in the wiki. Could that do the trick with the tick?

Code:
// two ways for a Tick-based, non-looping additional timer:
var float Timer1Time, Timer2Time;

// method 1 - count down
function SetTimer1(float Interval)
{
  Timer1Time = Interval;
}
function Timer1()
{
  // do something
}

// method 2 - target time
function SetTimer2(float Interval)
{
  Timer1Time = Level.TimeSeconds + Interval;
}
function Timer2()
{
  // do something
}

function Tick(floatDeltaTime)
{
  // method 1
  if (Timer1Time > 0) {
    Timer1Time -= DeltaTime;
    if (Timer1Time <= 0)
      Timer1();
  }

  // method 2
  if (Timer2Time > 0 && Timer2Time < Level.TimeSeconds) {
    Timer2Time = 0;
    Timer2();
  }
}
 

ProAsm

Active Member
Mar 20, 2002
2,108
0
36
www.proasm.com
mmm I'm very weary of Tick functions as it depends on what someone else has done before your class.
Sometime another Mut disables the Parent classes Tick and you are buggered.
Disable('Tick');

What I do in all my classes is in the PostBeginPlay I always set:
SetTimer(1, true);
This ticks it permanently in 1 second intervals.
I then use count downs for all the items that would normally use a False (once off)

Code:
function Timer()
{
    if (Counter1 > 0)
      {
      Counter1--;
      if (Counter1 == 0)
         {
         // Do whatever;
         }
      }

    if (Counter2 > 0)
      {
      Counter2--;
      if (Counter2 == 0)
         {
         // Do whatever;
         }
      }
}
In this way you can have as many Timeouts as you like and can still use it as a continious timer as well.
The only problem with continious (True) Timers is they must run at 1 second intervals else you screw up the timer in the Parent class.
 

tdw-socke

Member
Nov 21, 2003
994
0
16
regarding the timer, there is already a timer in the original mines-class, you said, there are not more than one timer per class allowed. So is this case an exeption?

but what worries me more is the owner of the spawned mines. If i say, it is self or instigator, the compiling works, but the mines still belong to the warhead. If i say anything else like InstigatedBy or OldPawn or InstigatedBy.OldPawn or InstigatedBy.Player (things which just came in my mind) i get a compilation error :(
 

ProAsm

Active Member
Mar 20, 2002
2,108
0
36
www.proasm.com
Each class, may it be a child class, parent class or super class, it can have its owns timer as long as you call the supertimer.
Only classes that extend Info, Object or Actor can get away with not calling Super.Timer() as they have nothing depending on them.

You can try the NewShell.SetOwner(OldPawn);
I dont know whare you got the OldPawn from, it must be something thats dedicated to some child class.
 

tdw-socke

Member
Nov 21, 2003
994
0
16
the OldPawn i got from the original redeemer-warhead. But that doesn't work. At least, it compiles with no error.

hell, there must be a way to tell the mines, that the player and not the warhead is the right instigator... :(
 

tdw-socke

Member
Nov 21, 2003
994
0
16
thanks, i'll have a look, if i find something in there, but i guess my probleme is a bit special, as normally it doesn't matter to whom the spawned projectiles belong (maybe for the scores), as they don't live very long, or destroy as soon as they hit the ground or wall. The mines are different, they can stay and wait for a victom until the player, who spawned them, dies. This works perfect, if they get spawned by the redeemer-projectile, but it doesn't work, if they get spawned by the warhead, because in that case, the warhead seems to be the owner of the mines. And as it blows up as it spawns the mines, the mines have no owner and get destroyed, as soon as they touch the ground, if they have no victim in that moment.

That's why i want to tell the mines, that not the warhead but the player, who shot the warhead is the right owner, but either i didn't find the right name for that player (i thought of instigator or oldpawn), or it's simply not possible in this case :(

But somehow the mines still know, ti whom they belong, because the kill-messages are correct...
 
Last edited: