Jump to content
The Dark Mod Forums

Setting spawnargs on player


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 post
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 post
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 post
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 post
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 post
Share on other sites

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

 

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

Link to post
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 post
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 post
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.

×
×
  • Create New...