View Issue Details

IDProjectCategoryView StatusLast Update
0008567Multi Theft Auto : San AndreasServerpublic2014-10-09 18:18
ReporterImageAssigned Toccw 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version 
Target VersionFixed in Version1.4.1 
Summary0008567: setElementHealth does not always work for peds
Description

When you create a new ped server-side and set its health to a value (e.g. 50), it will not work correctly unless you delay the function execution. (e.g. using a timer)

Steps To Reproduce

http://pastebin.com/GWQdVepU

TagsNo tags attached.

Activities

Inspirator

2014-10-04 16:45

viewer   ~~0022137

Last edited: 2014-10-04 17:14

View 18 revisions

Could a developer take a look at this? I have had issues with setting the camera target of the ped right after it spawned. And giving weapons/ammo right after it spawned. Only a timer fixes those issues depending on the amount of seconds, 50ms may not help, 2000ms might not, but 3000ms might.

I noticed that a lot more people experience this, with in particular giving weapons and ammo. It seems that with any ped command executed right after createPed it's giving issues. Like there's some sort of delay.

For reproducing: try creating a ped and give it weapons with specific amount of ammo right after it. Then look at the ammo and check if it's the same. Do this a few times.

Not trying to hijack this thread/issue but I think it is very similar to this. It might be one issue that when fixed it could potentially fix a lot of other issues regarding peds.

Similar issue: #0004008

einheit-101

2014-10-04 18:40

reporter   ~~0022140

I tried setElementHealth on peds earlier for weak zombies, but it did not work.... Did not know that timer workaround. I can confirm this issue.

Grafu

2014-10-04 19:17

viewer   ~~0022141

Last edited: 2014-10-05 16:34

View 2 revisions

Same about createTeam. Adding players to the team right after creating it doesn't work, tho a timer of 50ms solves the problem.

Woovie

2014-10-04 21:54

manager   ~~0022144

If you're using spawnPlayer, which you should, it has a team variable.

Grafu

2014-10-05 16:40

viewer   ~~0022147

How is spawnPlayer even related?

createTeam + setPlayerTeam (and spawnPlayer wouldn't be a good choice, because the script responsible for the teams running in a separate script from gamemode. Also, the team creation and applying isn't based on player spawn.)

ccw

2014-10-07 03:24

administrator   ~~0022148

Please make a new issue for createTeam + setPlayerTeam with steps to reproduce

ccw

2014-10-08 08:21

administrator   ~~0022152

Fixed in https://code.google.com/p/mtasa-blue/source/detail?r=6880

Issue History

Date Modified Username Field Change