Heroes of Might and Magic Community
visiting hero! Register | Today's Posts | Games | Search! | FAQ/Rules | AvatarList | MemberList | Profile


Age of Heroes Headlines:  
5 Oct 2016: Heroes VII development comes to an end.. - read more
6 Aug 2016: Troubled Heroes VII Expansion Release - read more
26 Apr 2016: Heroes VII XPack - Trial by Fire - Coming out in June! - read more
17 Apr 2016: Global Alternative Creatures MOD for H7 after 1.8 Patch! - read more
7 Mar 2016: Romero launches a Piano Sonata Album Kickstarter! - read more
19 Feb 2016: Heroes 5.5 RC6, Heroes VII patch 1.7 are out! - read more
13 Jan 2016: Horn of the Abyss 1.4 Available for Download! - read more
17 Dec 2015: Heroes 5.5 update, 1.6 out for H7 - read more
23 Nov 2015: H7 1.4 & 1.5 patches Released - read more
31 Oct 2015: First H7 patches are out, End of DoC development - read more
5 Oct 2016: Heroes VII development comes to an end.. - read more
[X] Remove Ads
LOGIN:     Username:     Password:         [ Register ]
HOMM1: info forum | HOMM2: info forum | HOMM3: info mods forum | HOMM4: info CTG forum | HOMM5: info mods forum | MMH6: wiki forum | MMH7: wiki forum
Heroes Community > Heroes 4 - Lands of Axeoth > Thread: scrip custom skills
Thread: scrip custom skills This thread is 2 pages long: 1 2 · NEXT»
NecroSandro
NecroSandro


Hired Hero
posted March 01, 2019 03:30 PM

scrip custom skills

I want to create a script that gives movement points every day if the player answers yes to a question(one time), but my testsi did not work.

Ask question
-I can teach you how to walk much further. Are you interresing?
if yes
- give mouvement point
if no
ask question
- i can teach you how to summon some creature. Are you......


if someone can help me.

Thx you

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted March 01, 2019 06:34 PM

What kind of event is the "ask" script running on? If it is on a map timed event, then it's not connected to anything to give additional movement to.

The script should be on an army's or hero's timed events. Then you will have the option to add movement to the army / hero.

If you do have the script on and army or hero and they are not receiving a movement bonus, try adding some display scripts for the "yes" and "no" branches to see which one is actually being entered.

"Yes": DISPLAY "Yes I want to learn!"
"No": DISPLAY "No thanks!"

Also, how are you testing? Have you tried adding a LOT of movement points? I can't remember if there is a bug with adding movement or not, but I'm kind of remembering having to multiply by 10. If no one else chimes in by the time I get home, I will take a look at my scripts for increasing movement, which definitely work.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NecroSandro
NecroSandro


Hired Hero
posted March 01, 2019 08:11 PM

i try on army.

Like this its working


But i want army receive mouvement point each day if anwser question is yes without repeat the question all the time.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted March 01, 2019 08:20 PM
Edited by iliveinabox05 at 20:23, 01 Mar 2019.

NecroSandro said:
i try on army.

Like this its working

But i want army receive mouvement point each day if anwser question is yes without repeat the question all the time.


Ah okay. So it is adding movement to the army but you also want the question to only be asked once.

The way I would do it would be to create a boolean variable at the beginning of the script and set it to true.

set askQuestion = true

Then, create a conditional, and if askQuestion is true, put your ask script in the true fork, otherwise, nothing needs to be done.

After the ask script and still inside the true fork, set askQuestion to false. After that, your question won't be asked again.

You will also need to record the answer to your ask script in a boolean variable:

set wantsMovement = true / false

Finally, after the first conditional, you will want a new conditional, which checks the wantsMovement variable. If wantsMovement is true, add the movement, otherwise don't do anything.

Let me know if this helps.

Edit. Also, you will want to save the answers to any other ask scripts so that you can test those variables as well.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NecroSandro
NecroSandro


Hired Hero
posted March 01, 2019 08:36 PM

Ok i try it.

But its normal i cant do anything in conditional action?



Also

Quote:
Then, create a conditional, and if askQuestion is true, put your ask script in the true fork, otherwise, nothing needs to be done.


how to define " if ask question is true "
i dont find it.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted March 01, 2019 08:55 PM
Edited by iliveinabox05 at 20:57, 01 Mar 2019.

NecroSandro said:
Ok i try it.

But its normal i cant do anything in conditional action?

Also

how to define " if ask question is true "
i dont find it.


You should be able to click "new" or maybe right click on the "sequence" script and select the new option from there.

If you still can't add a script to the conditional, then you might need to use the game's editor to create some of the scripts.

Also, the H4MG can actually drag and drop scripts into each other, so you could actually drag your "ask" script into the conditional sequence on the true fork, since you already made that script.

As far as setting ask question, you need to define your boolean variable first:

set askQuestion = true

It should just be one of the "Set" script options, similar to how you set a numeric variable.

Edit. It might also be under "variable", I've just been going off the top of my head since I'm at work and can't actually look at the editor.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NecroSandro
NecroSandro


