Gothic Online Forums
Give- / Removeitems on Focus - Printable Version

+- Gothic Online Forums (https://archive.gothic-online.com)
+-- Forum: Scripting (English) (https://archive.gothic-online.com/forum-11.html)
+--- Forum: Scripting Help (https://archive.gothic-online.com/forum-12.html)
+--- Thread: Give- / Removeitems on Focus (/thread-2753.html)



Give- / Removeitems on Focus - ItschiAtschiUtschi - 10.06.2020

Hey .. G2O forum! Tongue And Dear Scripters!

Is it possible to put "Giveitem" or "Removeitem" on the PlayerFocus? And not on an entered ID?
If so? How?



RE: Give- / Removeitems on Focus - Quarchodron - 10.06.2020

u have to insert id in front of function like giveItem(id, ..) id is id of player that u lookin at. No matter is it focus or not. Whatever to create such function u can use getPlayerFocus. Also to not add parameter id is not make sense because every player have seperate focus. (I'm talking about server side / DONT do that on client side becouse of security).


RE: Give- / Removeitems on Focus - ItschiAtschiUtschi - 10.06.2020

I want to create a traiding system to give something to someone in front of me (Focus)


RE: Give- / Removeitems on Focus - Patrix - 10.06.2020

There is a function called "getPlayerFocus" on server-side, look inside Functions.txt and you'll find it's 'declaration'.
The function has one parameter, which is the id of player whose 'focus id' you want to get.
For example, if i am player (id 0), and you are player (id 1), and i focused you, then, when you call this function like this:
Code:
local focus = getPlayerFocus(0)
print(focus) // this will print 1

Of course, the above code is only a dummy example.