Jump to content
The Dark Mod Forums

Doom 3 test map script Kill( ) event not working?


games-furious

Recommended Posts

I just made a test with script here from darkmod but i put $player1 and not work after $info_player_start_1 and nothing.

If possible help me. please.

 

Create the script file

If your map is called for example maps/mydir/mymap.map, you must create a text file maps/mydir/mymap.script.

 

The contents

The map script needs to contain a main function. This function is called at the very start of your map, e.g. when the map is loaded for the first time. So if you want something to happen later, you need to pause the script and then do something. Here is an example:

Edited by games-furious
Link to comment
Share on other sites

void main () {         
sys.waitFrame(); // always wait one frame before doing anything in main()
// this ensures that the init() routines have all finished

sys.wait(100); // wait 100 seconds

/* $entityName here acts upon a specific entity. Be careful, if you rename
the entity in DR, your script will break! $player1 is the player entity,
and this only works in single player mode. However, there is no multiplayer
in TDM, so we can safely use it for now: */

// put some information in the console
sys.println("Going to kill the entity " + $player1.getName() );

$player1.kill(); // kill the player
}
Link to comment
Share on other sites

TDM team has changed many things at the engine level, they perhaps also changed how the player entity is defined, but i'm not sure I don't work with TDM engine, also you could try to get the player entity instead of accessing it directly.

 

Something like this.

void main () {         
    sys.waitFrame(); // always wait one frame before doing anything in main()
                     // this ensures that the init() routines have all finished

    sys.wait(100);   // wait 100 seconds

    /* $entityName here acts upon a specific entity. Be careful, if you rename
       the entity in DR, your script will break! $player1 is the player entity,
       and this only works in single player mode. However, there is no multiplayer
       in TDM, so we can safely use it for now: */
    
    entity player_ent = sys.getEntity("player1");

    if(player_ent != $null_entity)
    {
       // put some information in the console
       sys.println("Going to kill the entity " + player_ent.getName() );

       player_ent.kill();     // kill the player
    }
    else 
    {
        sys.println("Unable to find requested entity!!");
    }
}
Link to comment
Share on other sites

I tried your code he write to console " Going to Kill the entity player1 but dont kill the player

 

like i said i use a Doom 3 editor v.1.31 and there the player is need have like info_player_start for open map

 

Strange dont work.

 

May be if possible assign value of health = 0 for player in run time may be can work?

Link to comment
Share on other sites

$player1 is the correct way to access the player.

 

You are certainly right and that was how idSoftware did it and that should be what he should ultimally use, what I said was just because for some reason that was not working for him. You can also use the "pointer" symbol $ for any entity that exist in the map.

 

But in my defence, i'm sure you know the base for all classes in the engine is idEntity including the idActor class from where the player is based so sys.getEntity should work even for the player.

 

I tried your code he write to console " Going to Kill the entity player1 but dont kill the player

 

like i said i use a Doom 3 editor v.1.31 and there the player is need have like info_player_start for open map

 

Strange dont work.

 

May be if possible assign value of health = 0 for player in run time may be can work?

The kill script function is really for idAI like monsters and stuff, so i assume it doesn't work for the player, you can kill the player with a cvar so you could try that, call the console cmd "kill" that will kill the player instantly no matter what health value he has.

 

Btw the player is one of the entities where most of its functionality is handled in c++ not by script, so some things you will be able to do only by editing the source code i'm afraid.

 

Don't know if this will work but try it.

 

sys.setcvar( "kill", "1" );

Link to comment
Share on other sites

 

You are certainly right and that was how idSoftware did it and that should be what he should ultimally use, what I said was just because for some reason that was not working for him. You can also use the "pointer" symbol $ for any entity that exist in the map.

 

But in my defence, i'm sure you know the base for all classes in the engine is idEntity including the idActor class from where the player is based so sys.getEntity should work even for the player.

 

The kill script function is really for idAI like monsters and stuff, so i assume it doesn't work for the player, you can kill the player with a cvar so you could try that, call the console cmd "kill" that will kill the player instantly no matter what health value he has.

 

Btw the player is one of the entities where most of its functionality is handled in c++ not by script, so some things you will be able to do only by editing the source code i'm afraid.

 

Don't know if this will work but try it.

 

sys.setcvar( "kill", "1" );

 

sys.setcvar make nothing

 

like i said if possible got real health o player1 i think is possible setHealth but for now got only health = 0 with player1 and in HUD appear 100 lol

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recent Status Updates

    • OrbWeaver

      Does anyone actually use the Normalise button in the Surface inspector? Even after looking at the code I'm not quite sure what it's for.
      · 4 replies
    • Ansome

      Turns out my 15th anniversary mission idea has already been done once or twice before! I've been beaten to the punch once again, but I suppose that's to be expected when there's over 170 FMs out there, eh? I'm not complaining though, I love learning new tricks and taking inspiration from past FMs. Best of luck on your own fan missions!
      · 4 replies
    • The Black Arrow

      I wanna play Doom 3, but fhDoom has much better features than dhewm3, yet fhDoom is old, outdated and probably not supported. Damn!
      Makes me think that TDM engine for Doom 3 itself would actually be perfect.
      · 6 replies
    • Petike the Taffer

      Maybe a bit of advice ? In the FM series I'm preparing, the two main characters have the given names Toby and Agnes (it's the protagonist and deuteragonist, respectively), I've been toying with the idea of giving them family names as well, since many of the FM series have named protagonists who have surnames. Toby's from a family who were usually farriers, though he eventually wound up working as a cobbler (this serves as a daylight "front" for his night time thieving). Would it make sense if the man's popularly accepted family name was Farrier ? It's an existing, though less common English surname, and it directly refers to the profession practiced by his relatives. Your suggestions ?
      · 9 replies
    • nbohr1more

      Looks like the "Reverse April Fools" releases were too well hidden. Darkfate still hasn't acknowledge all the new releases. Did you play any of the new April Fools missions?
      · 5 replies
×
×
  • Create New...