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

    • The Black Arrow

      Hope everyone has the blessing of undying motivation for "The Dark Mod 15th Anniversary Contest". Can't wait to see the many magnificent missions you all may have planned. Good luck, with an Ace!
      · 0 replies
    • Ansome

      Finally got my PC back from the shop after my SSD got corrupted a week ago and damaged my motherboard. Scary stuff, but thank goodness it happened right after two months of FM development instead of wiping all my work before I could release it. New SSD, repaired Motherboard and BIOS, and we're ready to start working on my second FM with some added version control in the cloud just to be safe!
      · 2 replies
    • Petike the Taffer  »  DeTeEff

      I've updated the articles for your FMs and your author category at the wiki. Your newer nickname (DeTeEff) now comes first, and the one in parentheses is your older nickname (Fieldmedic). Just to avoid confusing people who played your FMs years ago and remember your older nickname. I've added a wiki article for your latest FM, Who Watches the Watcher?, as part of my current updating efforts. Unless I overlooked something, you have five different FMs so far.
      · 0 replies
    • Petike the Taffer

      I've finally managed to log in to The Dark Mod Wiki. I'm back in the saddle and before the holidays start in full, I'll be adding a few new FM articles and doing other updates. Written in Stone is already done.
      · 4 replies
    • nbohr1more

      TDM 15th Anniversary Contest is now active! Please declare your participation: https://forums.thedarkmod.com/index.php?/topic/22413-the-dark-mod-15th-anniversary-contest-entry-thread/
       
      · 0 replies
×
×
  • Create New...