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

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