Jump to content
The Dark Mod Forums

Setting spawnargs on player


grayman

Recommended Posts

Okay, I give up.

 

Anyone know how to change spawnargs on the player at the start of a mission?

 

I'm trying to get a target_setkeyval to target "player1" with a spawnarg change, and the damned thing tells me it has no targets.

 

I think the player gets spawned after all the other entities, so it's possible that "player1" doesn't exist when other entities are creating their target lists.

 

But maybe someone's already figured it out.

 

Thanks.

 

EDIT: I'm sure I can use a script to do what I want, but I need an entity-based solution for people who don't like to use scripts.

Link to comment
Share on other sites

Everytime I have tried to change the value of a spawnarg it has never worked for me. However if what you are having is a timing issue maybe try placing a 1-2 second delay before using the target_setkeyval?

 

If the problem really does lie in the fact that the player1 entity hasn't loaded then a delay should remedy that problem.

Link to comment
Share on other sites

A delay won't help, though, because an entity's target list is set up when an entity spawns. It's actually set up a few moments after the spawn, allowing enough time for all entities to spawn, to guarantee the target list creation can find them.

 

Since the player entity might not be around when the other entities are spawned, it's not going to be there when the target_setkeyval looks for its targets to make its list.

Link to comment
Share on other sites

You can derive an entityDef from the player one and tell the game to use this one instead.

entityDef custom_player
{
 "inherit"  "atdm:player_thief"
 //apply custom spawnargs here
 "def_head" "-" //the head entity to use, if you want to change that either
}
entityDef custom_player_head
{
 "inherit" "atdm:ai_head_thief_player"
 //apply custom spawnargs here
}

On worldspawn, set the following spawnarg: "player_spawnclass" "custom_player"

 

I've never tried this, but it should work.

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

Link to comment
Share on other sites

You can derive an entityDef

 

Is the question how to set a spawnarg on the player though, or how to set one at map start time? Maybe a value that isn't wanted while the player is spawning.

 

Here's a slightly elaborate suggestion for the latter. I notice that target_changetarget waits until activation to parse it's "add" and "remove" spawnargs. So one setup could be:

  1. delay
  2. target_changetarget adds "player1" as a target of the target_setkeyval
  3. target_setkeyval sets the key on the player

Link to comment
Share on other sites

Here's a slightly elaborate suggestion for the latter. I notice that target_changetarget waits until activation to parse it's "add" and "remove" spawnargs. So one setup could be:

  1. delay
  2. target_changetarget adds "player1" as a target of the target_setkeyval
  3. target_setkeyval sets the key on the player

 

This didn't work.

 

But a slight variation did.

 

trigger_once targets a trigger_relay and a target_changetarget

trigger_relay has a 1s delay and targets a target_setkeyval

target_changetarget adds "player1" as a target of the target_setkeyval

target_setkeyval has this spawnarg: "keyval" "hair_color;blue"

 

What happens:

 

At time t:

 

Player steps into trigger_once.

trigger_once triggers trigger_relay and target_changetarget

target_changetarget adds "player1" to target_setkeyval's targets

 

At time t+1:

 

trigger_relay triggers target_setkeyval

target_setkeyval changes the "hair_color" spawnarg on the player to "blue"

 

The result is that when the player steps into the trigger_once, his hair color changes to blue. (Not that this is a real spawnarg. ;) )

 

Though the OP asks about changing player spawnargs at spawn time, this solution is general enough to be used at any time.

 

Thanks, SteveL.

Link to comment
Share on other sites

That's too drastic a solution, and how would I tell the game to use it instead?

On worldspawn, set the following spawnarg: "player_spawnclass" "custom_player"

FM's: Builder Roads, Old Habits, Old Habits Rebuild

Mapping and Scripting: Apples and Peaches

Sculptris Models and Tutorials: Obsttortes Models

My wiki articles: Obstipedia

Texture Blending in DR: DR ASE Blend Exporter

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

    • 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!
      · 0 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
    • JackFarmer

      @TheUnbeholden
      You cannot receive PMs. Could you please be so kind and check your mailbox if it is full (or maybe you switched off the function)?
      · 1 reply
×
×
  • Create New...