Ӄhrizby Posted December 24, 2011 Share Posted December 24, 2011 Hello all, I was wondering if anybody with more scripting skills than me (Which wouldn't be hard) could help me figure out a problem I have, that I can't seem to find anything on. Is there any way to make a script that when fired, an enemy stops what they're doing, including attacking, but is still attackable by you? I don't want to just stun them or anything, and the factions make them unattackable. Thanks! Link to comment Share on other sites More sharing options...
JCarter426 Posted December 24, 2011 Share Posted December 24, 2011 I suggest you see see if there is already a faction that does such a thing. These are the ones from K1: int INVALID_STANDARD_FACTION = -1; int STANDARD_FACTION_HOSTILE_1 = 1; int STANDARD_FACTION_FRIENDLY_1 = 2; int STANDARD_FACTION_HOSTILE_2 = 3; int STANDARD_FACTION_FRIENDLY_2 = 4; int STANDARD_FACTION_NEUTRAL = 5; int STANDARD_FACTION_INSANE = 6; int STANDARD_FACTION_PTAT_TUSKAN = 7; int STANDARD_FACTION_GLB_XOR = 8; int STANDARD_FACTION_SURRENDER_1 = 9; int STANDARD_FACTION_SURRENDER_2 = 10; int STANDARD_FACTION_PREDATOR = 11; int STANDARD_FACTION_PREY = 12; int STANDARD_FACTION_TRAP = 13; int STANDARD_FACTION_ENDAR_SPIRE = 14; int STANDARD_FACTION_RANCOR = 15; int STANDARD_FACTION_GIZKA_1 = 16; int STANDARD_FACTION_GIZKA_2 = 17; And these are added in K2: int STANDARD_FACTION_SELF_LOATHING = 21; int STANDARD_FACTION_ONE_ON_ONE = 22; int STANDARD_FACTION_PARTYPUPPET = 23; Hostile, friendly, and neutral are the ones already used, so forget them. Predator and prey only attack each other and can only be attacked by each other. I think insane attacks anything. The puppet faction is the opposite of what you want, I think. The Sand People and Xor ones probably won't do either. I'm pretty sure trap is used for the mines, so that would be silly. So that still leaves a few options. I'd start with surrender first... judging by the name alone. So you'd just need to change the faction like so: ChangeToStandardFaction(oObject, 9); But if none of those work... I'm sure there are other possibilities. You could give them a weapon that does no damage and has no attack animations, for example. That's just off the top of my head. Anyway, good luck. Link to comment Share on other sites More sharing options...
Ӄhrizby Posted December 24, 2011 Author Share Posted December 24, 2011 I thought the same thing and tried them all, none seem to work (For K1, btw). Actually, that's a good idea about the no damage weapon, I might try that. However, I got this far; I got an npc to do what I want with the ClearAllEffects, ClearAllActions, and CancelCombat functions, as long as I cancel combat myself in the game. If I attack them again, they go back into combat mode. I was thinking of disabling the onattack script but idk if that's possible or not. Also, I set the 'SetPlayerRestrictMode' to true and it did exactly the opposite of my goal, he could attack me but I couldn't attack him, maybe I could turn that around somehow? Thanks for the help. Link to comment Share on other sites More sharing options...
JCarter426 Posted December 24, 2011 Share Posted December 24, 2011 Hmm... make a separate script them to cancel combat. And in that script, have it execute itself. And then execute that script in the heartbeat script. And that should do it... I think. Link to comment Share on other sites More sharing options...
Ӄhrizby Posted December 24, 2011 Author Share Posted December 24, 2011 Hmm... make a separate script them to cancel combat. And in that script, have it execute itself. And then execute that script in the heartbeat script. And that should do it... I think. I didn't use the heartbeat, but that gave me the idea, I just repeated the same functions again and again with a second more delay in each, that way the effect could go away in about ten seconds, which is even more ideal than having the effect permanent. Thanks so much! Actually, this enabled me to make an entirely new on-hit property! Link to comment Share on other sites More sharing options...
JCarter426 Posted December 26, 2011 Share Posted December 26, 2011 I know you've got it working already, but I realized I was being silly and forgetting something before and I figured you ought to know all your options. It is possible to create new factions. So you could still use the change faction function. However, there are two reasons I can think of not to do it. 1.) You'd have to do some extra scripting to make sure each enemy changes back to the correct faction when the effect is over. 2.) It's always preferable not to use 2DA files. Additionally, you could use the damaged and possibly even attacked script rather than heartbeat, if there are any issues or compatibility problems that arise. Anyway, if you run into any problems, there are some other options. And remember, failure is always an option. Link to comment Share on other sites More sharing options...
Ӄhrizby Posted December 27, 2011 Author Share Posted December 27, 2011 I know you've got it working already, but I realized I was being silly and forgetting something before and I figured you ought to know all your options. It is possible to create new factions. So you could still use the change faction function. However, there are two reasons I can think of not to do it. 1.) You'd have to do some extra scripting to make sure each enemy changes back to the correct faction when the effect is over. 2.) It's always preferable not to use 2DA files. Additionally, you could use the damaged and possibly even attacked script rather than heartbeat, if there are any issues or compatibility problems that arise. Anyway, if you run into any problems, there are some other options. And remember, failure is always an option. Alright, thanks for the info. If I did make a new faction, is there really a way to change who can attack who and all? I'll have to look into that. As for the other scripts, I think heartbeat is necessary, because I'm linking the effect to being stunned, and there's no 'onstun' script or anything that I could find, so basically the heartbeat is just constantly checking whether or not you're stunned. Failure might be an option, but not one I'll use Link to comment Share on other sites More sharing options...
JCarter426 Posted December 27, 2011 Share Posted December 27, 2011 There's a file, reupute.2da, with all the faction data. It tells the game how each faction feels about the other factions, and how they feel about it. So, for the remote, all of them view him as neutral or friendly, while his views are identical to the party, meaning he will still attack enemies, but he has no enemies of his own that will attack him. You know, because he's such a friendly guy. I've never added a new one myself, but it wouldn't be that difficult since it's just a 2DA (only tricky bit is you need another row and column). I'm pretty sure other people have done it successfully, too. But if you're attaching it to stun, then yes, scripting it all sounds like the easiest route. I've been looking around the 2DA files, though, and I'm starting to think adding new on hit effects might be possible. I might take a crack at it once I'm done with my current project. Link to comment Share on other sites More sharing options...
Ӄhrizby Posted December 28, 2011 Author Share Posted December 28, 2011 There's a file, reupute.2da, with all the faction data. It tells the game how each faction feels about the other factions, and how they feel about it. So, for the remote, all of them view him as neutral or friendly, while his views are identical to the party, meaning he will still attack enemies, but he has no enemies of his own that will attack him. You know, because he's such a friendly guy. I've never added a new one myself, but it wouldn't be that difficult since it's just a 2DA (only tricky bit is you need another row and column). I'm pretty sure other people have done it successfully, too. But if you're attaching it to stun, then yes, scripting it all sounds like the easiest route. I've been looking around the 2DA files, though, and I'm starting to think adding new on hit effects might be possible. I might take a crack at it once I'm done with my current project. Oh, that would probably actually make the effect smoother, instead of cancelling combat every second or so. I'll take a look. Oh really? If it is that'd be awesome, be sure to let me know what you find if you do. EDIT: Alright, so I looked at the 2DA and made both a row and column, the problem is that 'Player' only has a row, not a column, so I'm thinking you can only assign reciprocal feelings between the PC and any other faction. I didn't try adding a Player column but I have a feeling it's not meant to work that way. Link to comment Share on other sites More sharing options...
JCarter426 Posted December 28, 2011 Share Posted December 28, 2011 Ah... well, it's possible there isn't a column because it's not necessary, since there's no faction with nonreciprocal feelings with the player. Obviously it is possible with other factions, so it couldn't hurt to try it. As for the on hit effects... well, they wouldn't be true on hit effects. It would be very similar to new feats; they wouldn't do anything, but the game would still recognize their existence. They look to be set up the same way shields are, everything in 2DAs, and it's possible to add new shields. I'm still not sure just how much of it is hard coded, though. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.