Hey,
sorry for the rather late reply, I hope you're still around:
I did a quick test in the Editor, added a treasure to Summons_Earth_Spider, summoned it with a scroll and killed it. The engine indeed doesn't seem to generate treasure for skill-summoned characters, nothing was dropped.
I can think of two solutions (the first being the viable one, the second only for 'theory'):
1. We spawn a container from a script when the summon dies. For this, an item template for this container must be created and the appropriate 'inventory' (= treasure table name) must be added to this template. A pouch-like item, as used in the script example below, might be a good base for such a treasure container template. We need a container to generate the treasure (and can't spawn the treasure directly), because scripts aren't able to level-scale items and apply modifiers to it.
The script code could look like this:
EVENT Spawn_Summon_Treasure
VARS
CHARACTER:_char
CHARACTER:_killer
CHARACTERTEMPLATE:_temp
FLOAT3:_pos
ITEM:_item
ON
OnDie(_char,_,_killer,_)
ACTIONS
IF "c1&c2&c3&c4&!c5&!c6"
IsEqual(__Me, Player1_dac1443f-a866-4ab3-b240-e705c0b20ec5) //Player 1 will be our secret treasure spawner
CharacterGetTemplate(_char,_temp)
IsEqual(_temp,12c5957b-4e9c-4482-a1c4-bf20aae39d43) //the summon's template GUID, taken from the template you posted
GetPosition(_char,_pos)
CharacterIsPlayer(_killer) //only kills by npcs will spawn the treasure, as you requested
IsEqual(_killer,null) //only when the summon dies an unnatural death (by a character) the item will spawn
THEN
Add(_pos,{1;0;1}) //a small offset for the spawn position to avoid clipping with the corpse
IF "c1"
FindValidPosition(_pos,5,_char)
THEN
SpawnItem(LOOT_Pouch_A_244deb74-a42b-44b3-94b1-a7fe3620b98e,_pos,_item) //the template must be replaced with your custom treasure container template
PlayEffectAt(_item,"FX_Env_Sparkles_A")
ENDIF
ENDIF
The code must be added to the EVENTS section of a player script. The 'Player.charScript', the Samaritan 'Player_AI.charScript' or any other player script of XC_Encounters can be used for this. Our spawn mechanic will be handled by Player 1, he's the character to observe the summon's death and to spawn the treasure.
2. Creating a pseudo-skill instead of a proper summon skill and summon the character from a player script instead (this skill is for player characters only, I suppose?), something like:
EVENT Fake_Summon
VARS
FLOAT:_stat
INT:_level
ON
OnSkillCast(__Me,[Skill Name]) //side note: first parameter can only be __Me, although the API suggests otherwise
ACTIONS
IF "c1"
CharacterGetStat(_stat,__Me,Level) //get summoner level
THEN
Cast(_level,_stat) //cast float to integer
SpawnCharacter(_,12c5957b-4e9c-4482-a1c4-bf20aae39d43,__Me,1,1,__Me,_level)
ENDIF
//Param 1: character variable to store the resulting character (here left empty with an underscore)
//Param 2: Character Template of the character to spawn
//Param 3: Position to summon the character at (here it's just the position of the summoner)
//Param 4: 1 = Play spawn animation, 0 = do not play spawn animation
//Param 5: 1 = is summon, 0 = is not summon
//Param 6: Owner of the Summon
//Param 7: Level of the spawned character (here the same level as the summoner)
Script-summoned characters generate treasure, so this should work.
Cons of solution 2:
- the summon exists until it's killed
- the summon isn't displayed next to the summoner's character portrait
- the summon destination cannot be taken from the skill itself but must be chosen by the script (here it's just the position of the summoner, i. e. __Me)
Tell me if this works for you and if you need further help.
