First off iv been pouring over these forms for a bit now, but thats gotten me more lost while simplifying my problem also. What you guys do with these scripts is amazing.
So im messing with fighting in tight spaces and found the enemies hp pointers and how they adjust the offset for each additional enemy as they are added to the map.
Im looking to have NPC1 (the first enemy/protection target thats spawned) as my base pointer, with a script that adds children with the adjusted offset (i currently manually add children as +104/+208/ect). With number of children defined by a dropdown or setting a value for another table entry, so it can be added and reduced on the fly as enemies spawn in then reset on the next map. 4 byte if it makes a difference.
Thank for any time you can spare for this. Im sure its actually something incredibly simple, but i definitely dont have enough experience with this stuff yet.
req: dynamic number of children addresses
- (V)(;,,;)(V)
- Expert Cheater
- Posts: 57
- Joined: Sat Aug 18, 2018 8:08 pm
- Reputation: 11
Re: req: dynamic number of children addresses
Hi, i am not sure if i understand your Problem right.(V)(;,,;)(V) wrote: ↑Sun Dec 05, 2021 4:34 amFirst off iv been pouring over these forms for a bit now, but thats gotten me more lost while simplifying my problem also. What you guys do with these scripts is amazing.
So im messing with fighting in tight spaces and found the enemies hp pointers and how they adjust the offset for each additional enemy as they are added to the map.
Im looking to have NPC1 (the first enemy/protection target thats spawned) as my base pointer, with a script that adds children with the adjusted offset (i currently manually add children as +104/+208/ect). With number of children defined by a dropdown or setting a value for another table entry, so it can be added and reduced on the fly as enemies spawn in then reset on the next map. 4 byte if it makes a difference.
Thank for any time you can spare for this. Im sure its actually something incredibly simple, but i definitely dont have enough experience with this stuff yet.
You have a basepointer for one Enemy and offsets for other enemies ?
If so i suggest to use a Table maybe like this
Spoiler
Code: Select all
local base = someAddress
local enemies = {offset1,offset2,offsetN..} --declare table
--create a Timer and in this Context do
for i=1,#enemies do
local res = base .. enemies[i]
-- check if res != nil
-- do something with Value or Address
end
Re: req: dynamic number of children addresses
Just to chime in. Lua syntax for not equal is "~=" instead of "!="
- (V)(;,,;)(V)
- Expert Cheater
- Posts: 57
- Joined: Sat Aug 18, 2018 8:08 pm
- Reputation: 11
Re: req: dynamic number of children addresses
Ok thank you for the help.
to clarify what im trying to do is:
I found a script from zaner from...like 2015 on the original CE fourm that i tried to adapt.
I changed the addMoreAddresses line to
("NPCs",5,260)
Used NPCs in hope it would auto refrence the NPCs table entry but ce doesnt work like that unfortunately. And the 260 was trial and error but after i messeged zanzer about the script i realized the 260 was just my 104 offset in HEX.
Thats about as far as i got last night.
to clarify what im trying to do is:
Spoiler
- NPCs (the pointer i have)
- script here that uses the parent address as the base address, and uses another entry as the selector for amout of children addresses to create
- figured this is the best place for the selector dummy address. Always minimum of 1
- NPC1 (address/offset +0)
- NPC2 (+104)
- NPC3(+208)
- NPC4(+30C)
- ect.
- figured this is the best place for the selector dummy address. Always minimum of 1
- script here that uses the parent address as the base address, and uses another entry as the selector for amout of children addresses to create
Spoiler
Code: Select all
function addMoreAddresses(baseAddress, num, step)
local al = getAddressList()
local base = al.createMemoryRecord()
base.setAddress(baseAddress)
base.setDescription("Base Address")
base.Type = vtString
base.String.Size = 0
for i=0, num-1 do
local rec = al.createMemoryRecord()
local str = string.format("+%X", i * step)
rec.setAddress(str)
rec.setDescription(str)
rec.appendToEntry(base)
end
end
addMoreAddresses("002C083C", 10, 4)
("NPCs",5,260)
Used NPCs in hope it would auto refrence the NPCs table entry but ce doesnt work like that unfortunately. And the 260 was trial and error but after i messeged zanzer about the script i realized the 260 was just my 104 offset in HEX.
Thats about as far as i got last night.
Re: req: dynamic number of children addresses
Try this -> addMoreAddresses("some fixed Address", 5 Entries or whatever, 260)(V)(;,,;)(V) wrote: ↑Mon Dec 06, 2021 6:37 pmOk thank you for the help.
to clarify what im trying to do is:
I found a script from zaner from...like 2015 on the original CE fourm that i tried to adapt.Spoiler
Hope for a way to make the script refresh when manually changing the selector amount. Or setting it and disable/re enable to refresh the children count for when moving to a new map
- NPCs (the pointer i have)
- script here that uses the parent address as the base address, and uses another entry as the selector for amout of children addresses to create
- figured this is the best place for the selector dummy address. Always minimum of 1
- NPC1 (address/offset +0)
- NPC2 (+104)
- NPC3(+208)
- NPC4(+30C)
- ect.
I changed the addMoreAddresses line toSpoiler
Code: Select all
function addMoreAddresses(baseAddress, num, step) local al = getAddressList() local base = al.createMemoryRecord() base.setAddress(baseAddress) base.setDescription("Base Address") base.Type = vtString base.String.Size = 0 for i=0, num-1 do local rec = al.createMemoryRecord() local str = string.format("+%X", i * step) rec.setAddress(str) rec.setDescription(str) rec.appendToEntry(base) end end addMoreAddresses("002C083C", 10, 4)
("NPCs",5,260)
Used NPCs in hope it would auto refrence the NPCs table entry but ce doesnt work like that unfortunately. And the 260 was trial and error but after i messeged zanzer about the script i realized the 260 was just my 104 offset in HEX.
Thats about as far as i got last night.
104 Hex is 260 in Dec
I personally would just count the Maximum Enemies per Level + some Treshhold and let the script decide what Pointer is valid.
Spoiler
Code: Select all
local bp = '[someBasePointer]+'
local offsets = {}
for i=0, 2600,260 do
table.insert(offsets,bp .. string.format("%x",i))
end
for j=1,#offsets do
print(offsets[j])
end
[someBasePointer]+0
[someBasePointer]+104
[someBasePointer]+208
[someBasePointer]+30c
[someBasePointer]+410
[someBasePointer]+514
[someBasePointer]+618
[someBasePointer]+71c
[someBasePointer]+820
[someBasePointer]+924
[someBasePointer]+a28
- (V)(;,,;)(V)
- Expert Cheater
- Posts: 57
- Joined: Sat Aug 18, 2018 8:08 pm
- Reputation: 11
Re: req: dynamic number of children addresses
Is there a way for me to change "some fixed address" to look for a table entry with a certain description? Thats the biggest thing im looking for, but i cant find it in the CE lua wiki.
If i can do that, that would make it so i could simplify some other tables iv made also.
Lol this feels like working with circles but without the knowledge of pi. Figue there is a comand i keep over looking on the wiki
If i can do that, that would make it so i could simplify some other tables iv made also.
Lol this feels like working with circles but without the knowledge of pi. Figue there is a comand i keep over looking on the wiki
Re: req: dynamic number of children addresses
(V)(;,,;)(V) wrote: ↑Mon Dec 06, 2021 7:47 pmIs there a way for me to change "some fixed address" to look for a table entry with a certain description? Thats the biggest thing im looking for, but i cant find it in the CE lua wiki.
If i can do that, that would make it so i could simplify some other tables iv made also.
Lol this feels like working with circles but without the knowledge of pi. Figue there is a comand i keep over looking on the wiki
Code: Select all
local al = getAddressList()
local mr = al.getMemoryRecordByDescription('entry_description_here')
if mr ~= nil then
-- entry exists
else
error('The entry doesn\'t exist')
end
Re: req: dynamic number of children addresses
..and you can always check my Horizon Zero Dawn table here: viewtopic.php?t=13317. See '[Existing Inventory] Inventory Editor' script.
- (V)(;,,;)(V)
- Expert Cheater
- Posts: 57
- Joined: Sat Aug 18, 2018 8:08 pm
- Reputation: 11
Re: req: dynamic number of children addresses
Ah that github page never came up while i was looking around, just from a glance iv already seen some functions/descriptions i didnt see elsewhere. Thanks again for all the help everyone.
Who is online
Users browsing this forum: No registered users