temnix Posted September 26, 2016 Share Posted September 26, 2016 I have an invisible creature, and let's say his file is called BEOWULF. Can I use that for Object? What if there are two BEOFWULFs? Link to comment
Ardanis Posted September 26, 2016 Share Posted September 26, 2016 Yes, but it needs to be its death variable, filename is only used when you spawn a new actor. That said, you can certainly set creature's DV to match its filename, to minimize confusion. If you have many, the latest spawned will be used. So you can spawn a cre, ActionOverride() it to go north, then spawn another and AO() it to go south, but once you have the second, you won't be able to rely on DV to call the first one. The first<->latest order changes when the game is saved and loaded, so it won't always be possible to tell one from another either. Link to comment
temnix Posted September 27, 2016 Author Share Posted September 27, 2016 How do I rename the death variable? (Such necromancy, ooh...) Link to comment
Ardanis Posted September 27, 2016 Share Posted September 27, 2016 It's a string at 0x280 in CRE file. Link to comment
Avenger Posted September 29, 2016 Share Posted September 29, 2016 It is properly called scripting name, though The death variable is derived from the scripting name by prepending it with SPRITE_IS_DEAD Link to comment
Ardanis Posted September 29, 2016 Share Posted September 29, 2016 Eh... well, yeah. I mean, ten years later it actually made good sense to me Link to comment
temnix Posted September 30, 2016 Author Share Posted September 30, 2016 So for BEOWULF.cre I can put SPRITE_IS_DEADBEOWULF in Object, and it will work? Or can I change the death variable somehow to whatever I want, from a script I mean? Link to comment
Ardanis Posted October 1, 2016 Share Posted October 1, 2016 You need to open the BEOWULF.CRE with NI and edit the field at 0x280. Click on Options and set "Show Hex Offsets" on, if you haven't already, then go to the "Edit" tab of the open file and scroll down until you the offset. As Avenger says, it is actually called script name there, not death variable, though I think pretty much everyone calls it DV..? Whatever. Set it to whatever name you want to use in the scripts - in this case, beowulf - it doesn't have to match the filename, but it makes scripting more convenient when it does. It's case insensitive, so both Beowulf and BEOWULF will work fine if you try to call it in the script. One thing to remember - since the engine uses this name to generate the death global by appending SPRITE_IS_DEAD to it, and the fact that variable's total length is limited to 32 characters, this means you only have 18 characters to use, otherwise extras will be truncated, which may or may not result in Dead("beowulf") triggers returning false when they should be true. Link to comment
Jarno Mikkola Posted October 1, 2016 Share Posted October 1, 2016 ...Or can I change the death variable somehow to whatever I want, from a script I mean? So in other words no, you have to edit the .cre file outside the game to do this, it can't be done in a script. Link to comment
Roxanne Posted October 1, 2016 Share Posted October 1, 2016 So for BEOWULF.cre I can put SPRITE_IS_DEADBEOWULF in Object, and it will work? Or can I change the death variable somehow to whatever I want, from a script I mean? What it means is the cre's scriptname at offset 280 is Beowulf, It creates a global Glonal("SPRITE_IS_DEADBEOWULF","Gloabal",1) if Beowulf is dead, while Glonal("SPRITE_IS_DEADBEOWULF","Gloabal",0) means he is alive. Scrits or dialogues like IF Dead("Beowulf") would trigger if the global is set to 1 etc.. To assign a new script name to a creature you would use your tp2 with an entry like COPY_EXISTING ~beowulf.cre~ ~override~ WRITE_ASCII 0x280~Beowulf~ If you use this assignment make sure a) that there is not yet an entry at 280, b) the script name you use is not yet assigned to another cre c) For compatibility with other mods use the cre name here as well (if possible). Ps Avengers remark was a bit of history reminding us why the script name was often (wrongly) referred to as death variable in tutorials etc.I think also older versions of NI used that phrase. Link to comment
Mike1072 Posted October 1, 2016 Share Posted October 1, 2016 COPY_EXISTING ~beowulf.cre~ ~override~ WRITE_ASCII 0x280~Beowulf~ You should use WRITE_ASCIIT here to make sure you completely overwrite the previous value. Link to comment
Jarno Mikkola Posted October 1, 2016 Share Posted October 1, 2016 So: COPY_EXISTING ~beowulf.cre~ ~override~ WRITE_ASCIIT 0x280 ~Beowulf~ ?? Link to comment
temnix Posted October 3, 2016 Author Share Posted October 3, 2016 Well, this discussion has veered off into parts unknown. All I wanted to know is whether I can peg a creature inside the game somehow, by its filename or something else. Link to comment
Avenger Posted October 16, 2016 Share Posted October 16, 2016 If you want to go by the "something else", you can also set it a unique 'specific' Identifier. ChangeSpecifics. This can be done in script, repeatedly with different values, and all object references would be able to "peg the creature". For example: IF .... THENRESPONSE #100ChangeSpecifics(Myself,40)END Note: IESDP still uses a 2 bytes value, but in fact, this can be only a single byte. You can also set the specifics field from any editor/weidu. Link to comment
temnix Posted October 19, 2016 Author Share Posted October 19, 2016 Thanks for the suggestion. Since posting the question I've learned to peg creatures. The best way all around is a custom spell state. Specifics are not so useful because creatures appear to ignore them, at least I haven't been able to get them to react. Perhaps they are more useful for spell effects. But then, I was very inexperienced with setting targets in scripts when I tried. Also a creature can have only one Specifics value at a time, and shamans' spirits, for instance, have the SPIRIT value assigned to them. Another way to mark a creature is through token objects, could be useful, but that one is a total mystery. Link to comment
Recommended Posts
Archived
This topic is now archived and is closed to further replies.