Greetings, folks. I'm a bit new to scripting in the toolset, though I have been programming for a decent amount of time in general. A friend of mine suggested I post here to ask for help, since I am unfamiliar with the nuts and bolts of how to hook into what the game engine does on its own. More specifically, this is intended to work with the DA2 base game, not DAO.
What I am hoping to do is to create an event listener that autoruns on game start, and will call my code whenever the game sends an EVENT_TYPE_PLAYER_LEVELUP. I'm not sure how to go about doing this. From what I understand via reading the wiki, I'd insert this via a PRCSCR, but I'm foggy on the specifics of how the event system actually works. Do I need to create a loop that idles until it receives an event? Can I fork a thread and just put it to sleep until it receives the event? Or is there some other handling method for them?
Thanks in advance.
DA2 scripting: Hooking into a level up event
Débuté par
hoorayforicecream
, juin 09 2011 03:07
#1
Posté 09 juin 2011 - 03:07
#2
Posté 15 juin 2011 - 06:59
In DAO, you'd write an event script which includes the level up event as a case.
That event is normally handled by the player_core script. You can override this by specifying your script in the events 2DA.
Not sure whether this will work in DA2, but it's worth a try.
That event is normally handled by the player_core script. You can override this by specifying your script in the events 2DA.
Not sure whether this will work in DA2, but it's worth a try.
#3
Posté 15 juin 2011 - 11:14
I think we tried it as an event override, but it didn't do anything :-/ hoorayforicream would know better.
SetMaxHealth and SetMaxStamina also don't work properly. The health command doesn't do anything at all, and the stamina command sets it to 427(?) no matter what.
Is there a ModMaxHealth command that adds or subtracts from the value instead of just setting the value to a new number?
SetMaxHealth and SetMaxStamina also don't work properly. The health command doesn't do anything at all, and the stamina command sets it to 427(?) no matter what.
Is there a ModMaxHealth command that adds or subtracts from the value instead of just setting the value to a new number?
#5
Posté 15 juin 2011 - 11:44
Actually, I'm looking for an alternative to SetMaxHealth
#6
Posté 15 juin 2011 - 11:46
ishmaeltheforsaken wrote...
Actually, I'm looking for an alternative to SetMaxHealth
Yes, that's what the Remark on that page provides.
#7
Posté 15 juin 2011 - 11:56
Oh, so I see! My bad >.<
I'll definitely have hoorayforicecream look at that, thanks!
I'll definitely have hoorayforicecream look at that, thanks!
#8
Posté 16 juin 2011 - 04:26
So... it works, kind of. For some reason, using calling Chargen_ModifyCreaturePropertyBase will instantly kill the player by making his or her health treated as a 100% sustain. This appears to happen if I try to modify *any* property of the player, not just health.
#9
Posté 16 juin 2011 - 06:00
lol "the operation was a success but the patient died"...
The following code increases player health by 50:
I can easily imagine that conflicts might occur during the level up event. Perhaps you need to adjust the health in a delayed event?
The following code increases player health by 50:
I have this working in EVENT_TYPE_UNIQUE_POWER, which I use for test biz.Chargen_ModifyCreaturePropertyBase(GetHero(),PROPERTY_DEPLETABLE_HEALTH, 50.0);
I can easily imagine that conflicts might occur during the level up event. Perhaps you need to adjust the health in a delayed event?
Modifié par Proleric1, 16 juin 2011 - 06:01 .
#10
Posté 16 juin 2011 - 06:59
That's not the problem. I tried using two different values for health (123.0 and 1234.0, in case it was a bounds issue), then tried just setting stamina (PROPERTY_DEPLETABLE_MANA_STAMINA) instead, and both cases caused the hero to keel over and die, due to 100% sustained health. The only difference is that setting the PROPERTY_DEPLETABLE_HEALTH made the health total go up, but was still 100% sustained. Keep in mind that this is DA2, not DAO, so that may explain the oddity.
Also, I wasn't trying to adjust it based on an event. I just had a script with a void main() that adjusted the player's health and stamina that I ran from the console (I wanted to make the script do what I want it to first, then figure out how to call it at the appropriate time once it works). The health value would change, then the hero would keel over.
Also, I wasn't trying to adjust it based on an event. I just had a script with a void main() that adjusted the player's health and stamina that I ran from the console (I wanted to make the script do what I want it to first, then figure out how to call it at the appropriate time once it works). The health value would change, then the hero would keel over.
Modifié par hoorayforicecream, 16 juin 2011 - 07:00 .
#11
Posté 17 juin 2011 - 05:26
Sounds like a DA2 issue, then.
I found the DAO solution by imitating what Bioware do in sys_autoscale_h.
I found the DAO solution by imitating what Bioware do in sys_autoscale_h.
#12
Posté 18 juin 2011 - 01:12
Proleric1 wrote...
Sounds like a DA2 issue, then.
I found the DAO solution by imitating what Bioware do in sys_autoscale_h.
Yeah, it's a DA2 issue. I tried running the same script in DAO and it works just fine. Back to the drawing board then...





Retour en haut