Hired Hero
posted March 01, 2019 10:36 PM

Ok, tell me if first step are correct please.



Thank you

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted March 01, 2019 10:49 PM
Edited by iliveinabox05 at 22:50, 01 Mar 2019.

NecroSandro said:
Ok, tell me if first step are correct please.

Thank you


You're getting closer.

Set askQuestion to true is correct.

In the conditional right below that. instead of "if TRUE", it should be "if askQuestion equals true". You'll need to click on the conditional and update the condition.

You will also want the script adding movement to be in a second conditional after the first one, since once you set askQuestion to false, you won't ever get to it again.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NecroSandro
NecroSandro


Hired Hero
posted March 01, 2019 11:23 PM



I'm not far I think but I can not repeat "increase point of movement" every day

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted March 01, 2019 11:29 PM
Edited by iliveinabox05 at 23:30, 01 Mar 2019.

NecroSandro said:
I'm not far I think but I can not repeat "increase point of movement" every day


Looking good! The only other thing you'll need to do is go to the map menu, and then create a timed event there for day 1 that doesn't repeat, which will initialize (set) your "wantsTraveler" and other variables to false, just to be safe. I'm pretty sure they are all false by default, but doesn't hurt to make sure

What do you mean by you can't repeat the increasing of movement every day? Try putting a DISPLAY script inside the "wantsTraveler" conditional right before you add the movement points. Then you can test by seeing if you get the DISPLAY message at the beginning of each turn.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NecroSandro
NecroSandro


Hired Hero
posted March 01, 2019 11:44 PM
Edited by NecroSandro at 23:56, 01 Mar 2019.

Ok, i put Display message and i got the message one time.. but what i want is ask question one time but increase mouvement point repeat each day ( not the ask question).

and, i see display message of all variable.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted March 02, 2019 12:29 AM

NecroSandro said:
Ok, i put Display message and i got the message one time.. but what i want is ask question one time but increase mouvement point repeat each day ( not the ask question).

and, i see display message of all variable.


Right, only ask the question on first day, and then apply the bonuses the rest. Can you show me the general tab for that event, please? It should be working so that the question is only asked the first day and the bonus should be applied every time.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NecroSandro
NecroSandro


Hired Hero
posted March 02, 2019 12:50 AM
Edited by NecroSandro at 00:52, 02 Mar 2019.

Yes , its that


 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted March 02, 2019 05:30 AM

Go to the "general" tab. By default, timed events are only run once. To run them repeatedly, make sure you select "Every 1 day" instead of "never" in the "Subsequent occurrences" box.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NecroSandro
NecroSandro


Hired Hero
posted March 03, 2019 11:49 AM

iliveinabox05 said:
Go to the "general" tab. By default, timed events are only run once. To run them repeatedly, make sure you select "Every 1 day" instead of "never" in the "Subsequent occurrences" box.


Hi, sorry for answer time, my baby just born last day .

if i check " repeat each day" , ask question is repeating too

and i got display message for all variable ( you can see it on script i show you before)

sorry for my english im french

[url=https://streamable.com/gbj6o]video of script[/url]

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted March 04, 2019 02:47 AM
Edited by iliveinabox05 at 02:47, 04 Mar 2019.

NecroSandro said:
Hi, sorry for answer time, my baby just born last day .

if i check " repeat each day" , ask question is repeating too

and i got display message for all variable ( you can see it on script i show you before)

sorry for my english im french

video of script


Congrats on the baby!

You do want the script to run everyday so you need to have that checked.

The reason the question is asked each day is because you set askQuestion to true at the beginning of the script.

You'll want to select "campaign" -> "map properties" from the top menu of the editor. There you will want to click on the "events" tab and switch to "timed." You'll want to make a new timed event which only runs on the first day, where you set askQuestion to true. You'll also want to set your custom skill variables to false in this event.

Give that a try and let me know how if that works.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NecroSandro
NecroSandro


Hired Hero
posted March 04, 2019 04:10 PM
Edited by NecroSandro at 16:47, 04 Mar 2019.

i dont get it grrrr

[url=https://streamable.com/80hpo]video[/url]




 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted March 04, 2019 05:43 PM

Upload the map somewhere for me and I'll take a look when I get home from work

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
NecroSandro
NecroSandro


Hired Hero
posted March 04, 2019 06:37 PM

iliveinabox05 said:
Upload the map somewhere for me and I'll take a look when I get home from work


i send you by mp

script on red hero at 63,50 lvl 1. Thank you

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
iliveinabox05
iliveinabox05


Honorable
Famous Hero
posted March 04, 2019 07:42 PM
Edited by iliveinabox05 at 17:29, 05 Mar 2019.

Received. I'll download it and open it up when I get home. It will be a little later tonight, but I'll get to it.

Edit. Hate to make excuses, but when I got home, the power went out >.< I'll try to take a look tonight.

 Send Instant Message | Send E-Mail | View Profile | Quote Reply | Link
Jump To: « Prev Thread . . . Next Thread » This thread is 2 pages long: 1 2 · NEXT»
Post New Poll    Post New Topic    Post New Reply

Page compiled in 0.1056 seconds