# Respawn(重生)创建的函数

## Useful functions and variables from respawn

Throughout this guide many functions and values made by respawn will be referenced in examples, in the interest of not confusing people those functions, and other frequently used ones, will be listed and explained here for a full list (although without explaination) go here <https://github.com/ScureX/Titanfall2-ModdingDocumentation/blob/main/AllMethodsClean.md>

### GetplayerArray()

Returns and array of entities representing each player, not that it does not just return return the playername but the actual entities, as such all values associated with players can be called like his

### *array*.len()

Returns the number of objects in an array, thats about it.

### GameTime\_TimeLeftSeconds()

returns the remaining game time

### weapon.GetWeaponClassName

returns the name of a weapon entity

## player.functions

This section contains many functiosn that can be applied to the player entity

### player.GetMainWeapons()

returns a list of all weapons equipped by that player. this is a list of entities

### player.GetOffHandWeapons()

Returns a list of all offhand weapons (grenades, boosts, abilities). this is a list of entities

### player.TakeWeaponNow( weaponname )

removes weapon of that name, best used with a foreach using the previous functions

### player.GiveWeapon( Weaponname, mods)

gives the player a weapon, the mods field must be empty or a list of strings \["mod","mod2"]


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://r2northstar.gitbook.io/r2northstar-wiki/chinese/modding-and-development/getting-started/what-is-squirrel/respawns-functions.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
