enthusiast
Joined: May 2017
|
Essentially it seems so complicated, I was looking at the script thinking it would be incredibly easy to have a script that checks the status and summons these dogs when the enemy dies. But I just don't understand how the scripts tie in with the abilities. WhiIe was very much able to create an ability that does what I wanted, it really feels like the way I accomplished it was very hackish. The basic usage of scripts, both behavior and story, are reaction-based. Meaning, they listens for an event, and then does something. So in this case, you could simply listen for an enemy dying, check if they have the status you applied, and then spawn the dogs at their position. Story scripts and gameScripts work in a similar way - they're always actively running (though if the story script has a parent script, that script needs to be completed (GoalCompleted;) before it will become active). Additionally, since charScripts and itemScripts are attached to objects, those objects need to be active in the world before their scripts will run. Here's an example of what the script could look like for what you want done (this would be in a gameScript): EVENT MyMod_OnDying_SpawnDogs
VARS
CHARACTER:_Target
CHARACTER:_Caster
CHARACTER:_Dog1
CHARACTER:_Dog2
CHARACTER:_Dog3
FLOAT3:_Pos
FLOAT:_LevelF
INT:_Level
FIXEDSTRING:_Faction
ON
OnCharacterStatusApplied(_Target, DYING)
ACTIONS
IF "c1&c2&c3&c4&c5"
CharacterHasStatus(_Target, MYMOD_CUSTOM_STATUS)
CharacterGetStatusSourceCharacter(_Target, MYMOD_CUSTOM_STATUS, _Caster)
GetPosition(_Target, _Pos)
CharacterGetStat(_LevelF, _Caster, Level)
GetFaction(_Faction, _Caster)
THEN
//FLOAT to INT
Cast(_Level, _LevelF)
SpawnCharacter(_Dog1, Animals_Dog_B_Black_ad8f1f47-3bb9-4d51-aadf-aed3b264530c, _Pos, 1, 0, _Caster, _Level)
SpawnCharacter(_Dog2, Animals_Dog_A_Black_e0467912-f900-48ab-b677-28d14a515846, _Pos, 1, 0, _Caster, _Level)
SpawnCharacter(_Dog3, Animals_Dog_B_RedFaction_A_41d02eb7-01aa-436e-af61-86cf2ce671f6, _Pos, 1, 0, _Caster, _Level)
SetFaction(_Dog1, _Faction)
SetFaction(_Dog2, _Faction)
SetFaction(_Dog3, _Faction)
ENDIF I tested this by using HASTED as my status to check. The result: ![[Linked Image]](https://thumbs.gfycat.com/CraftyMadeupHarvestmen-size_restricted.gif) A few things to note: The parameters for SpawnCharacter: SpawnCharacter(OUT CHARACTER:result, CHARACTERTEMPLATE:rootTemplate, GAMEOBJECT|FLOAT3:position, INT:playSpawn, [INT:isSummon=0, CHARACTER:summonOwner=null, INT:overrideLevel=-1]) IsSummon will tie into the summon system, and use the character's max summon stat. When set to 1, I only had 1 dog spawn. The SetFaction calls are optional of course, as is getting the source of the status, for making the dog spawn at status source character's level. The dogs will default to the level in their stats if you don't provide a level override, or if they're not a summon. You could spruce up the dog-spawning part by playing some effects at the dog's positions, using CharacterPlayEffect, or PlayEffectAt: //playSpawn is set to 0 here, since we're using smoke effects to hide them "popping" in.
SpawnCharacter(_Dog1, Animals_Dog_B_Black_ad8f1f47-3bb9-4d51-aadf-aed3b264530c, _Pos, 0, 0, _Caster, _Level)
SpawnCharacter(_Dog2, Animals_Dog_A_Black_e0467912-f900-48ab-b677-28d14a515846, _Pos, 0, 0, _Caster, _Level)
SpawnCharacter(_Dog3, Animals_Dog_B_RedFaction_A_41d02eb7-01aa-436e-af61-86cf2ce671f6, _Pos, 0, 0, _Caster, _Level)
SetFaction(_Dog1, _Faction)
SetFaction(_Dog2, _Faction)
SetFaction(_Dog3, _Faction)
SetTag(_Dog1, "MyMod_DogStatusSummon")
SetTag(_Dog2, "MyMod_DogStatusSummon")
SetTag(_Dog3, "MyMod_DogStatusSummon")
CharacterApplyStatus(_Dog1, NULL, 0)
CharacterApplyStatus(_Dog2, NULL, 0)
CharacterApplyStatus(_Dog3, NULL, 0)
ENDIF
EVENT MyMod_PlayDogSpawnEffect
VARS
CHARACTER:_Dog
ON
OnCharacterStatusRemoved(_Dog, NULL)
ACTIONS
IF "c1"
IsTagged(_Dog, "MyMod_DogStatusSummon")
THEN
PlayEffectAt(_Dog, "RS3_FX_GP_ScriptedEvent_Ambushers_Smoke_01")
ENDIF Here I'm applying a status called "NULL" for 0 turns, purely to delay the effects long enough for the position to be where they eventually end up, since the dogs spawn around _Pos if that position is blocked (which it will be). If I don't delay the effects, they end up playing at position x0 y0 z0, since that's where the dogs initially spawn in until the engine moves them to the desired position. Here's the result: ![[Linked Image]](https://thumbs.gfycat.com/SpectacularDeafeningGrub-size_restricted.gif)
|