Go Back   Savage 2: A Tortured Soul Forum > Savage 2 Modding > Documentation

Notices

Documentation Post useful tutorials and other informative material.

Reply
 
Thread Tools Display Modes
Old 05-11-2010, 02:01 PM   #1
FR0D0

FR0D0's Avatar
 
Join Date: Mar 2009
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default Give Item

Can someone tell me, how to use Giveitem?


GiveClientItem Player Gun_Repeater - Works for me, but it add wepion to first free place in backpack. I want to add skill (just like in Survival mod).

If I make:
GiveClientItem Player 2 Gun_Repeater - Don't work at all
GiveItem Player Gun_Repeater - Don't work to :/
FR0D0 is offline   Reply With Quote
Old 05-11-2010, 02:41 PM   #2
Rozsd_s

Rozsd_s's Avatar
 
Join Date: Dec 2008
Posts: 672
Thanks: 3
Thanked 9 Times in 8 Posts
Default

player_marksman_inventory2 "gun_repeater"
__________________
Known as:
Riff - CYOA II
Scorch - CYOA III
Thog - III.5
Spock - CYOA IV
Strid - CYOA V
Scorch - CYOA VI

Rozsd_s is offline   Reply With Quote
Old 05-11-2010, 02:50 PM   #3
eaxs

eaxs's Avatar
 
Join Date: May 2008
Location: Germany
Posts: 2,611
Thanks: 9
Thanked 40 Times in 24 Posts
Default

Quote:
GiveItem <entity_index> <slot> <item_name>
"GiveItem" requires the entity index, not the client name or id. Maybe "GiveClientItem" accepts the name or id. I dont know.

<item_name> must be the "technical" name of the item you want to give. For that you'll have too look at the game_settings.cfg.

The inventory slot well...should obvious. I "think" the backpack slot starts with "10", and everything below lands in your skill bar.

Edit:

It may happen that the command does not work properly if the slot is already in use. Therefore you should remove any potential item 1st, like this:
Quote:
TakeItem <entity_index> <slot>
Sleep 500
Note that the "Sleep" command afterwards is necessary because the k2 engine seems to be "slow" or something to register the changes.

And a second note: You can also use both commands on "pet" npcs!

Last edited by eaxs; 05-12-2010 at 01:05 AM.
eaxs is offline   Reply With Quote
Old 05-11-2010, 07:01 PM   #4
FR0D0

FR0D0's Avatar
 
Join Date: Mar 2009
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Quote:
Originally Posted by Rozsd_s View Post
player_marksman_inventory2 "gun_repeater"
I want give wepion to one player not to all.


TakeItem #GetScriptParam(index)# 2 - Works perfect!
Sleep 500
But:
GiveItem #GetScriptParam(index)# Gun_Repeater 2 - Dont work at all !
GiveItem command don't work for me, I tried everything

The only command which works and give items is GiveClientItem, but I can't set number of slot..

Can someone explain me how they did it in survival mod?
FR0D0 is offline   Reply With Quote
Old 05-11-2010, 08:36 PM   #5
Pidgeoni

Pidgeoni's Avatar
 
Join Date: Jul 2009
Posts: 1,734
Thanks: 185
Thanked 317 Times in 190 Posts
Default

Good evening.

I've used the giveitem command myself quite successfully. The following is fully functional code, taken from the "spawn" event of ac mod:
___________________________________________
Set _client_id #GetScriptParam(clientid)#
Set _player #GetIndexFromClientNum(|#_client_id|#)#
GiveItem #_player# 9 Spell_SummonImp
------------------------------------------------------------

It looks quite ugly like this :P
but as you can see the important thing is this one:
_________________________
GiveItem <player> <slot> <item>
-----------------------------------

In a local game you could easily type this one in the console to make your testings:
_____________________________________________
GiveItem #GetIndexFromClientNum(0)# 9 Gun_Repeater
---------------------------------------------------------------

as your id number would be 0. Should work in warmup as well.

Hope this helps

Extra stuff:
-You can give spells in item slots that way (10-15)...it is quite buggy though. That means random numbers showing near the spell's icon. Try it!
-You could use slots>15 if you want, but you will have to mod the ui to make it really work.

EDIT!!!!!!!!!! (random revelation)

Tell us in which event you are calling the command!!!!!!!!!!!!!!!!
I had trouble calling the GiveExp command in the changeunit (i think, maybe another one) event because the player's index changed during the event!!!!!! So i Had to use the GiveExperience command, that takes an id as input, which stays the same!!!!!!!!!!!!!!!!!!!

Last edited by Pidgeoni; 05-11-2010 at 08:44 PM.
Pidgeoni is offline   Reply With Quote
Old 05-11-2010, 08:39 PM   #6
eaxs

eaxs's Avatar
 
Join Date: May 2008
Location: Germany
Posts: 2,611
Thanks: 9
Thanked 40 Times in 24 Posts
Default

Quote:
Originally Posted by Pidgeoni View Post
GiveItem #_player# 9 Spell_SummonImp
VS
Quote:
GiveItem <entity_index> <item_name> <slot>
Dang...coud it be that "slot" and "item_name" arguments should switch places? I really need to look into all this scripting stuff again before I say some bullshit again
eaxs is offline   Reply With Quote
Old 05-11-2010, 08:47 PM   #7
Pidgeoni

Pidgeoni's Avatar
 
Join Date: Jul 2009
Posts: 1,734
Thanks: 185
Thanked 317 Times in 190 Posts
Default

@eaxs: see "random revelation"
you' re the teacher anyway
Pidgeoni is offline   Reply With Quote
Old 05-11-2010, 08:51 PM   #8
eaxs

eaxs's Avatar
 
Join Date: May 2008
Location: Germany
Posts: 2,611
Thanks: 9
Thanked 40 Times in 24 Posts
Default

Quote:
Originally Posted by Pidgeoni View Post
@eaxs: see "random revelation"
you' re the teacher anyway
It's more like this:

eaxs is offline   Reply With Quote
Old 05-11-2010, 10:58 PM   #9
FR0D0

FR0D0's Avatar
 
Join Date: Mar 2009
Posts: 106
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thx Pidgeoni works Briliant!
It's not event I just making map with quests (got to much time now)
FR0D0 is offline   Reply With Quote
Old 05-12-2010, 01:06 AM   #10
eaxs

eaxs's Avatar
 
Join Date: May 2008
Location: Germany
Posts: 2,611
Thanks: 9
Thanked 40 Times in 24 Posts
Default

ok, updated my post with the correct argument order
eaxs is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 11:45 AM.