Need help?
Create a topic in the appropriate section
Don't write everything in the chat!Take a look at the marketplace
There you can buy
everything related to game serversDon't want a ban?
Please read our rules
Don't disturb the order!Sell or buy?
Use services of the guarantor
We will make your deal safe
- 0
-
Our picks
Всем доброго времени суток. Есть мод на промокоды, который позволяет спавнить предметы при вводе определенного промокода. Однако вещь появляется под персонажем. Как я понимаю процесс спавна описан в этом методе:
private static ItemBase CreateItem( string class_name, bool on_ground, PlayerBase player ) { ItemBase item; if ( on_ground ) { item = ItemBase.Cast( GetGame().CreateObject( class_name, player.GetPosition() ) ); } else { item = ItemBase.Cast( player.GetInventory().CreateInInventory( class_name ) ); } if ( item != NULL ) { item.SetQuantity(item.GetQuantityMax()); } return item; }
Я попытался немного изменить код, чтобы вещи появлялись по прицелу персонажа, но всё равно ничего не получилось - вещи так и спавнятся по координатам персонажа.
private static ItemBase CreateItem( string class_name, bool on_crosshair, PlayerBase player ) { float distance = vector.Distance( pos_player, hitPos ); float dist = vector.Distance( player.GetPosition(), player.GetAimPosition() ) Print(dist); Print(player.GetAimPosition()); vector position = player.GetPosition() + ( player.GetAimPosition() * distance ); Print(position) ItemBase item; if ( on_crosshair ) { item = ItemBase.Cast( GetGame().CreateObject( class_name, position )); vector pos = item.GetPosition(); Print(pos); } else { item = ItemBase.Cast( player.GetInventory().CreateInInventory( class_name ) ); } if ( item != NULL ) { item.SetQuantity(item.GetQuantityMax()); } return item; }
При дебаге, в логи выводились огромные значения vector dist, однако персонаж смотрел в пол в нескольких метрах от себя
Может кто подсказать в какую сторону копать?
Share this post
Link to post
Share on other sites