View previous topic :: View next topic |
Author |
Message |
Body-Guard Unstoppable!
Joined: 08 Jan 2006 Location: Hungary
|
Posted: Mon Oct 20, 2014 4:26 am Post subject: CPA_JumpIfScriptResult, CPW_JumpIfScriptResult |
|
|
Hello,
Before requesting an another feature, I'd like to thanks the work so far on Zdaemon. Especially the recent changes in b03, providing ACS interface for dehacked is possibly one of the biggest milestone for modders at Zdaemon. The idea I bring up now would further extend the possibilities.
1. What is the idea?
In 1.09, ACS_ExecuteWithResult was implemented.
Code: | 13. Implemented 2 new action specials: ACS_ExecuteWithResult..... |
It basically invokes a script, which can be set a result value (very much like a function). Combining this with dehacked can be used to create frame jumps depending on the script's result value called by ACS_ExecuteWithResult (this would be the topic of the feature request).
2. Syntax
CPA_JumpIfScriptResult (for actor frames), CPW_JumpIfScriptResult (for weapon frames)
Args1 = script number to run
Args2 = argument 1 passed to script
Args3 = argument 2 passed to script
Args4 = argument 3 passed to script
Args5 = argument 4 passed to script
Args6 = the result value the comparison should be made against
Args7 = the frame number to jump to if Args6 equals to the result value of the called script
The first 5 args are basically those of ACS_ExecuteWithResult's. The jump is not executed if the result value does not match Args6.
3. Why is it good?
Because you can execute a conditional frame jump in dehacked and you can express any condition accessible with ACS.
A sketch how you could do reloading weapons with this:
1. Use this codepointer in one of the weapon ready frames
2. the script called by this codepointer sets its own result value depending on how many ammo the player has (eg. using % 5 on Clip ammo returns 0 each time the ammo amount is divideable with 5) -> this means that each time the result is 0, 5 shots have been fired, so use the codepointer to jump to reloading frames.
A sketch how you could alter monster attack pattern depending on its health:
1. Use the codepointer in the monster's attack frame
2. the script called by this codepointer sets its own result value according to hit points the monster currently has (eg. returns 1 if it has less than 50 HP) -> this means that each time the result is 1, jump to a different attack frame.
4. Summary
Apart from the two examples above, the possibilities are only limited by what you can express in ACS, which means A LOT.
Looking forward seeing this implemented sometime, thanks in advance |
|
Back to top |
|
|
Body-Guard Unstoppable!
Joined: 08 Jan 2006 Location: Hungary
|
Posted: Mon Oct 20, 2014 8:59 am Post subject: |
|
|
Delay functions within the script shouldn't cause problems, because as the wiki says, the result has to be decided before any of them are used. |
|
Back to top |
|
|
Aeyesx Dominating!
Joined: 13 Oct 2012
|
Posted: Tue Oct 21, 2014 11:34 am Post subject: |
|
|
Reloading weapons! It's real yay! |
|
Back to top |
|
|
Maikl_Russia has entered the game!
Joined: 18 Jul 2005 Location: RU
|
Posted: Tue Oct 13, 2015 11:58 am Post subject: |
|
|
These CP would have been extremely useful for moding. ++++
Quote: | Args7 = the frame number to jump to if Args6 equals to the result value of the called script |
Frame number or thing's state.
Even more: if would be possible via ACS getting the arguments passed to a thing in the map editor - not need A_JumpIf CP ([Dehacked] JumpIfArgs) |
|
Back to top |
|
|
Aeyesx Dominating!
Joined: 13 Oct 2012
|
Posted: Tue Oct 13, 2015 12:30 pm Post subject: |
|
|
Nah Maikl_Russia, both needed, don't ask why xD |
|
Back to top |
|
|
Maikl_Russia has entered the game!
Joined: 18 Jul 2005 Location: RU
|
Posted: Tue Oct 13, 2015 1:28 pm Post subject: |
|
|
ACS easy to be learned.
And less work for developers. |
|
Back to top |
|
|
Aeyesx Dominating!
Joined: 13 Oct 2012
|
Posted: Tue Oct 13, 2015 1:32 pm Post subject: |
|
|
Might be, yet u cannot hack everything with it. + what you said is kinda nonsence >D What would be that good for? Move mapping aspects into ACS? |
|
Back to top |
|
|
Maikl_Russia has entered the game!
Joined: 18 Jul 2005 Location: RU
|
Posted: Tue Oct 13, 2015 1:46 pm Post subject: |
|
|
Aeyesx wrote: | Might be, yet u cannot hack everything with it. |
It's just a question of the sufficiency of the ACS functions.
Aeyesx wrote: | + what you said is kinda nonsence >D What would be that good for? Move mapping aspects into ACS? |
Why not? ACS much much more powerful than dehacked only. |
|
Back to top |
|
|
Aeyesx Dominating!
Joined: 13 Oct 2012
|
Posted: Tue Oct 13, 2015 1:49 pm Post subject: |
|
|
True, lets move everything into ACS, actors definitions, sound definitions, and as you mentioned thing properities and perhaps whole map editor, as its just bunch of points with properties >)
I am giving this +1 |
|
Back to top |
|
|
Maikl_Russia has entered the game!
Joined: 18 Jul 2005 Location: RU
|
Posted: Tue Oct 13, 2015 2:17 pm Post subject: |
|
|
Aeyesx wrote: | True, lets move everything into ACS, actors definitions, sound definitions, and as you mentioned thing properities and perhaps whole map editor, as its just bunch of points with properties >)
I am giving this +1 |
!ice_tea to Medis.
The main goal is to less work for developers. Why needs to hardcode new things/actions/etc if it would be possible make with ACS?
"Do not feed a man by a fish, give him a fishing rod and teach to fish." (C) |
|
Back to top |
|
|
Body-Guard Unstoppable!
Joined: 08 Jan 2006 Location: Hungary
|
Posted: Wed Oct 14, 2015 5:27 pm Post subject: |
|
|
Maikl_Russia wrote: | Even more: if would be possible via ACS getting the arguments passed to a thing in the map editor - not need A_JumpIf CP ([Dehacked] JumpIfArgs) |
While it is true that it is possible to implement a new ACS function to get the map editor arguments of the thing, you would still need to write a script just for the purpose to get the arguments and use it in conjunction with JumpIfScriptResult.
Pro: more flexible, because you can return different script results depending on combinations of map editor thing arguments, instead of just checking for one argument as per the JumpIfArgs request specifies.
Con: most of the time, checking for only one argument is enough, like the case with the example posted in JumpIfArgs topic. If it has to be done with JumpIfScriptResult, one would need to write ACS script as well, instead of just having the ability to explicitly access map editor arguments from dehacked.
Anyway, rather than a new function, several new constants could be introduced to Get/Check/SetActorProperty which refer to the respective map editor thing arguments.
Code: | APROP_ThingArg1....APROP_ThingArg5 |
|
|
Back to top |
|
|
Aeyesx Dominating!
Joined: 13 Oct 2012
|
Posted: Thu Oct 15, 2015 4:20 pm Post subject: |
|
|
I can say only one thing to this
|
|
Back to top |
|
|
TheCupboard Generic Title
Joined: 25 Feb 2007 Location: USA
|
Posted: Sat Oct 17, 2015 7:58 am Post subject: |
|
|
likes this |
|
Back to top |
|
|
Maikl_Russia has entered the game!
Joined: 18 Jul 2005 Location: RU
|
Posted: Tue Oct 20, 2015 10:15 pm Post subject: |
|
|
Body-Guard wrote: | While it is true that it is possible to implement a new ACS function to get the map editor arguments of the thing, you would still need to write a script just for the purpose to get the arguments and use it in conjunction with JumpIfScriptResult. |
Body-Guard, you will need only one script (comparable in difficulty with "Hello, world."). And you know this.
Btw, do not think that I am strongly opposed to JumpIfArgs CP. I just think that JumpIfArgs CP duplicates (in simplified form) CPA_JumpIfScriptResult. |
|
Back to top |
|
|
Body-Guard Unstoppable!
Joined: 08 Jan 2006 Location: Hungary
|
Posted: Wed Oct 21, 2015 8:18 am Post subject: |
|
|
It is not about the script being complicated. Why to use acs for a simple task when you have direct access to thing arguments with JumpIfArgs? I understand that JumpIfScriptResult is more general and could cover (and extend functionality of) JumpIfArgs as well, but that would require further ACS extensions from developer side either with a new function to get thing arguments as you said or new constants for ActorProperty functions as I said.
This is roughly the same debate as why to have PlaySound codepointer when you can execute ACS scripts on frames, which then calls ActivatorSound. ACS is more flexible, yes, but overkill for such a simple task. |
|
Back to top |
|
|
|